CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [FishMonger] Dynamic Logging of any File used in Script: Edit Log



tm4c
New User

Jan 24, 2009, 9:03 AM


Views: 2094
Re: [FishMonger] Dynamic Logging of any File used in Script

If a script opens several different files:


Code
open( $FH_1, '>', $file_name_1 ); 
open( $FH_2, '>', $file_name_2 );
open( $FH_3, '>', $file_name_3 );


What would be the easiest way for me to know the name of the files opened by the script?

If the script used only one filehandle, $FH, then I could simply watch this variable for any changes, and update the log accordingly. In the real world, however, there is no guarantee some one will use only a single filehandle variable.

The main point is that I want this script to "plug" into any existing Perl script without needing to modify either script too much; therefore, I'm essential ignorant of the actual name of the variables used. I would have to realize on a either a global variable, or generic data type that all filehandles fall under.

Perl Hierarchy:

Code
IO\ 
\
<Generic Filehandle> <--Does this exist?
|
|
|
/|\

$FH_1 $FH_2 $FH_3



(This post was edited by tm4c on Jan 24, 2009, 9:08 AM)


Edit Log:
Post edited by tm4c (New User) on Jan 24, 2009, 9:05 AM
Post edited by tm4c (New User) on Jan 24, 2009, 9:07 AM
Post edited by tm4c (New User) on Jan 24, 2009, 9:08 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives