Gossamer Forum
Home : General : Perl Programming :

Function only returns received argument??

Quote Reply
Function only returns received argument??
I have the following code

sub node_whatis {
# returns a legend image to know what are we browsing (Links, Files etc)
# node_id is the Category, what we need is to determine WHAT is in that category, so we query the
# cateogory DB, get NumLinks and then begin to check: Features, File, Detailed and Regular, depending
# of the result

my $lid = shift;

my $catego = $DB->table('Category');
my $sth_loop = $catego->select ( { ID => $lid } );
my $row = $sth_loop->fetchrow_hashref;

my $numlinks = "$row->{Number_Of_Links}";

my $image = $numlinks . 'cart.gif';

my $output = "<img width=18 height=16 border=0 src=$CFG->{build_images_url}/$image>";

return $output;

It takes an argument, then it should do a database operation and return another... I've tried to debug this, and the ONLY value that I can return succesfully is the value I get as an argument why???

Last edited by:

Paul: Jun 21, 2003, 11:44 AM
Quote Reply
Re: [jaltuve] Function only returns received argument?? In reply to
There must be something amiss. You are explicitly defining $output as an image tag and then returning it straight away so it can't be turning itself into another value.