arunhorne has asked for the wisdom of the Perl Monks concerning the following question:
I am subclassing the Graph::Writer module to provide output for a new graph format and must work within the confines of the following function.
sub _write_graph { my $self = shift; my $graph = shift; my $FILE = shift; #while (<$FILE>) #{ #} return 1; }
The function receives a file handle (IO::File=GLOB(0x8333a68)) to a single file ($FILE). However, I need to create two output files for this graph format and thus I need to get the filename from the $FILE file handle and use this as the base name from which I can generate two new filenames and open these for output (and close $FILE). I know this is a bit of a kludge, but I'm within the confines of original function that is being overriden. How can I do this, or has anyone got a better idea how I could do it without changing the parameters accepted by the function?
Note that I need concurrent access to the two new files rather than sequential so will need two open file handles at once.
Thanks, Arun
____________
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting filename from IO::File object
by Jaap (Curate) on Jan 30, 2003 at 12:22 UTC | |
|
•Re: Getting filename from IO::File object
by merlyn (Sage) on Jan 30, 2003 at 15:45 UTC | |
|
Re: Getting filename from IO::File object
by derby (Abbot) on Jan 30, 2003 at 13:45 UTC |