programs/modules.
Any better way other than use vars?
myconfig:
-
$input_dir = /home/yourname/data;
$tmp_dir = /home/yourname/tmp;
# etc...
return 1;
myprogram.pl
#!/usr/bin/perl
use strict;
use warnings;
use vars qw( $input_dir $tmp_dir);
require /etc/myprogram/myconfig
On 12/15/05, Beast [EMAIL PROTECTED] wrote:
In perlmodlib :
varsPredeclare global variable names (obsolete)
If this is obselete then what is the newer version of predeclare global
variables?
Replace things like
use vars qw($FOO)
with
our $FOO;
(unless you need to assure
understand the use statements, but the
subsequent statements baffle me.
Thanks,
Siegfried
use LWP;
use PromptUtil;
use HTTP::Cookies;
use HTML::Parser;
use URI;
use vars '@ISA';
@ISA = 'LWP::UserAgent';
my $agent= __PACKAGE__-new;
On Mon, 2 May 2005, Siegfried Heintze wrote:
What the heck is going on here? I understand the use statements, but the
subsequent statements baffle me.
It looks to me like the LWP::UserAgent module is being subclassed.
The other way to do this would be to write a proper package declaration
Dan Muey wrote:
Howdy group,
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work
with pre 5.6 Perl (or whatever version our appeared in) I
have to do the use vars qw($variable); method
So I was wanting some input about pros and cons
Dan Muey wrote:
Howdy group,
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work with pre
5.6 Perl (or whatever version our appeared in) I have to do the use
vars qw($variable); method
So I was wanting some input about pros
Howdy group,
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work
with pre 5.6 Perl (or whatever version our appeared in) I
have to do the use vars qw($variable); method
So I was wanting some input about pros and cons of using
either since
Dan Muey wrote:
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work
with pre 5.6 Perl (or whatever version our appeared in) I
have to do the use vars qw($variable); method
So I was wanting some input about pros and cons of using
either since
Dan Muey wrote:
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work with pre
5.6 Perl (or whatever version our appeared in) I have to do the use
vars qw($variable); method
So I was wanting some input about pros and cons of using
Dan Muey wrote:
Rob Dixon wrote:
Dan Muey wrote:
In developing a module and I am torn.
I want to use the newer our $variable; but to make it work
with pre 5.6 Perl (or whatever version our appeared in) I
have to do the use vars qw($variable); method
So I was wanting
On Tue, Oct 28, 2003 at 10:52:16AM -0600, Dan Muey wrote:
I want to use the newer our $variable; but to make it work
with pre 5.6 Perl (or whatever version our appeared in) I
have to do the use vars qw($variable); method
So I was wanting some input about pros and cons of using
either
use vars and our do roughly the same thing. They both
let you use package variables under strict without fully-qualifying.
All these code snippets pass strict, and they each set the
package variable $foo ($A::foo, $B::foo, and $C::foo).
use strict;
{
package
Hmm ok, what would be nice is to do something like this:
(I have a function that returns true if the perl version is the same or higher than
the specified number)
package Monkey;
use strict;
if(gotperlv(5.6)) {
our $bar
our $foo;
} else {
use vars qw($bar $foo
Many of your questions lately have been wrapped around
scoping/packages/symbol tables, etc. have you had a read through:
http://perl.plover.com/FAQs/Namespaces.html
?? I found it most informative.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
our $foo;
} else {
use vars qw($bar $foo);
}
Except the ours would only apply to that black and wouldn't do too
much good if I'm understanding this right. And also would it not always
do the use vars since it gets done in the BEGIN black ?
Yep -- you're right on both counts
)) {
our $bar
our $foo;
} else {
use vars qw($bar $foo);
}
Except the ours would only apply to that black and wouldn't do too
much good if I'm understanding this right. And also would
it not always
do the use vars since it gets done in the BEGIN black ?
Yep -- you're right
On Tue, Oct 28, 2003 at 01:44:58PM -0600, Dan Muey wrote:
If you don't care about older perls (and 5.005_03 is getting
kind of mouldy) then do something like
use 5.006;
use base qw(Exporter);
And that brings up another issue:
what is the difference between:
our @ISA =
On Tue, Oct 28, 2003 at 01:44:58PM -0600, Dan Muey wrote:
If you don't care about older perls (and 5.005_03 is getting
kind of mouldy) then do something like
use 5.006;
use base qw(Exporter);
And that brings up another issue:
what is the difference between:
our
On Friday, May 10, 2002, at 07:07 , Tanton Gibbs wrote:
Yes you can say
our $opt_m;
or
use vars qw($opt_m);
at the top of your program (depending on perl version).
I've been preached the orthodoxy of the later - but
have never understood the distinction...
Yes, have read coping
Yes you can say
our $opt_m;
or
use vars qw($opt_m);
at the top of your program (depending on perl version).
I've been preached the orthodoxy of the later - but
have never understood the distinction...
Yes, have read coping with scoping.
anyone have a human language
Yes you can say
our $opt_m;
or
use vars qw($opt_m);
at the top of your program (depending on perl version).
I've been preached the orthodoxy of the later - but
have never understood the distinction...
Yes, have read coping with scoping.
anyone have a human language
on Sat, 11 May 2002 17:00:27 GMT, Jonathan e. paton wrote:
Note that 'use vars' is supposedly depreciated, so don't
use it if your script depends on 5.6 features. Placing
'our' in a lexical scope probably makes it externally
visible until you leave the scope, 'use vars' imports
into your
Note that 'use vars' is supposedly depreciated, so don't
use it if your script depends on 5.6 features. Placing
'our' in a lexical scope probably makes it externally
visible until you leave the scope, 'use vars' imports
into your symbol table. Hope this is right :)
That's not how I
on Sat, 11 May 2002 18:10:41 GMT, Jonathan e. paton wrote:
You've never seen the implementation of 'use vars' then :) The
tail end of which is:
[...]
Which I assure you has a LOT to do with importing into symbol tables.
This is the reason 'use vars' is package scoped.
Thanks
On Sat, May 11, 2002 at 08:43:13AM -0700, drieux wrote:
On Friday, May 10, 2002, at 07:07 , Tanton Gibbs wrote:
Yes you can say
our $opt_m;
or
use vars qw($opt_m);
at the top of your program (depending on perl version).
I've been preached the orthodoxy of the later
Hello, All:
I've never been very good at scoping so it it's no surprise that this
confuses me:
When declaring variables at the beginning of a script, what is the
difference between 'my' and 'use vars'?
--
Eric P.
Los Gatos, CA
--
To unsubscribe, e-mail: [EMAIL PROTECTED
On Thu, 2002-03-28 at 14:55, [EMAIL PROTECTED] wrote:
Hello, All:
I've never been very good at scoping so it it's no surprise that this
confuses me:
When declaring variables at the beginning of a script, what is the
difference between 'my' and 'use vars'?
--
Eric P.
Los Gatos
27 matches
Mail list logo