Re: Passing object from subroutine problem
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 27 Sep 2006 10:15:39 -0700
Tad McClellan wrote:
Paul Lalli <mritty@xxxxxxxxx> wrote:
tim wrote:
#takes an active db handle, returns a new session object.
sub newSession {
my $dbh = @_[1];
Always always always use warnings when devleoping Perl code. This
should have told you:
Scalar value @_[1] better written as $_[1]
And that accesses the 2nd argument. What about the 1st argument?
my $dbh = $_[0];
newSession is a class method, so the first argument is the name of the
class. The argument that the user passed into the method is indeed the
2nd argument within the method.
Paul Lalli
.
- References:
- Passing object from subroutine problem
- From: tim
- Re: Passing object from subroutine problem
- From: Paul Lalli
- Re: Passing object from subroutine problem
- From: Tad McClellan
- Passing object from subroutine problem
- Prev by Date: Re: How to dynamically generate function name and call it?
- Next by Date: Re: Problem with glob and filenames containing '[' and ']'
- Previous by thread: Re: Passing object from subroutine problem
- Next by thread: Re: Passing object from subroutine problem
- Index(es):