-- Charles K. Clarkson [EMAIL PROTECTED] wrote:
John Ackley wrote:
: while( ($service) = $SERVICE-fetchrow_array ) {
According to the DBI docs:
If there are no more rows or if an error occurs,
then fetchrow_array returns an empty list.
When a value is returned,
On Mon, Oct 02, 2006 at 07:15:38AM -0700, Derek B. Smith wrote:
For a complete understanding of scope (not listerine)
: )
please read the following:
http://perl.plover.com/local.html#2_Localized_Filehandles
and
http://www.perlmonks.org/?node_id=564448
Wow...opened my eyes and I now
John Ackley wrote:
: while( ($service) = $SERVICE-fetchrow_array ) {
According to the DBI docs:
If there are no more rows or if an error occurs,
then fetchrow_array returns an empty list.
When a value is returned, $service is set to that value.
When we get to the end of the
I think the '$dbaccess' in your test.pm should be declared as perl's global var
as 'our $dbaccess;' or 'use vars qw($dbaccess);'. Then in your test2.pm,you
can access it as:
use vars qw($dbaccess);
print $test::dbaccess;
or:
use vars qw($dbaccess);
*dbaccess = \$test::dbaccess;
print
[EMAIL PROTECTED] wrote:
...
My question is how to access $dbaccess variable (object) defined and
initialized in test.pm within test2.pm module?
If $dbaccess is delared with 'my' in test.pm, you cannot directly access
it from another file. You have two basic options:
1. Provide an accessor
tmatsumoto am Samstag, 13. August 2005 19.06:
Hi,
Thanks for the help. I've made the necessary changes. One error came up
at runtime on the use warnings;. I gather the module is not installed
on the server I'm using.
Strange; the pragma module warnings.pm is AFAIK part of the core perl
tmatsumoto am Samstag, 13. August 2005 11.13:
Hi Beginners,
Hello,
I a new Perl programmer dealing with issues of scope. I'm trying to
write a simple library using strict. The script that runs the library
is also strict. I can get the two to work without using strict, but I
understand that
Hi,
Thanks for the help. I've made the necessary changes. One error came up
at runtime on the use warnings;. I gather the module is not installed
on the server I'm using. I've gone through and made changes to the
script calling the package. I understand the syntax however the nothing
is
-Original Message-
From: West, William M [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 23, 2003 9:21 AM
To: [EMAIL PROTECTED]
Subject: scope of variable carrying 'for ($n1..$n2){}'
for (1..19){
for (1..19){
print $_
}}
prints out the numbers 1 to 19 nineteen
On Jul 18, Nikola Janceski said:
I was wondering what the scope of perlvars (ie. $! and $?) are across
modules?
Those variables are true globals. They are seen everwhere.
In module:
open file || return -1;
In script:
Can I use $! here? and will it contain the reason open didn't open (if it
On Wednesday, April 10, 2002, at 04:42 , Elaine -HFB- Ashton wrote:
I always found the local, my, our mess pretty confusing and the best
explanation is MJD's Coping with Scoping
http://perl.plover.com/FAQs/Namespaces.html
Make good note of the text in red :)
ok, I get the following error
At 12:47 PM 4/17/2002 -0700, you wrote:
On Wednesday, April 10, 2002, at 04:42 , Elaine -HFB- Ashton wrote:
^
is this supposed to be funny?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
From: Ahmed Moustafa [EMAIL PROTECTED]
Elaine -Hfb- Ashton wrote:
I always found the local, my, our mess pretty confusing and the best
explanation is MJD's Coping with Scoping
http://perl.plover.com/FAQs/Namespaces.html
Make good note of the text in red :)
Elaine, thanks a lot
Elaine -Hfb- Ashton wrote:
I always found the local, my, our mess pretty confusing and the best
explanation is MJD's Coping with Scoping
http://perl.plover.com/FAQs/Namespaces.html
Make good note of the text in red :)
Elaine, thanks a lot for MJD's article. There is a great difference
Here's the part I still don't understand, and maybe some of
you can show me the light. What is the difference between
local() and my()? I have never used local(), the only
examples I've ever been given involve scoping $_, and if I am
ever tempted to do that, I can usually trace it back
Timothy Johnson [[EMAIL PROTECTED]] quoth:
*
*Here's the part I still don't understand, and maybe some of you can show me
*the light. What is the difference between local() and my()? I have never
*used local(), the only examples I've ever been given involve scoping $_, and
*if I am ever tempted
If you declare a variable with my() its scope will be from the
declaration to the end of the enclosing block. Which for variables
declared outside any {} block or eval means ... to the end of the
file.
Wrong.
You forgot about 'package'.
What do you mean:
#!perl -w
From: Gary Hawkins [EMAIL PROTECTED]
#!perl -w
my $x = 'Ahoj';
print $x\n;
package foo;
print $x\n;
__END__
I believe packages are completely irrelevant to lexical (declared
with my()) variables.
I was following it up until this, but may have missed
How many things can packages be? Is this foo a file?
No this foo doesn't have to be a file. You can have several
packages in one file and switch between them.
I don't know how to explain what ARE packages though.
Try if
perldoc perlmod
makes sense to you.
After reading perldoc
From: Gary Hawkins [EMAIL PROTECTED]
How many things can packages be? Is this foo a file?
No this foo doesn't have to be a file. You can have several
packages in one file and switch between them.
I don't know how to explain what ARE packages though.
Try if
perldoc perlmod
On Apr 9, Gary Hawkins said:
I was thinking there might be an instance where 'package bar' is
essential, or the best way to go.
Perhaps you're missing the point. The package directive allows you to
change namespaces. Your Perl program operates in package 'main'. Most
modules operate in their
-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 11:58 AM
To: Gary Hawkins
Cc: [EMAIL PROTECTED]
Subject: RE: Scope of variables. Lost in subs
Perhaps you're missing the point.
Gee, maybe that was the reason for the question
On Apr 9, Gary Hawkins said:
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Perhaps you're missing the point.
Gee, maybe that was the reason for the question. Ya think? Why do you
hammer people for asking questions, that's what this place is for.
I wasn't. I was saying that the
On Tuesday, April 9, 2002, at 11:13 , Jenda Krynicky wrote:
[..]
So if a module defines several classes it has to contain several
packages.
Jenda
yes I think I would modify that slightly
it is simpler to deliver one long file as a singular 'package'
that carries with it
On 8/4/02 9:15, Tor Hildrum [EMAIL PROTECTED] wrote:
Here are some of the error messages I get:
Use of uninitialized value in concatenation (.) at script.cgi line 55.
Use of uninitialized value in concatenation (.) at script.cgi line 55.
Can't open : No such file or directory
Full source
On Mon, 08 Apr 2002 11:00:54 +0200, [EMAIL PROTECTED] (Tor Hildrum) wrote:
On 8/4/02 9:15, Tor Hildrum [EMAIL PROTECTED] wrote:
Here are some of the error messages I get:
Use of uninitialized value in concatenation (.) at script.cgi line 55.
Use of uninitialized value in concatenation (.) at
$var
PrintSub(\$var); #@_ now contains (\$var)
print \$var is now $var.\n;
sub PrintSub{
my $subvar = ${$_[0]); #dereference the reference you passed.
print \$subvar is now $subvar.\n;
}
-Original Message-
From: zentara
To: [EMAIL PROTECTED]
Sent: 4/8/02 6:07 AM
Subject: Re: Scope
On Monday, April 8, 2002, at 07:28 , Timothy Johnson wrote:
[..]
If you just pass the value,
then any operations performed on your variable in the subroutine will be
destroyed when the sub exits. This way you will be performing all
operations on the original variable, allowing you to change
From: Timothy Johnson [EMAIL PROTECTED]
Another thing to remember is that declaring a variable with my() at
the top of your script does NOT make the variable global.
Right.
It loses
scope in subroutines.
Wrong.
If you declare a variable with my() its scope will be from the
declaration
It loses
scope in subroutines.
Wrong.
If you declare a variable with my() its scope will be from the
declaration to the end of the enclosing block. Which for variables
declared outside any {} block or eval means ... to the end of the
file.
Wrong.
You forgot about 'package'.
From: Jonathan E. Paton [EMAIL PROTECTED]
It loses
scope in subroutines.
Wrong.
If you declare a variable with my() its scope will be from the
declaration to the end of the enclosing block. Which for variables
declared outside any {} block or eval means ... to the end of
Oops. My bad. I wonder how much extra work that one's cost me...
-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 8:49 AM
To: Timothy Johnson
Cc: [EMAIL PROTECTED]
Subject: RE: Scope of variables. Lost in subs
From: Timothy Johnson
Yep. I guess I'm still a little groggy. I think this whole Spring
Forward thing is a bit of a misnomer.
-Original Message-
From: drieux [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 8:07 AM
To: [EMAIL PROTECTED]
Subject: Re: Scope of variables. Lost in subs
On Monday
--- Jenda Krynicky [EMAIL PROTECTED] wrote: From: Jonathan E. Paton
[EMAIL PROTECTED]
It loses
scope in subroutines.
Wrong.
If you declare a variable with my() its scope will be from the
declaration to the end of the enclosing block. Which for variables
declared
From: Jonathan E. Paton [EMAIL PROTECTED]
Jonathan... nul point - my Eurovision song contest
attempt would be less than that though. Yes, Jenda is
right, and I'm wrong (again). Oh well, I do remember
reading that.
A it feels so god to be right ;-)
And well ... I used to sing when
Thanks to everyone who replied.
I got enough information to solve the problem, and then some more :)
Tor
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
let's see if i can shed some light on this.
your statement:
print(Defined: $z\n) if defined(my $z=x);
this will be evaluated like this if i'm not mistaken:
( print(Defined: $z\n) ) defined(my $z=x);
or a simplistic version:
(print $z) (my $z = 'bar');
try and 'use strict' and you'll see
-Original Message-
From: Ivan Adzhubei [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 10, 2001 7:24 AM
To: [EMAIL PROTECTED]
Subject: Scope, priority or bug?
Hi!
Isn't this weird?
#!/usr/bin/perl -w
print(Defined: $z\n) if defined(my $z=x);
print Assigned: $z\n;
Hello Jos,
Jos I. Boumans wrote:
let's see if i can shed some light on this.
your statement:
print(Defined: $z\n) if defined(my $z=x);
this will be evaluated like this if i'm not mistaken:
( print(Defined: $z\n) ) defined(my $z=x);
or a simplistic version:
(print $z) (my $z
If I define a function just in the freespace of a file and have
included in
that file two packages which are bracketed in like:
sub function {}
package 1;
{}
package 2;
{}
How do I access the function (make a function call) from within one of
the
packages?
is it main::function or
40 matches
Mail list logo