Gossamer Forum
Home : General : Perl Programming :

Mad...how can it exist, yet it doesnt?

Quote Reply
Mad...how can it exist, yet it doesnt?
This is silly....this code;

Code:
if (!$found) {
if ($debug) { &debug("Wasn't found, so adding $into_cron $query"); }
if ($debug) { &debug("\$query = $query"); }
if ($debug) { &debug("\$into = $into"); }
$back_into_file .= "$into $query\n";
}

Produces;

DEBUG INFO: $query = INSERT INTO
DEBUG INFO: $into = test1234

YET, viewing the contents of $back_into_file shows;

INSERT INTO

...i.e without the $into part! How can the variable exists one line above, but not show on the next? It silly!

Any ideas? Crazy

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] Mad...how can it exist, yet it doesnt? In reply to
Well firstly why are you using three "if" blocks?....all those debugging calls could go inside one "if" block as they are all checking for the same scalar - $debug

As for the other thing - shouldn't the order be INSERT INTO test1234?....in which case it should be $query $into not $into $query

As for it not showing $into, there's no reason why, it must be an error somewhere.
Quote Reply
Re: [Andy] Mad...how can it exist, yet it doesnt? In reply to
Are the variables getting reset in &debug() ?
Quote Reply
Re: [Mark Badolato] Mad...how can it exist, yet it doesnt? In reply to
That debugging stuff is only there as a temp, but I'll make it one statement if it keeps you happy Wink

Code:
if (!$found) {
if ($debug) { &debug("Wasn't found, so adding $into_cron $query");
&debug("\$query = $query");
&debug("\$into_cron = $into_cron"); }
$back_into_file .= $into_cron . " test\n";
}

the degbug sub is;

Code:
sub debug {
# -------------------------------------------------------------------
# This is where we show debug info...no Exit command here though...

my $show_it = shift;
print $IN->header();
print "<font color=purple><b>DEBUG INFO:</b></font> <font color=red>$show_it</font><BR>";

}

Its stupid, cos the only variable I create in $debug is $show_it Unsure

I'm wondering if it would make a difference that $into_cron is made from within an 'if' statement? Sounds silly, but you never know Tongue

Thanks for the replys so far....

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] Mad...how can it exist, yet it doesnt? In reply to
Never mind, I fixed it....where $into_cron was being defined in the 'if' statement, I was also assigning the \n to it....but when I tried to add it, there was another zn being added....thus it was doing;

$into_cron
test

Well, thats fixed now..thanks for the help guys Smile

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] Mad...how can it exist, yet it doesnt? In reply to
You're debugging sub will print a header every time it is called. I'd change that line to:

print $IN->header() unless $IN->{'.header_printed'};

Last edited by:

Paul: Nov 17, 2002, 3:21 AM
Quote Reply
Re: [Paul] Mad...how can it exist, yet it doesnt? In reply to
Oh, thanks Smile

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!