Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Just tried it, like i posted, and it worked like a champ thank you so much.
Lib template
package PKG; use strict; use sharedFunctions; my $LOGFH = undef; my $writelog = undef; #constructor sub new { my ($self) = {}; bless($self); return $self; } sub import { shift; $LOGFH = ${$_[0]}; $writelog = ${$_[1]}; }

MAIN:
use sharedFunctions; #$files{log}{file} => logfile.log my $writelog = Thread::Semaphore->new(); #sequential log writing open my $LOGFH ,">", $files{log}{file}; #disable write buffer my $stdout = select($LOGFH); $| = 1; select($stdout); require PKG; PKG->import(\$LOGFH, \$writelog); my $pk = PKG->new();

sharedFunctions:
package sharedFunctions; use warnings; use strict; use File::Basename; use Cwd; use Data::Dumper; use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw($hexdec $sourcepath @dayofweek @monthnames %files); #SCALERS: our $hexdec = "[0-9a-fA-F]"; our $sourcepath = dirname(Cwd::abs_path(__FILE__)); #Where am I locate +d at? unless ($sourcepath =~ m/\\$/) { $sourcepath .= "\\"; } #ARRAYS: our @dayofweek = ("Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"); our @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "A +ug", "Sep", "Oct", "Nov", "Dec"); #HASHES: our %files = ( file1 => $sourcepath."jobstatus1.txt", #XML test status files for +recovery file2 => $sourcepath."jobstatus2.txt", #XML test status files for +recovery logfile => $sourcepath."diag.log", reports => $sourcepath."Report\\", config => $sourcepath."diagConfig.dat", station => $sourcepath."station_number.txt", hardware => $sourcepath."hardware_details.xml", update => $sourcepath."perlupdate.log", source => $sourcepath."SOURCE", temp => $sourcepath."TEMP.txt", log => { file => $sourcepath."diag.log", fileNameLen => -22.22, funNameLen => -21.21, lineNumLen => 5, timeLen => 24.24, }, license => { temp => "lic.temp", encryptLicenseInfo_utility => $sourcepath."generateLicenseKey. +exe", decryptLicenseKey_utility => $sourcepath."decryptLicenseKey.ex +e", encrypt => $sourcepath."generateLicenseKey.exe", decrypt => $sourcepath."decryptLicenseKey.exe", }, );

In reply to Re^2: many files one log file by glenn
in thread many files one log file by glenn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found