On Nov 8, Arul, Rex said:
>Import is redundant because, whenever you say, "use Defaults" it is akin
>to a directive.
Yes,
use Module;
becomes
BEGIN {
require Module;
Module->import;
}
but we weren't use()ing the file. The bigger problem is that I called the
import method from
Jeff ,
Import is redundant because, whenever you say, "use Defaults" it is akin
to a directive.
So what it does implicitly is to invoke the "import" method of the
module named "Defaults" .
So when you say, "use strict;" or "use warnings;" , implicitly the
"import" method of those modules are
On Nov 8, Peter Scott said:
>> use DBI;
>> use strict;
>> require "defs.pl";
>>
>> print "Welcome to $DOMAIN, $ADMIN\n";
>
>Global symbol $DOMAIN requires explicit package name...
Oops, that require() should have been inside a BEGIN { } block.
>> package Defaults;
>> require Exporte
At 11:06 AM 11/8/01 -0500, Jeff 'japhy' Pinyan wrote:
>On Nov 8, Tomasi, Chuck said:
>
> >I have a series of related programs that need global definitions ($DOMAIN,
> >$ADMIN, $DBNAME, etc). My code looks something like this:
>
>Global variables aren't declared with my(). It sounds like you want
On Nov 8, Tomasi, Chuck said:
>I have a series of related programs that need global definitions ($DOMAIN,
>$ADMIN, $DBNAME, etc). My code looks something like this:
Global variables aren't declared with my(). It sounds like you want to
use the Exporter module.
Your base program remains the sa
als I should have learned years ago.
Thanks.
> -Original Message-
> From: dan radom [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 9:50 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: Defining Global Variables w/use strict;
>
>
> just a thou
what you probably want is:
use vars qw|$foo @bar|;
but ONLY use that if you're REALLY sure what you're doing
globals are usually a bad idea.
hth
Jos
- Original Message -
From: "Tomasi, Chuck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 08, 2001 4:45 PM
Subject:
He want's to take then in his global variables list.. where $DOMAIN is
plexus.com and ADMIN is Chuck
Etienne
dan radom wrote:
>
> just a thought, but how can you print a variable that hasn't been defined yet?
>
> dan
>
> * Tomasi, Chuck ([EMAIL PROTECTED]) wrote:
> > System: Sun Ultra 2, Sola
> --
> #!/usr/local/bin/perl -w
>
> use strict;
> use DBI;
>
> require "defs.pl";
>
> print "Welcome to $DOMAIN, $ADMIN\n";
>
--
#!/usr/local/bin/perl -w
use strict;
use DBI;
use defs;
print "Welcome to defs::$DOMAIN, defs::$ADMIN\n";
--
just a thought, but how can you print a variable that hasn't been defined yet?
dan
* Tomasi, Chuck ([EMAIL PROTECTED]) wrote:
> System: Sun Ultra 2, Solaris 7 (11/99)
> Perl: 5.6.0
>
> I have a series of related programs that need global definitions ($DOMAIN,
> $ADMIN, $DBNAME, etc). My code l
10 matches
Mail list logo