Rest assured that the only reason I had that dirty
$one in global was because I stripped the script to the bare minimum to try and figure out what was going wrong.
The only globals the entire script has are
$dbh, $sth, $rc for database calls, and
$conf and
%conf.
$conf contains the hash from my config file and
%conf is my CGI params grabbed from
CGI->vars.
I think for now I'm going to experiment with both
cLive ;-)'s suggestion of containing my config data in a module of it's own, and I think I'll also try out setting the
$conf reference to a global.
my $main::conf;
unless ($::conf = do ('/home/4220/straitwa/www.straitway.net/shop_34/c
+on
+f.pl')) {
die ("Could not open config file");
}
I'd appreciate anybody's opinion on whether having five global variables is a bad thing. - I mean, should I really aim to have no globals or is that overkill.
I realise that my whole problem here was my misunderstanding that
my $foo declared in the main package doesn't make it the same as $main::foo
I greatly appreciate everyone's help here,
Thanks!
fireartist
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.