[LON-CAPA-dev] Re: Printing broken in CVS HEAD?
Mon, 23 Aug 2010 14:46:40 -0400
The problem is that amongst the dependencies in printout.pl is one
which eventually includes lonmenu.pm, and a dependency on
lonwishlist.pm was recently added to lonmenu.pm.
If 'use Apache::lonwishlist.pm' is _not_ included in lonmenu.pm then
> Undefined subroutine &Apache::lonwishlist::getfoldersOption called
> at /home/httpd/lib/perl//Apache/lonmenu.pm line 1144.
wish causes the script to produce no output.
If, however, 'use Apache::lonwishlist.pm' is added to lonmenu.pm, and
it is called outside of mod_perl, i.e., in the cgi context, by
printout.pl, an ISE is generated.
> Can't locate Apache/Constants.pm in @INC at /home/httpd/lib/perl//Apache
> /lonwishlist.pm line 47.
The chain here is:
printout.pl uses loncommon.pm uses lonmenu.pm uses lonwishlist.pm
Only the last of these is a handler, which makes use of
Apache::Constants (e.g., to return OK).
This type of issues has been seen before, and is encountered whenever
perl modules are used outside of mod_perl context (e.g., run as cgi
scripts or run as scripts by cron). It is for this reason that care
has to be token with the location of subroutines. The most common
solution has been to move subroutines which are required in contexts
which do not support Apache::Constants, but are used in multiple
places, to modules which do not have handler subroutines, such as
loncommon.pm, lonnet.pm, or lonmenu.pm