Re: Perl equivalent of PHP globals?

2008-10-25 Thread Chas. Owens
On Fri, Oct 24, 2008 at 22:12, Kelly Jones <[EMAIL PROTECTED]> wrote: > How can I see all the local, global, etc Perl variables defined at a > given point in my program? snip Take a look at PadWalker*. * http://search.cpan.org/dist/PadWalker/PadWalker.pm -- Chas. Owens wonkden.net The most imp

Re: Perl equivalent of PHP globals?

2008-10-24 Thread Jeff Pang
2008/10/25 Kelly Jones <[EMAIL PROTECTED]>: > How can I see all the local, global, etc Perl variables defined at a > given point in my program? > see this: http://perl.plover.com/FAQs/Namespaces.html -- Jeff Pang http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addi

Perl equivalent of PHP globals?

2008-10-24 Thread Kelly Jones
How can I see all the local, global, etc Perl variables defined at a given point in my program? -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that resistance to new ideas and technology is unwise and ultimately futile. --

Re: globals and modules

2006-02-20 Thread The Ghost
But that's seems like a lot of extra typing: Then in any part of your code where you use the database handle you can say sub foo { my ($foo, $bar) = @_; my $dbh = Project::DB::Handle->new; my $sth = $dbh->prepare(...); I started out with an HTML::Mason where I've shared $dbh via

Re: globals and modules

2006-02-20 Thread Chas Owens
On 2/20/06, The Ghost <[EMAIL PROTECTED]> wrote: > I have defined $dbh (a database handle) as a global variable. I have > a module, RD, that needs access to the database. How can I use $dbh > within the RD module? > The best way to handle this is to create a singleton object to hold the database

Re: globals and modules

2006-02-20 Thread Tom Phoenix
On 2/20/06, The Ghost <[EMAIL PROTECTED]> wrote: > I have defined $dbh (a database handle) as a global variable. I have > a module, RD, that needs access to the database. How can I use $dbh > within the RD module? Every global variable is in some package, in perl. If you haven't used a package

globals and modules

2006-02-20 Thread The Ghost
I have defined $dbh (a database handle) as a global variable. I have a module, RD, that needs access to the database. How can I use $dbh within the RD module? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: The Difference Between my Globals and our Globals (WAS: Parameterizing a module)

2005-12-08 Thread vmalik
quot;our"? > > Below are three files, main, foo.pm, and bar.pm. These show the way 'my' > and 'our' behave. > > A 'my' global variable is scoped only to the file it is in. It hides any > 'our' variable (of the same name); you can

Re: The Difference Between my Globals and our Globals (WAS: Parameterizing a module)

2005-12-08 Thread Shawn Corey
ot;? Below are three files, main, foo.pm, and bar.pm. These show the way 'my' and 'our' behave. A 'my' global variable is scoped only to the file it is in. It hides any 'our' variable (of the same name); you can only access the 'my' variabl

RE: globals

2004-08-17 Thread Charles K. Clarkson
oads are disabled' ) if $CGI::DISABLE_UPLOADS; HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 [1] In the archives there is a message indicating that perl does not have true globals. I'm not certain the difference, but for this discussion I use "global

Re: globals

2004-08-17 Thread David Greenberg
If you really want to use a BAD method, which you should NOT use: while (...) { $total = $row[0]; ... } print $total . "\n"; What you SHOULD do is: use strict; ... my $total = ""; while (...) { $total = $row[0]; ... } print $total . "\n"; -David On Tue, 17 Aug 2004 10:55:25

Re: globals

2004-08-17 Thread Wiggins d Anconia
> After searching through the Perl Bookshelf CD, I have found that you can > declare a global and then use local() to change that value for a block > of code. I haven't found how to use a value from within a block of code > outside that block of code though. Is this possible? I'm sure I just > don'

globals

2004-08-17 Thread Fontenot, Paul
After searching through the Perl Bookshelf CD, I have found that you can declare a global and then use local() to change that value for a block of code. I haven't found how to use a value from within a block of code outside that block of code though. Is this possible? I'm sure I just don't know wha

Re: globals at dbi

2004-06-14 Thread Wiggins d Anconia
Test Undefined subroutine &Adabas::logon called at ./test.pl line 16. Which appears to be fine. > Is it not longer possible to set variables easly as globals? First I tryed > this with $my_user or $test_var... without "::", and the result was the same. This is being caused by

globals at dbi

2004-06-14 Thread Christian Stalp
omethink like that: Global symbol "$chris_test_var" requires explicit package name at ./komm-test2.pl line 9. Execution of ./komm-test2.pl aborted due to compilation errors. Is it not longer possible to set variables easly as globals? First I tryed this with $my_user or $test_var...

Re: help with globals and if

2002-07-07 Thread David T-G
Bob, et al -- ...and then bob ackerman said... % % On Sunday, July 7, 2002, at 05:47 AM, David T-G wrote: % ... % > # $_[0] =~ /tcsh/ && $setenv = "setenv" ; % > # $_[0] =~ /tcsh/ && { $setenv = "setenv" ; } ; % > # $_[0] =~ /tcsh/ && { $setenv = 'setenv' ; } ; % > # if $_[0] =~ /tcsh/

Re: help with globals and if

2002-07-07 Thread bob ackerman
On Sunday, July 7, 2002, at 05:47 AM, David T-G wrote: > Hi, all -- > > It must still be early, because I just don't get this. > > Given the snippet > > sub setpath(my $shelltype) > { > my ($setenv,$equals) ; > # $_[0] =~ /tcsh/ && $setenv = "setenv" ; > # $_[0] =~ /tcsh/ && { $se

help with globals and if

2002-07-07 Thread David T-G
Hi, all -- It must still be early, because I just don't get this. Given the snippet sub setpath(my $shelltype) { my ($setenv,$equals) ; # $_[0] =~ /tcsh/ && $setenv = "setenv" ; # $_[0] =~ /tcsh/ && { $setenv = "setenv" ; } ; # $_[0] =~ /tcsh/ && { $setenv = 'setenv' ; } ; #

RE: Globals in Subroutines (OOPS)

2001-11-29 Thread Matthew Walkup
Apologies: I figured it out, some bad code outside the subroutine, Thanks, Matt -Original Message- From: Matthew Walkup [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 10:44 AM To: [EMAIL PROTECTED] Subject: RE: Globals in Subroutines (OOPS) Some old code that i was

RE: Globals in Subroutines (OOPS)

2001-11-29 Thread Matthew Walkup
} } Sorry, and thanks, Matt -Original Message- From: Matthew Walkup [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 10:39 AM To: [EMAIL PROTECTED] Subject: Globals in Subroutines my (@inputs, @last, $output); sub prepareandread_inputs { my $temporary; p

Globals in Subroutines

2001-11-29 Thread Matthew Walkup
adnow}; } chomp($input->{last_line}) if $input->{readnow}; ($input->{last_date}, $input->{last_hour}, $input->{last_min}, $input->{last_sec}) = &get_date_time($input->{last_li ne}) if $input->{readnow}; $input->