You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Huilli Liu <HL...@ap.org> on 2004/06/16 23:06:31 UTC

IO::File problem on Mod_perl

Hi All,
 
Recently I are migrating cgi to mod_perl but it is running out of the
problem for IO::File.
Here are my original codes:
 
 my $template_file = new IO::File("templates/quickquote.templ");
 $template_file->input_record_separator(undef);
 my $template = <$template_file>;
 $template_file->close;
 
"templates/quickquote.templ" is under "DocumentRoot" directory but it
looks like it can not find the file.
 
The error I got is as below:
 
[Wed Jun 16 16:52:46 2004] [error] [client 10.5.20.105] Can't call
method "input_record_separator" on an undefined value at
c:/Apache2/modperl/MyApache/StockList.pm line 628.
, referer: http://localhost:8080/stocklist
 
Is there anyone who has the experience for this problem? 
Please give me some advices if you know how to fix it.
 
Thanks,
 
Willy
 
 

Re: IO::File problem on Mod_perl

Posted by Tom Schindl <to...@gmx.at>.
Huilli Liu wrote:
> Hi All,
>  
> Recently I are migrating cgi to mod_perl but it is running out of the 
> problem for IO::File.
> Here are my original codes:
>  

Try it like this:
---------------------8<---------------------
use Apache::RequestUtil ();

$template_file = new 
IO::File($r->document_root()."templates/quickquote.templ");
--------------------->8---------------------

mp2 does not chdir because chdir will affect all threads!!!
http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues

Tom

>  my $template_file = new IO::File("templates/quickquote.templ");
>  $template_file->input_record_separator(undef);
>  my $template = <$template_file>;
>  $template_file->close;
>  
> "templates/quickquote.templ" is under "DocumentRoot" directory but it 
> looks like it can not find the file.
>  
> The error I got is as below:
>  
> [Wed Jun 16 16:52:46 2004] [error] [client 10.5.20.105] Can't call 
> method "input_record_separator" on an undefined value at 
> c:/Apache2/modperl/MyApache/StockList.pm line 628.
> , referer: http://localhost:8080/stocklist
>  
> Is there anyone who has the experience for this problem?
> Please give me some advices if you know how to fix it.
>  
> Thanks,
>  
> Willy
>  
>  


Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html