[pm-h] Another mod_perl issue I can't resolve

Mark Allen mrallen1 at yahoo.com
Thu Feb 13 11:40:24 PST 2014


https://metacpan.org/pod/HTML::Template#new


There are a *ton* of options new() takes so it's impossible to say what the right thing to use would be in your particular deployment.  

But at a minimum, you must supply something like:

HTML::Template->new( filename => $directives->{'template'} || 'template.html') 

Although if you're using Perl 5.14 or later, you may want to consider using the "defined-or" operator which is usually safer in this scenario.

http://perldoc.perl.org/perlop.html#Logical-Defined-Or


Mark



On Thursday, February 13, 2014 1:29 PM, Fraser Baker <flbaker at sbcglobal.net> wrote:
 
OK:
 
I changed line 133 to be 
my$tmpl= HTML::Template->new( $directives->{'template'} || 'template.html');

and got the Apache error
 [error] 
HTML::Template-]new() called with odd number of option parameters - should be of 
the form option =] value at 
D:/www/wc-admin.com/cgi-bin/event_calendar/calendar.cgi line 133.\n 

Fraser
----- Original Message ----- 
>From: John Ellyson 
>To: Houston.pm located in Houston, TX. 
>Sent: Thursday, February 13, 2014 12:42  PM
>Subject: Re: [pm-h] Another mod_perl  issue I can't resolve
>
>
>I haven't used HTML::Template before, but I was just checking the  docs for it on CPAN.  (http://search.cpan.org/~wonko/HTML-Template-2.95/lib/HTML/Template.pm) 
>
>
>Just like the error message states, I too can't find an "initialize"  method in the docs for that module.  There is a "new" method, which  creates a new HTML::Template object.  Perhaps that's what you need to use  instead of "initialize"?
>
>
>Also, Wade has a good point about the capitalization in the module name.   For a lot of things in Windows, the OS is case-insensitive.   However, the Perl interpreter is not case-insensitive.  That's  something that has bitten me on numerous occasions.
>
>
>John Ellyson
>
>
>
>On Thu, Feb 13, 2014 at 10:35 AM, Fraser Baker <flbaker at sbcglobal.net> wrote:
>
> 
>>Hi:
>> 
>>My call to calendar.cgi works  without mod_perl, but fails when mod_perl is running.
>> 
>>Apache error message
>>Can't locate object method "initialize" via package  "HTML::Template" at D:/www/wc-admin.com/cgi-bin/event_calendar/calendar.cgi line  133.\n 
>> 
>>calendar.cgi lines
>>use HTML::template;
>>Line 133 is: my $tmpl = HTML::Template->initialize(  $directives->{'template'} || 'template.html' );
>>
>>I can't figure this out. Anyone have any  ideas?
>> 
>>Fraser
>>_______________________________________________
>>Houston 
    mailing list
>>Houston at pm.org
>>http://mail.pm.org/mailman/listinfo/houston
>>Website: http://houston.pm.org/
>>
>
>________________________________
> _______________________________________________
>Houston mailing 
  list
>Houston at pm.org
>http://mail.pm.org/mailman/listinfo/houston
>Website: 
  http://houston.pm.org/

_______________________________________________
Houston mailing list
Houston at pm.org
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/mailman/private/houston/attachments/20140213/3e3d6535/attachment.html>


More information about the Houston mailing list