in reply to Retriving Filename from Filehandle
use IO::File; my $file; $file->{name} = '/tmp/foo'; $file->{fd} = IO::File->new( $file->{name} ) or die "$!\n"; # TODO: +more explicit error message # this lets me do stuff like $file->{fd}->print( "The name of this file is $file->{name}\n" ); $file->{fd}->close();
But that means that you have to start passing these hashrefs around, instead of raw IO::File objects, so that may mean major surgery on your code.
And now I will probably be tarred and feathered for not knowing that the IO::File or one of its ancestors has some really useful method, like name() or something.
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Retriving Filename from Filehandle
by runrig (Abbot) on Dec 18, 2001 at 22:56 UTC | |
|
Re^2: Retriving Filename from Filehandle
by freonpsandoz (Beadle) on Jan 28, 2019 at 02:02 UTC | |
by ikegami (Patriarch) on Jan 28, 2019 at 02:20 UTC |