Hello,
I'm converting some perl code that contained imbedded web page creation
code. I'm using a template and writing the file to disk because I need to
reference it in an email sent afterwards.
I'm on a system with mod_perl, which I understand from previous posts has
'issues'. (is there a mod_perl/H:T how-to anywhere?).
Now the thing is, my code WORKS FINE. It creates the page, I can email it,
click on the link in the email and get to it, etc. It's just bugs me that
when I run the program, I get:
Use of uninitialized value in print at make_renewals.pl line 263, <>
line 1.
Line 263 in my script is:
print $spage->output(print_to => *WEBFILE);
Obviously its talking about the WEBFILE var, right? But if its
uninitialized then how come my page is created and all the tmpl_var's are
substituted just fine? The whole part of the page creation from start to
finish goes like this (unimportant stuff snipped):
...
open(WEBFILE, "> $diskpage") or ...;
my $spage = GuestLib::initTemplate($Prog{'renewal_template'});
my @loop_data = ();
my @S_Guests = split ',', $guestlist;
foreach $g_alias ( sort @S_Guests )
{
my %Gst = GuestLib::doQuery("alias=$g_alias");
my %rowdata = ();
$rowdata{'g_alias'} = $g_alias;
$rowdata{'g_idnumber'} = $Gst{'guest_id'};
$rowdata{'g_lfname'} = $Gst{'last_first_name'};
$rowdata{'g_title'} = $Gst{'title'};
push @loop_data, \%rowdata;
}
$spage->param('s_alias' => $s_alias,
's_name' => $s_name,
'g_count' => scalar(@S_Guests),
'guestlist' => [EMAIL PROTECTED] );
print $spage->output(print_to => *WEBFILE);
close WEBFILE;
...
If you're wondering about my initTemplate() call, its just my own wrapper
function with some extra logging and stuff in it. But if your curious about
init settings, it looks like this:
sub initTemplate
{
my $tname = shift;
FatalError('TMPLINIT', $tname) unless $tname;
my $t = HTML::Template->new('filename' => $tname, 'case_sensitive' => 1,
'die_on_bad_params' => 0, 'cache' => 1,
'loop_context_vars' => 1, 'globalvars' =>
1 );
FatalError('TMPLINIT', $tname) unless defined $t;
Log("...");
if ( $Prog{'debug'} ) { ... }
return $t;
}
I've tried a few different things, but nothing worked. I looked at the
archives regarding print_to and/or mod_perl but didn't find much that was
relevant or that worked. The "tie WEBFILE, 'Apache'" thing gave me a
TIEHANDLE error, and other things I tried generated even more errors rather
than fix things.
If anyone has an idea of where I'm going wrong, please clue me in. Thanks.
Robert
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users