Gossamer Forum
Quote Reply
Always returns 1?
I'm trying to figure out why this tag *always* returns '1';

<%Plugins::Add_RandImage::Make_Image%>

The sub is simply;

Code:
sub Make_Image {
return "here";
}

I'm completly stumped as to why it would/does do this Unimpressed

Also, while writing a thread....

my $database_connection = $DB->table('AddLinkSession');

This *sometimes* gives me the error;


A fatal error has occured:

GT::SQL (12778): File '/home/bn123/bn123.net/cgi-bin/portal/admin/defs/lsql_.def' does not exist or the permissions are set incorrectly at /home/bn123/bn123.net/cgi-bin/portal/admin/Plugins/Add_RandImage.pm line 59.

Please enable debugging in setup for more details.



Any ideas what could cause this? Its the first time I have ever seen this problem Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: May 26, 2003, 3:27 AM
Quote Reply
Re: [Andy] Always returns 1? In reply to
How are you calling the sub and displaying the value?

h


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Always returns 1? In reply to
All I am doing, is putting the tag in add.html, as follows;

<%Plugins::Add_RandImage::Make_Image%>

also tried;

<%Plugins::Add_RandImage::Make_Image()%>

Make_Image is just a sub routine in the plugin. Nothing like this has happend before (my Category_Adverts plugin uses this method without a problem). Thats why I'm so confused about it all Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Always returns 1? In reply to
There's no reason for one to be returned if what you've showed us is 100% exactly what you have tried.

1 will be returned for example if you print a print...eg...

print this();
sub this {
print "hello";
}

print() prints hello but as it's the last line of the subroutine 1 is returned for success and the first print then prints the 1 so you'd end up with:

hello1
Quote Reply
Re: [Paul] Always returns 1? In reply to
This is the whole routine;

Code:
sub Make_Image {
# -------------------------------------------------------------------

return "here";

#my $date = localtime;
#$date =~ s/ //sig;
#$date =~ s/://sig;

# create the random string...
#my @letters = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9');
#my ($i,$string,$rand);
#my @number = (1..59);
#for ($i=0; $i <= 8; $i++) {
# if ($i == 4) { $string .= "\n"; } # add a newline after 4 letters..
# $rand = int(rand scalar(@number));
# $string .= " " . $letters[$rand] . " ";
#}

#$back = "here 2<BR>";
#return $back;

}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Paul] Always returns 1? In reply to
Well, I have totally re-constructed the routine now, and its working (at least I'm now getting an error). I'm just working on fixing the errors now :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Always returns 1? In reply to
Usually when something is returning a 1, it's just evaluating to true, or returning the number of items rather than the values.

I couldn't see where it was doing either of those in the code you showed, but who knows :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Always returns 1? In reply to
Thats why I was so confused. As I said though, I have re-written it all (piece by piece), and it doesn't seem to be doing it now. The lsql_.def problem is also gone Smile)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!