Re: Passing object from subroutine problem



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

.