Gossamer Forum
Quote Reply
Why can't I do this?
I have made this global that I want to use in a second LINKS SQL installation (ie pull info from another installation) - but I get tons of errors..

Can anyone see what I am doing wrong?

sub {
use lib \'...\';
use Links qw/$IN $DB $CFG/;
use Links::Plugins;
use GT::Date;
Links::init(\'...\');
Links::init_user();


my $user = shift;
my $loop = $DB->table(\'Links\')->select( { LinkOwner => $user } )->fetchall_arrayref({});
return { my_total => scalar @$loop, my_links => $loop };
}

http://www.ameinfo.com

Last edited by:

Paul: Apr 11, 2003, 8:54 AM
Quote Reply
Re: [klauslovgreen] Why can't I do this? In reply to
Try this one:
Code:
sub {
my $user = shift;
lib->import('...'); # might not be necessary
require GT::SQL; # might not be necessary
my $table = GT::SQL->new('...')->table('Links');
if ($table->count( { LinkOwner => $user } )) {
my $loop = $table->select( { LinkOwner => $user } )->fetchall_hashref;
return { my_total => scalar @$loop, my_links => $loop };
}
return;
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins

Last edited by:

Paul: Apr 11, 2003, 8:55 AM
Quote Reply
Re: [yogi] Why can't I do this? In reply to
Thanks Ivan... works perfectly!

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Why can't I do this? In reply to
Paul - can you remove this post as it reveal a bit more than I like...

Cheers
Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Why can't I do this? In reply to
Done. Let me know if I've missed anything.

Just whilst I was editing your posts I spotted that you'd escaped single quotes on the use lib and Links::init lines.

Just wondering why?
Quote Reply
Re: [Paul] Why can't I do this? In reply to
Thanks Paul - apprciate it...

Yeah I removed the escape bit in the final version - not quite sure what made me put them in there in the first place...

Klaus

http://www.ameinfo.com