Re: Scope of variables. Lost in subs

2002-04-09 Thread drieux
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

RE: Scope of variables. Lost in subs

2002-04-09 Thread Jeff 'japhy' Pinyan
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

RE: Scope of variables. Lost in subs

2002-04-09 Thread Gary Hawkins
> -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.

RE: Scope of variables. Lost in subs

2002-04-09 Thread Jeff 'japhy' Pinyan
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 thei

RE: Scope of variables. Lost in subs

2002-04-09 Thread Jenda Krynicky
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

RE: Scope of variables. Lost in subs

2002-04-09 Thread Gary Hawkins
> > 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

RE: Scope of variables. Lost in subs

2002-04-09 Thread Jenda Krynicky
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 un

RE: Scope of variables. Lost in subs

2002-04-09 Thread Gary Hawkins
> > > 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 y

Re: Scope of variables. Lost in subs

2002-04-08 Thread Tor Hildrum
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]

RE: Scope of variables. Lost in subs

2002-04-08 Thread Jenda Krynicky
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 sin

RE: Scope of variables. Lost in subs

2002-04-08 Thread Jonathan E. Paton
--- 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. Whic

RE: Scope of variables. Lost in subs

2002-04-08 Thread 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 su

RE: Scope of variables. Lost in subs

2002-04-08 Thread Timothy Johnson
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: "Timot

RE: Scope of variables. Lost in subs

2002-04-08 Thread Jenda Krynicky
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"" mea

RE: Scope of variables. Lost in subs

2002-04-08 Thread Jonathan E. Paton
> > 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 abo

RE: Scope of variables. Lost in subs

2002-04-08 Thread Jenda Krynicky
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 decl

Re: Scope of variables. Lost in subs

2002-04-08 Thread drieux
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 cha

RE: Scope of variables. Lost in subs

2002-04-08 Thread Timothy Johnson
6:07 AM Subject: Re: Scope of variables. Lost in subs 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

Re: Scope of variables. Lost in subs

2002-04-08 Thread zentara
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 concatena

Re: Scope of variables. Lost in subs

2002-04-08 Thread Tor Hildrum
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 so

Scope of variables. Lost in subs

2002-04-07 Thread Tor Hildrum
I have the following script: ..my $variable = ""; # Global variable, right? if (true/false) { sub3(); } elsif (true/false) { sub2(); } else { sub1(); } ## The point with this, is that sub1 is always called first, then sub2, then ## sub3. This works perfectly. sub sub1{ } sub sub2{ $vari