SavannahLion has asked for the wisdom of the Perl Monks concerning the following question:
I boiled it down to an example in these two modules (they don't reflect the actual code). For sake of argument, they're just entitled module1 and module2:
the other module contains:use strict; use lib ('./'); require 'module2.pl'; Alice->mTest2 ("Some stuff", "and something else"); 1;
use strict; package Alice; sub mTest2 { my ($junk, $and) = @_; print "$junk=$junk\n\$and=$and"; }
Some stuff
and something else.
Instead I get:
Alice
Some stuff
Ok, after doing some searching and a bit of experimentation, I can see where a person would want to know the context the function is called. I fried my brain and all I can come up with is a shift on the @_ to look for the object name. If it matches, then proceed to get the rest of the array. If it doesn't match, then assume it's a variable I want to keep and proceed accordingly. But this seems really sloppy when all I really care about is the variables I want to deal with, not the package name.
I guess what I'm asking is, can someone clarify if this is some sort of error on my part, or is this perfect behavior (which I assume it is)? I tried to flip through the Camel to see if this is mentioned, but I can't find it :(
Gah! I need coffee...
----
Thanks for your patience.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unexpected value in incoming variable.
by Coruscate (Sexton) on Jan 10, 2004 at 06:39 UTC | |
by BUU (Prior) on Jan 10, 2004 at 06:58 UTC | |
|
Re: Unexpected value in incoming variable.
by Anonymous Monk on Jan 10, 2004 at 12:03 UTC |