You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Beau E. Cox" <be...@beaucox.com> on 2004/04/16 08:53:52 UTC

I don't understand 'Execute' loading

Hi -

I don't understand how Execute works. I've been through the docs
and checked out eg/x/Execute.pl, but still it's not clicking.

I have a perl object in my document root -> 'document.pl'. It
contains methods (including init) for my site logic:

#/usr/bin/perl

use strict;
use warnings;

use Date::Format;
use DBI;
use Carp;

sub init
{
    my( $d, $r ) = @_;

    $r->{data}     = '';
    $r->{title}    = 'no title';
    $r->{document} = $d;
    0;
}
... and other methods ...

In my top level directory (where 'document.pl' lives) I load it
with:

 $d = Execute( { object => "document.pl", syntax => 'Perl' } );

All OK.

In lower-level directories, I want to use the same object. Thinking
the "../" was 'magic' to Execute (it would search up from the
current directory to the top looking for the object), I tried:

 $d = Execute( { object => "../document.pl", syntax => 'Perl' } );

and got:

[29303]ERR:  404: resume-base.epl(1): Not found '../document.pl', searched:

(note the 'searched:' is empty.)

Next I tried:

 $d = Execute( { isa => "../document.pl", syntax => 'Perl' } );

and got the same thing:

[29303]ERR: 404: resume-base.epl(1): Not found '../document.pl', searched:

What have I missed?

Aloha => Beau;



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


Re: I don't understand 'Execute' loading

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Wednesday 21 April 2004 06:33 pm, Gerald Richter wrote:
> > OK. I thought I was using Embperl::Object, but now I'm trying
> > Embperl_Path.
>
> Yes, you do, so you have to use Embperl_Object_Addpath, because
> EMbperl::Object already sets it#s own search path, which is from the
> requested document to the place where document-base.epl is found
>
> http://perl.apache.org/embperl/pod/intro/IntroEmbperlObject.htm and
> http://perl.apache.org/embperl/pod/intro/IntroEmbperl2.htm are an
> introduction to how Embperl::Object searching works.
>
>
>  Embperl_Obejct_AddPath "/home/test/httpd/2.1/htdocs/resume/objects"
>
> > <VirtualHost localhost:8080>
> >   ServerName resume.test.com
> >   DocumentRoot "/home/test/httpd/2.1/htdocs/resume"
> >   <Directory "/home/test/httpd/2.1/htdocs/resume">
> >     EMBPERL_APPNAME my_resume_app
> >     EMBPERL_OBJECT_BASE document-base.epl
> >     <FilesMatch "\.html$">
> >        SetHandler perl-script
> >        PerlHandler Embperl::Object
> >        Options ExecCGI
> >     </FilesMatch>
> >     <FilesMatch ".*\.epl$">
> >        Order allow,deny
> >        Deny From all
> >     </FilesMatch>
> >   </Directory>
> > </VirtualHost>
>

Gerald -

Thank you, vielen Dank, all is fine.

Aloha => Beau;


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


Re: I don't understand 'Execute' loading

Posted by Gerald Richter <ri...@ecos.de>.
>
> OK. I thought I was using Embperl::Object, but now I'm trying
> Embperl_Path.
>

Yes, you do, so you have to use Embperl_Object_Addpath, because
EMbperl::Object already sets it#s own search path, which is from the
requested document to the place where document-base.epl is found

http://perl.apache.org/embperl/pod/intro/IntroEmbperlObject.htm and
http://perl.apache.org/embperl/pod/intro/IntroEmbperl2.htm are an
introduction to how Embperl::Object searching works.


 Embperl_Obejct_AddPath "/home/test/httpd/2.1/htdocs/resume/objects"

>
> <VirtualHost localhost:8080>
>   ServerName resume.test.com
>   DocumentRoot "/home/test/httpd/2.1/htdocs/resume"
>   <Directory "/home/test/httpd/2.1/htdocs/resume">
>     EMBPERL_APPNAME my_resume_app
>     EMBPERL_OBJECT_BASE document-base.epl
>     <FilesMatch "\.html$">
>        SetHandler perl-script
>        PerlHandler Embperl::Object
>        Options ExecCGI
>     </FilesMatch>
>     <FilesMatch ".*\.epl$">
>        Order allow,deny
>        Deny From all
>     </FilesMatch>
>   </Directory>
> </VirtualHost>
>

Gerald


---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
Besuchen Sie uns auf der KOMCOM 2004 in Mannheim
25. bis 27. Mai 2004  Stand K11a   www.komcom.de

ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


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


Re: I don't understand 'Execute' loading

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Saturday 17 April 2004 04:53 pm, Angus Lees wrote:
> At Thu, 15 Apr 2004 20:53:52 -1000, Beau E. Cox wrote:
> > In lower-level directories, I want to use the same object. Thinking
> > the "../" was 'magic' to Execute (it would search up from the
> > current directory to the top looking for the object), I tried:
>
> Path searching only happens automatically when running under
> Embperl::Object.  Are you using Embperl::Object, or vanilla Embperl
> pages?
>
> With Embperl::Object, a default search path is supplied consisting of
> all directories from the page actually requested, up to where Embperl
> finds the "base" file.  In Embperl::Object "../$foo" means start
> searching from where you currently are in the search path (used to
> find "superclasses").
>
> Without Embperl::Object you can supply an explicit search path and
> still get these features.  See "Embperl_Path" in the Embperl::Config
> manpage.

OK. I thought I was using Embperl::Object, but now I'm trying
Embperl_Path.

My htdocs tree on my test server:

 /home/test/httpd/2.1/hsdocs/resume - main content
   document-base.epl, etc.
 /home/test/httpd/2.1/hsdocs/resume/objects - embperl loaded objects
   document.pl

In document-base.epl:

... new and other subroutines above
[-
 $r = shift;
 $r->new;

 $d = Execute( { object => "document.pl",
                 syntax => 'Perl' } );
...

my httpd.conf:

Embperl_Path "/home/test/httpd/2.1/htdocs/resume/objects"

<VirtualHost localhost:8080>
  ServerName resume.test.com
  DocumentRoot "/home/test/httpd/2.1/htdocs/resume"
  <Directory "/home/test/httpd/2.1/htdocs/resume">
    EMBPERL_APPNAME my_resume_app
    EMBPERL_OBJECT_BASE document-base.epl
    <FilesMatch "\.html$">
       SetHandler perl-script
       PerlHandler Embperl::Object 
       Options ExecCGI
    </FilesMatch>
    <FilesMatch ".*\.epl$">
       Order allow,deny
       Deny From all
    </FilesMatch>
  </Directory>
</VirtualHost>

FAILED. error_log:

[Wed Apr 21 10:33:50 2004] [error] [7553]ERR:  404: document-base.epl(1): Not 
found 'document.pl', 
searched: /home/test/httpd/2.1/htdocs/resume/document.pl;

Note that my 'Embperl_Path' does NOT appear in the searched path
shown in the logged error.

If I explicitly point my Execute to the absolute path of document.pl,
it works (but of course I don't want to have to do that).

What am I missing?

Aloha => Beau;


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


Re: I don't understand 'Execute' loading

Posted by Angus Lees <gu...@inodes.org>.
At Thu, 15 Apr 2004 20:53:52 -1000, Beau E. Cox wrote:
> In lower-level directories, I want to use the same object. Thinking
> the "../" was 'magic' to Execute (it would search up from the
> current directory to the top looking for the object), I tried:

Path searching only happens automatically when running under
Embperl::Object.  Are you using Embperl::Object, or vanilla Embperl
pages?

With Embperl::Object, a default search path is supplied consisting of
all directories from the page actually requested, up to where Embperl
finds the "base" file.  In Embperl::Object "../$foo" means start
searching from where you currently are in the search path (used to
find "superclasses").

Without Embperl::Object you can supply an explicit search path and
still get these features.  See "Embperl_Path" in the Embperl::Config
manpage.

-- 
 - Gus


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