in reply to Re: Real Basic Perl OOP Question
in thread Real Basic Perl OOP Question
That is not correct - bless alters its first argument in-place:
use Data::Dumper; my ( $ref1, $ref2 ) = ( {}, {} ); my $ref3 = bless $ref1, 'Foo'; # capturing results bless $ref2, 'Foo'; # in void context print Dumper $ref3; print Dumper $ref2; __END__ # results identical: $VAR1 = bless( {}, 'Foo' ); $VAR1 = bless( {}, 'Foo' );
bless returns the reference as a convenience, however it certainly operates on the reference. (It doesn't alter that which is referenced {the "referent"?}... but he's not doing that, and that isn't what you are demonstrating either.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Real Basic Perl OOP Question
by o2bwise (Scribe) on Jun 21, 2005 at 23:45 UTC | |
|
Re^3: Real Basic Perl OOP Question
by o2bwise (Scribe) on Jun 21, 2005 at 23:48 UTC |