[pm-h] mod perl and calendar.cgi

Fraser Baker flbaker at sbcglobal.net
Tue May 6 18:06:54 PDT 2014


OK:

Made all calls to CalTemplate the same. Didn't resolve the situation. Error 
message is
[Tue May 06 20:01:31 2014] [error] HTML::CalTemplate: No such file or 
directory at D:/www/wc-admin.com/cgi-bin/event_calendar/calendar.cgi line 
135.\n

Why can't the file be found?

I appreciate the problem is in the way mod_perl handles modules, but I am 
perplexed by this issue.

Thanks for your help.

Fraser

----- Original Message ----- 
From: "G. Wade Johnson" <gwadej at anomaly.org>
To: <houston at pm.org>
Sent: Tuesday, May 06, 2014 2:12 PM
Subject: Re: [pm-h] mod perl and calendar.cgi


> On Tue, 6 May 2014 12:50:40 -0500
> "Fraser Baker" <flbaker at sbcglobal.net> wrote:
>
>> Hi Wade.
>> Yes, a sub initialize exists.
>>
>>
>> ----- Original Message ----- 
>> From: "G. Wade Johnson" <gwadej at anomaly.org>
>> To: <houston at pm.org>
>> Sent: Tuesday, May 06, 2014 11:13 AM
>> Subject: Re: [pm-h] mod perl and calendar.cgi
>>
>>
>> > On Tue, 6 May 2014 10:53:55 -0500
>> > "Fraser Baker" <flbaker at sbcglobal.net> wrote:
>> >
>> >> Some progress, but still not working.
>> >>
>> >> Turns out that the problem file "calendar.cgi" was using a locally
>> >> installed liteweight version of template.pm.
>> >
>> > Okay. That would make some sense.
>> >
>> >> I renamed the file CalTemplate.pm and put it into the site/lib/HTML
>> >> folder. I changed the package name in this file to CalTemplate.pm
>> >>
>> >> The %INC shows:
>> >> For HTML/CalTemplate.pm value is
>> >> C:/Perl/site/lib/HTML/CalTemplate.pm
>> >>
>> >> The use statement in calendar.cgi is
>> >> use HTML::CalTemplate;
>> >>
>> >> The use directive finds and appears to load the file, but the same
>> >> line as before can't find initialize
>> >> [Tue May 06 10:15:30 2014] [error] Can't locate object method
>> >> "initialize" via package "HTML::CalTemplate" (perhaps you forgot to
>> >> load "HTML::CalTemplate"?) at
>> >> D:/www/wc-admin.com/cgi-bin/event_calendar/calendar.cgi line 131.\n
>> >
>> >
>> > Just to verify the obvious, is there an initialize() sub in
>> > CalTemplate.pm?
>> >
>> > G. Wade
>> >
>> >> The offending line 131 is
>> >> my $tmpl = CalTemplate->initialize( $directives->{'template'} ||
>> >> 'calendar.html' );
>
> This is a bit suspicious.
>
> Is the package name "CalTemplate" or "HTML::CalTemplate"? You are using
> one name for the 'use' statement and another for the initialize call.
>
> Just to be clear:
>
> 1. The code that loads the module (calendar.cgi) should contain:
>
> use HTML::CalTemplate;
>
> 2. The call to initialize should be:
>
> my $tmpl = HTML::CalTemplate->initialize( ... );
>
> 3. The package declaration inside C:/Perl/site/lib/HTML/CalTemplate.pm
> should be:
>
> package HTML::CalTemplate;
>
> All three of these must match (including case) or Perl won't find the
> right namespaces. This would give exactly the behavior you describe.
>
> G. Wade
>
>> >> Obviously, my understanding about mod_perl and now OOP is limited,
>> >> so any comments?
>> >>
>> >> Fraser
>> >>
>> >> ----- Original Message ----- 
>> >> From: "G. Wade Johnson" <gwadej at anomaly.org>
>> >> To: <houston at pm.org>
>> >> Sent: Monday, May 05, 2014 11:40 AM
>> >> Subject: Re: [pm-h] mod perl and calendar.cgi
>> >>
>> >>
>> >> > On Mon, 5 May 2014 09:09:11 -0500
>> >> > "Fraser Baker" <flbaker at sbcglobal.net> wrote:
>> >> >
>> >> >> Hi:
>> >> >>
>> >> >> OK, I had two copies of HTML::Template, one in Site and the
>> >> >> other came with PERL. I removed the one in Site and this made no
>> >> >> difference.
>> >> >>
>> >> >> Reading a bit, always dangerous, I find that find that the page
>> >> >> http://www.devshed.com/c/a/perl/getting-started-with-the-perl-template-toolkit/
>> >> >> talks about installing Apache::Template.
>> >> >>
>> >> >> Is this what I need to do? I really need to resolve this issue.
>> >> >> There must be someone out there that can help me resolve this.
>> >> >
>> >> > Hi Fraser,
>> >> >
>> >> > Template Toolkit is completely different from HTML::Template.
>> >> > Apache::Template works with Template Toolkit, so installing it
>> >> > would not help your issue. (Unless you wanted to rewrite
>> >> > everything you are doing in Template instead of HTML::Template.
>> >> > <jk/>)
>> >> >
>> >> > G. Wade
>> >> >
>> >> >> Fraser
>> >> >>
>> >> >> ----- Original Message ----- 
>> >> >> From: "B. Estrade" <estrabd at gmail.com>
>> >> >> To: "Houston.pm located in Houston, TX." <houston at pm.org>
>> >> >> Sent: Friday, April 25, 2014 7:51 PM
>> >> >> Subject: Re: [pm-h] mod perl and calendar.cgi
>> >> >>
>> >> >>
>> >> >> > On Fri, Apr 25, 2014 at 1:44 PM, G. Wade Johnson
>> >> >> > <gwadej at anomaly.org> wrote:
>> >> >> >> On Fri, 25 Apr 2014 12:09:59 -0500
>> >> >> >> "Fraser Baker" <flbaker at sbcglobal.net> wrote:
>> >> >> >>
>> >> >> >>> OK:
>> >> >> >>>
>> >> >> >>> For the server that is NOT running mod_perl
>> >> >> >>> INCLUDED DATA ARRAY is
>> >> >> >>> Term is C:/Perl/site/lib
>> >> >> >>> Term is C:/Perl/lib
>> >> >> >>> Term is .
>> >> >> >>>
>> >> >> >>> For the server that IS running mod_perl
>> >> >> >>>
>> >> >> >>> INCLUDED DATA ARRAY is
>> >> >> >>> Term is D:/www/wc-admin.com/cgi-bin
>> >> >> >>> Term is C:/Perl/site/lib
>> >> >> >>> Term is C:/Perl/lib
>> >> >> >>> Term is .
>> >> >> >>> Term is C:/Program Files/Apache Software
>> >> >> >>> Foundation/Apache2.2
>> >> >> >>
>> >> >> >> Okay. This gives us some stuff to work with.
>> >> >> >>
>> >> >> >> Check each of the directories in the two sets of paths for
>> >> >> >> HTML/Template.pm. This might show more than one
>> >> >> >> HTML::Template module installed.
>> >> >> >
>> >> >> > Or none at all. Make sure HTML::Template is installed.
>> >> >> >
>> >> >> >>
>> >> >> >> Next, check to see if you have the same version of
>> >> >> >> HTML::Template on both machines. I had somehow missed earlier
>> >> >> >> that these were two separate machines. (Brain fail)
>> >> >> >>
>> >> >> >
>> >> >> > /me too... oopsie
>> >> >> >
>> >> >> >> You'll want to verify that there is only one version of
>> >> >> >> HTML::Template on each server and that the versions on the
>> >> >> >> two servers match.
>> >> >> >>
>> >> >> >> If the one that works is older than the one that doesn't,
>> >> >> >> upgrading will require code changes to match the newer
>> >> >> >> module. If the one that works is the newer version, you can
>> >> >> >> upgrade the version and the problem should be solved.
>> >> >> >>
>> >> >> >> G. Wade
>> >> >> >>
>> >> >> >>
>> >> >> >>> I don't see anything here. Where to go from here?
>> >> >> >
>> >> >> > Is this mod_perl or mod_perl2? I am not familiar with any of
>> >> >> > this on Windows unfortunately.  You could create a barebones
>> >> >> > script that just tries to include HTML::Template using one
>> >> >> > directory in @INC at a time. mod_perl also does funky things
>> >> >> > with applications that are not meant to be run persistently -
>> >> >> > so if this is the case there are request "handlers" that are
>> >> >> > meant to restart or recompile/restart for each request.
>> >> >> >
>> >> >> > Unfortunately it could be a tedious process to track it down,
>> >> >> > but I think wade's put you on the right track.
>> >> >> >
>> >> >> > Brett
>> >> >> >
>> >> >> >>>
>> >> >> >>> Fraser
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> ----- Original Message -----
>> >> >> >>> From: "G. Wade Johnson" <gwadej at anomaly.org>
>> >> >> >>> To: <houston at pm.org>
>> >> >> >>> Sent: Friday, April 25, 2014 11:25 AM
>> >> >> >>> Subject: Re: [pm-h] mod perl and calendar.cgi
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> > On Fri, 25 Apr 2014 08:23:59 -0500
>> >> >> >>> > "Fraser Baker" <flbaker at sbcglobal.net> wrote:
>> >> >> >>> >
>> >> >> >>> >> Hi Brett:
>> >> >> >>> >>
>> >> >> >>> >> Turns out that for the mod_perl server, there are some
>> >> >> >>> >> 165 entries in %INC whereas for the not mod-perl server
>> >> >> >>> >> there is only one.
>> >> >> >>> >
>> >> >> >>> > Hi Fraser,
>> >> >> >>> >
>> >> >> >>> > There are 2 different things here.
>> >> >> >>> >
>> >> >> >>> > @INC contains a list of directories that perl searches for
>> >> >> >>> > modules. %INC contains entries for each module that is
>> >> >> >>> > loaded.
>> >> >> >>> >
>> >> >> >>> > I believe the suggestion was to check @INC to see if a
>> >> >> >>> > module is loaded from a location you are not expecting.
>> >> >> >>> >
>> >> >> >>> > G. Wade
>> >> >> >>> >
>> >> >> >>> >> The %ENV is larger by about 5 entries on the mod_perl
>> >> >> >>> >> machine.
>> >> >> >>> >>
>> >> >> >>> >> OK, where do I go from here.
>> >> >> >>> >>
>> >> >> >>> >> Fraser
>> >> >> >>> >>
>> >> >> >>> >> ----- Original Message -----
>> >> >> >>> >> From: "B. Estrade" <estrabd at gmail.com>
>> >> >> >>> >> To: "Houston.pm located in Houston, TX." <houston at pm.org>
>> >> >> >>> >> Sent: Tuesday, April 22, 2014 10:15 AM
>> >> >> >>> >> Subject: Re: [pm-h] mod perl and calendar.cgi
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >> > Just a hunch, but I'd look to see how mod_perl affected
>> >> >> >>> >> > your environment. namely @INC.
>> >> >> >>> >> >
>> >> >> >>> >> > Brett
>> >> >> >>> >> >
>> >> >> >>> >> > On Tue, Apr 22, 2014 at 9:47 AM, Fraser Baker
>> >> >> >>> >> > <flbaker at sbcglobal.net> wrote:
>> >> >> >>> >> >> Hi y'all:
>> >> >> >>> >> >>
>> >> >> >>> >> >> Before I added mod-perl, calendar.cgi worked.
>> >> >> >>> >> >>
>> >> >> >>> >> >> After mod perl I get this error:
>> >> >> >>> >> >>
>> >> >> >>> >> >> [Tue Apr 22 09:28:35 2014] [error] Can't locate object
>> >> >> >>> >> >> method "initialize"
>> >> >> >>> >> >> via package "HTML::Template" at
>> >> >> >>> >> >> D:/www/wc-admin.com/cgi-bin/event_calendar/calendar.cgi
>> >> >> >>> >> >> line 131.\n
>> >> >> >>> >> >>
>> >> >> >>> >> >> The offending line in calendar.cgi is:
>> >> >> >>> >> >>
>> >> >> >>> >> >> my
>> >> >> >>> >> >>
>> >> >> >>> >> >> $tmpl =
>> >> >> >>> >> >> HTML::Template->initialize( $directives->{'template'}
>> >> >> >>> >> >> || 'template.html' );
>> >> >> >>> >> >>
>> >> >> >>> >> >> I searched template.pm and don't find a function named
>> >> >> >>> >> >> initialize. I do find
>> >> >> >>> >> >>
>> >> >> >>> >> >> # initialize the template buffer
>> >> >> >>> >> >> sub _init_template {
>> >> >> >>> >> >>
>> >> >> >>> >> >> How do I fix this?
>> >> >> >>> >> >>
>> >> >> >>> >> >> Fraser
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> If debugging is the process of removing software bugs, the
>> >> >> >> programming must be the process of putting them in.
>> >> >> >> -- Edsger Dijkstra
>> >> >> >> _______________________________________________ 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/
>> >> >
>> >> >
>> >> > -- 
>> >> > Fortune knocks but once, but misfortune has much more patience.
>> >> >                                                -- Laurence J.
>> >> > Peter _______________________________________________
>> >> > 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/
>> >
>> >
>> > -- 
>> > Sufficiently encapsulated magic is technology.   -- Michael Schwern
>> > _______________________________________________
>> > 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/
>
>
> -- 
> The computer should be doing the hard work. That's what it's paid to do,
> after all.                                            -- Larry Wall
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/ 



More information about the Houston mailing list