in reply to Yet another Can't locate object method question
package MyFilehandler; my $fh; sub openForRead { my $class = shift(); my $filename = shift(); bless \$filename, $class; open FH, '<', $filename or die "could not open file: $!"; $fh = \*FH; sub writeOut { my (@lines) = <$fh>; print @lines; }; } close $fh; writeOut( my $testfh = MyFilehandler->openForRead('somefile') );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Yet another Can't locate object method question
by GrandFather (Saint) on Mar 16, 2012 at 08:47 UTC | |
by nemesdani (Friar) on Mar 17, 2012 at 06:23 UTC | |
by choroba (Cardinal) on Mar 17, 2012 at 08:07 UTC | |
by nemesdani (Friar) on Mar 17, 2012 at 08:58 UTC |