You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Scott Chapman <sc...@mischko.com> on 2001/11/06 18:31:46 UTC

executing subroutine file doesn't work.

Subroutine scope question here I think.  I'm not sure how to solve this:

mail embperl file (/wwww/htdocs/new_review.epl):

[-
Execute ('subs.epl');
.
.
.
log_event ('event that happened','information to log');
-]

subs.epl:
[-
  sub log_event
  {
      $event = shift;
      $info = shift;
      print OUT "EVENT: $event <P>";
      print OUT "INFO: $info <P>";
  }
     
-]

I get this back:

{HYPERLINK "/embperl/log?1177130&795"}Logfile 
Internal Server Error
The server encountered an internal error or misconfiguration and was 
unable to complete your request. 
Please contact the server administrator, root@laptop.mischko.com and 
inform them of the time the error occurred, and anything you might have 
done that may have caused the error. 
{HYPERLINK "/embperl/log?1177130&795" \l "E0"}[795]ERR: 24: Line 1: Error in Perl code: Undefined subroutine 
&HTML::Embperl::DOC::_2::log_event called at 
/wwww/htdocs/new_review.epl line 53. 
Apache/1.3.20 (Unix) mod_perl/1.26 HTML::Embperl 2.0b3 [Tue Nov 
6 09:25:07 2001]

This Perl learning curve is challenging! :-)
Thanks,
Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: executing subroutine file doesn't work.

Posted by Andrew O'Brien <an...@switchonline.com.au>.
On Wed, Nov 07, 2001 at 09:38:40AM +1100, Andrew O'Brien wrote:

> Scott,
> 
>   Execute'ing a file doesn't import subroutines - you want to look at
>   the "import" argument to the execute call:
> 
>   Execute ({ inputfile => 'subs.epl', import => 1});
> 
>   Should do the trick.
> 
>   http://perl.apache.org/embperl/Embperl.pod.2.html#By_calling_HTML_Embperl_Execut
> 
>   Have a read through the docs again - I promise it'll make more and
>   more sense as you use Embperl :)

forgot to mention that Neil's tutorial was a great help to get off the
ground:

http://www.perl.com/pub/a/2001/03/embperl.html

-- 
 Andrew O'Brien                                                               
 Product Engineer                        email: andrewo@switchonline.com.au.
 Switch Online Group Pty Limited         phone: +61 2 9299 1133             
 ABN 89 092 286 327                      fax: +61 2 9299 1134             

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: executing subroutine file doesn't work.

Posted by Andrew O'Brien <an...@switchonline.com.au>.
On Tue, Nov 06, 2001 at 09:31:46AM -0800, Scott Chapman wrote:
> Subroutine scope question here I think.  I'm not sure how to solve this:
> 
> mail embperl file (/wwww/htdocs/new_review.epl):
> 
> [-
> Execute ('subs.epl');
> .
> .
> .
> log_event ('event that happened','information to log');
> -]
> 
> subs.epl:
> [-
>   sub log_event
>   {
>       $event = shift;
>       $info = shift;
>       print OUT "EVENT: $event <P>";
>       print OUT "INFO: $info <P>";
>   }
>      
> -]

Scott,

  Execute'ing a file doesn't import subroutines - you want to look at
  the "import" argument to the execute call:

  Execute ({ inputfile => 'subs.epl', import => 1});

  Should do the trick.

  http://perl.apache.org/embperl/Embperl.pod.2.html#By_calling_HTML_Embperl_Execut

  Have a read through the docs again - I promise it'll make more and
  more sense as you use Embperl :)

> I get this back:
> 
> {HYPERLINK "/embperl/log?1177130&795"}Logfile 
> Internal Server Error
> The server encountered an internal error or misconfiguration and was 
> unable to complete your request. 
> Please contact the server administrator, root@laptop.mischko.com and 
> inform them of the time the error occurred, and anything you might have 
> done that may have caused the error. 
> {HYPERLINK "/embperl/log?1177130&795" \l "E0"}[795]ERR: 24: Line 1: Error in Perl code: Undefined subroutine 
> &HTML::Embperl::DOC::_2::log_event called at 
> /wwww/htdocs/new_review.epl line 53. 
> Apache/1.3.20 (Unix) mod_perl/1.26 HTML::Embperl 2.0b3 [Tue Nov 
> 6 09:25:07 2001]
> 
> This Perl learning curve is challenging! :-)

-- 
 Andrew O'Brien                                                               
 Product Engineer                        email: andrewo@switchonline.com.au.
 Switch Online Group Pty Limited         phone: +61 2 9299 1133             
 ABN 89 092 286 327                      fax: +61 2 9299 1134             

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org