An integration problem. I have code for filling in forms and mailing them. I wrote a TK GUI to allow viewing the files before the merge and such. Now I wrapped the mailing code into a package and 'use' it. But I want both the TK GUI and the Mail Merge to use one log file, that I open in the TK mainline code.
?? How do I pass/assign an already open file handle into my package variable so the package can log into my existing log file?
A minimized test program...
package test_a;
# optionaly; to be set/over-ridden from user code....
$AuxDataFile= "AuxData";
$TmpltFile= "LinuxScript-Text.txt";
$DataCSV = "LinuxScript-TEST-Data.csv";
$AttachmentFile;
*LogFile;
#################### Subs ###########################
sub SetLog ( $ ){
*LogFile = @_; #Adv Perl Programming (Rel 1) pg 49
}
sub TestLog {
printf LogFile "a::TestLog print\n";
}
1;
Now the mainline calling code:
use test_a;
open LOGF, ">log.txt";
$|=1;
#*test_a::LogFile =*LOGF ;
test_a::SetLog (*LOGF) ;
printf LOGF "Run started\n";
test_a::TestLog();
printf LOGF "Run ended\n";
The printf line from the test_a package never gets into the log file????
What am I missing?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.