Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
The stupid question is the question not asked
 
PerlMonks  

Re: Unexpected value in incoming variable.

by Coruscate (Sexton)
on Jan 10, 2004 at 01:39 UTC ( [id://320306]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Unexpected value in incoming variable.

Within a package, the first argument/parameter passed to a method is the package name, unless you are dealing with an object, in which case the first argument returned is the object itself. So to get your wanted results, you just need to add another variable capture:

package Alice; use strict; sub mTest2 { my ($self, $junk, $and) = @_; print "$junk=$junk\n\$and=$and"; }

Replies are listed 'Best First'.
Re: Re: Unexpected value in incoming variable.
by BUU (Prior) on Jan 10, 2004 at 01:58 UTC
    Within a package, the first argument/parameter passed to a method is the package name

    This is of course only true if you call the sub via the class syntax (either class->method or method class (how did you think new class worked?))

    If you just want a namespace and don't want to bother with package/object syntax then use double colons to delimit packages for your function call, as in Alice->method(); becomes Alice::method().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320306]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.