Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Adding a variable to a HASH.

Quote Reply
Adding a variable to a HASH.
Hi:

I am NOT God's gift to perl programers- I can barely get by! Hoping someone would help me a bit on this- happy to share the final results if there is any interest.

The project is to allow mutliple detail pages in Links 3.0.I have a plug-in that worked in 2.X, but with some of the changes, well, I have got most worked out, but hit the wall in one regard. I used to just tag the code to point to the "correct" detail page in the URL- just a simple addition of "p=c" in the URL. In 2.0, the Link was pulled in Build.pm, so I just passed the variable to Build, and used that variable to determine the correct template.

In 3.0, page.cgi pulls the link info, thus:

my $link_db = $DB->table('Links');
$link = $link_db->get($id, 'HASH');

and sends that as a hash to Build, thus:

print $IN->header();
print Links::Build::build ('detailed', $link);

I need to add my "p" variable into that hash (I think!) I ahve tried this:

print $IN->header();
print Links::Build::build ('detailed', $link, p => $p);

but that breaks the system and I get errors. Do I use "push (or is it "pull" ?) to add this to the hash? How?

Then, once in Build, I just pull it out with a simple:

$link->{'p'} eq 'c'

right?

I get this, and I should have it all wrapped up!

Thanks!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Subject Author Views Date
Thread Adding a variable to a HASH. carfac 1555 Apr 8, 2005, 8:48 PM
Thread Re: [carfac] Adding a variable to a HASH.
carfac 1438 Apr 8, 2005, 8:56 PM
Thread Re: [carfac] Adding a variable to a HASH.
fuzzy logic 1438 Apr 8, 2005, 9:22 PM
Post Re: [fuzzy logic] Adding a variable to a HASH.
carfac 1448 Apr 8, 2005, 9:23 PM