in reply to Need help with OO perl

($self->{lib}) = ($lib->print_name()); just put undef into $self->{lib} and undef->print_name can not work later. maybe you should replace
($self->{lib}) = ($lib->print_name());
$self->{lib} = $lib;

Replies are listed 'Best First'.
Re^2: Need help with OO perl
by almut (Canon) on Dec 27, 2008 at 02:37 UTC

    Actually, it's the return value of print "From test1","\n"; that's being returned by print_name() (i.e. 1, not undef) — but otherwise your observation is of course correct...