You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by allen haim <al...@netherrealm.net> on 2005/06/03 02:01:15 UTC

Syntax=perl problem

Hi,

Could someone please help with this Syntax=Perl problem?

-----------------------
/notemplate/test3.html:

[-

$r = shift;

    Execute({
        inputfile => '/usr/local/apache2/cgi-perl/warreng/header_test.pl',
        syntax => 'Perl',
        output => \$out,

        #options => 256,
        #req_rec => $r
    });
-]

<p>output:

[+ $out +]

-----------------------
/usr/local/apache2/cgi-perl/warreng/header_test.pl:

#!/usr/bin/perl
print 'allen';
-----------------------

When I point to http://localhost/notemplate/test3.html, I get:

output:

with nothing after it. 

If I hit reload about 5 or 6 times, sometimes I will get the following:

allenHTTP/1.1 200 OK Date: Thu, 02 Jun 2005 16:57:42 GMT Server: Embperl/2.0rc3 Apache/2.0.52 (Unix) mod_perl/1.999.21 Perl/v5.8.5 Content-Length: 72 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Content-Type: text/html; charset=ISO-8859-1

output: allen


It's as though the 'allen' is getting printed but not actually sent.


Finally, I added the line:

select((select(STDOUT), $| = 1)[0]);

in header_test.pl.

Now, 'allen' is printed *before* 'output:' is printed.

What is the right way to call an arbitrary perl script and catch its output?

Thanks

Allen


-- 



now through the seven oceans, 
i am a star most famed;
many leggies have I lost,
many have I gained.

-donovan


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


Re: Syntax=perl problem

Posted by allen haim <al...@netherrealm.net>.
Almost -- except that I want it to run under Embperl, so that I can access
%udat from within header_test.pl.

On Thu, Jun 02, 2005 at 05:36:07PM -0700, Daniel wrote:
> Not having done this, I'm not too sure, but can't you just do:
> 
> my @out = qx(/usr/local/apache2/cgi-perl/warreng/header_test.pl); 
> 
> ?
> 
> On Thu, Jun 02, 2005 at 05:01:15PM -0700, allen haim wrote:
> > Hi,
> > 
> > Could someone please help with this Syntax=Perl problem?
> > 
> > -----------------------
> > /notemplate/test3.html:
> > 
> > [-
> > 
> > $r = shift;
> > 
> >     Execute({
> >         inputfile => '/usr/local/apache2/cgi-perl/warreng/header_test.pl',
> >         syntax => 'Perl',
> >         output => \$out,
> > 
> >         #options => 256,
> >         #req_rec => $r
> >     });
> > -]
> > 
> > <p>output:
> > 
> > [+ $out +]
> > 
> > -----------------------
> > /usr/local/apache2/cgi-perl/warreng/header_test.pl:
> > 
> > #!/usr/bin/perl
> > print 'allen';
> > -----------------------
> > 
> > When I point to http://localhost/notemplate/test3.html, I get:
> > 
> > output:
> > 
> > with nothing after it. 
> > 
> > If I hit reload about 5 or 6 times, sometimes I will get the following:
> > 
> > allenHTTP/1.1 200 OK Date: Thu, 02 Jun 2005 16:57:42 GMT Server: Embperl/2.0rc3 Apache/2.0.52 (Unix) mod_perl/1.999.21 Perl/v5.8.5 Content-Length: 72 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Content-Type: text/html; charset=ISO-8859-1
> > 
> > output: allen
> > 
> > 
> > It's as though the 'allen' is getting printed but not actually sent.
> > 
> > 
> > Finally, I added the line:
> > 
> > select((select(STDOUT), $| = 1)[0]);
> > 
> > in header_test.pl.
> > 
> > Now, 'allen' is printed *before* 'output:' is printed.
> > 
> > What is the right way to call an arbitrary perl script and catch its output?
> > 
> > Thanks
> > 
> > Allen
> > 
> > 
> > -- 
> > 
> > 
> > 
> > now through the seven oceans, 
> > i am a star most famed;
> > many leggies have I lost,
> > many have I gained.
> > 
> > -donovan
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 

-- 
happy random snippet from Allen Haim reviewing Allen Haim:


His subject matter reflects such diverse topics as love, lost love, travelling down the highway, and how much he misses various places he's been.


[more at http://www.netherrealm.net/~allen/songs]

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


Re: Syntax=perl problem

Posted by Daniel <em...@7thfire.com>.
Not having done this, I'm not too sure, but can't you just do:

my @out = qx(/usr/local/apache2/cgi-perl/warreng/header_test.pl); 

?

On Thu, Jun 02, 2005 at 05:01:15PM -0700, allen haim wrote:
> Hi,
> 
> Could someone please help with this Syntax=Perl problem?
> 
> -----------------------
> /notemplate/test3.html:
> 
> [-
> 
> $r = shift;
> 
>     Execute({
>         inputfile => '/usr/local/apache2/cgi-perl/warreng/header_test.pl',
>         syntax => 'Perl',
>         output => \$out,
> 
>         #options => 256,
>         #req_rec => $r
>     });
> -]
> 
> <p>output:
> 
> [+ $out +]
> 
> -----------------------
> /usr/local/apache2/cgi-perl/warreng/header_test.pl:
> 
> #!/usr/bin/perl
> print 'allen';
> -----------------------
> 
> When I point to http://localhost/notemplate/test3.html, I get:
> 
> output:
> 
> with nothing after it. 
> 
> If I hit reload about 5 or 6 times, sometimes I will get the following:
> 
> allenHTTP/1.1 200 OK Date: Thu, 02 Jun 2005 16:57:42 GMT Server: Embperl/2.0rc3 Apache/2.0.52 (Unix) mod_perl/1.999.21 Perl/v5.8.5 Content-Length: 72 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Content-Type: text/html; charset=ISO-8859-1
> 
> output: allen
> 
> 
> It's as though the 'allen' is getting printed but not actually sent.
> 
> 
> Finally, I added the line:
> 
> select((select(STDOUT), $| = 1)[0]);
> 
> in header_test.pl.
> 
> Now, 'allen' is printed *before* 'output:' is printed.
> 
> What is the right way to call an arbitrary perl script and catch its output?
> 
> Thanks
> 
> Allen
> 
> 
> -- 
> 
> 
> 
> now through the seven oceans, 
> i am a star most famed;
> many leggies have I lost,
> many have I gained.
> 
> -donovan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

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


RE: XML XSLT

Posted by Gerald Richter <ri...@ecos.de>.
> > Where do i get this now?  I saw this in the INSTALL POD
> > 

http://xml.apache.org/xalan-c/


But I am not sure if the newest version is working with Embperl.

If not, try libxslt, which is known to work correctly

Gerald



> > Ruben
> >  XML and XSLT support
> > 
> >        Starting with Embperl 2.0b4 it has a build in XSLT 
> support. You can either use the Apache
> >        Xercesâ      Xalan 1.2 and libxslt 1.0.4.
> > 
> >        To install Xalan, download the Xalan archive for your OS from
> >        http://xml.apache.org/dist/xalanâ
> > 
> >        For Linux it is Xalanâ1_2ânux.tar.gz For Solaris it is 
> > Xalanâ1_2âlaris.tar.gz
> > 
> >        Extract the archive and make the shared libraries 
> available to the system, either by
> >        adding the directories to LD_LIBRARY_PATH or by 
> coping them to a library directory, e.g.
> >        /usr/local/lib and run ldconfig â The two ncessary libraries 
> > can be found under
> > 
> >            xercesâ          xmlâ       Now you only have to 
> enter the basepath of where you have extraced the Xalan archive, when
> >        Makefile.PL asks you for it and proceed as normal.
> > 
> >        NOTE: For special hints on compiling XALAN see belo
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> 
> --
> __________________________
> Brooklyn Linux Solutions
> 
> So many immigrant groups have swept through our town that 
> Brooklyn, like Atlantis, reaches mythological proportions in 
> the mind of the world  - RI Safir 1998
> 
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 
> http://fairuse.nylxs.com
> 
> "Yeah - I write Free Software...so SUE ME"
> 
> http://www.mrbrklyn.com - Consulting
> http://www.inns.net <-- Happy Clients
> http://www.nylxs.com - Leadership Development in Free 
> Software http://www2.mrbrklyn.com/resources - Unpublished 
> Archive or stories and articles from around the net 
> http://www2.mrbrklyn.com/downtown.html - See the New Downtown 
> Brooklyn....
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 
> 


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


XML XSLT

Posted by Ruben Safir <ru...@www2.mrbrklyn.com>.
Sorry sent with the wrong subject :(

		Ruben


On Wed, Jun 08, 2005 at 06:51:27PM -0400, Ruben Safir wrote:
> Where do i get this now?  I saw this in the INSTALL POD
> 
> Ruben
>  XML and XSLT support
> 
>        Starting with Embperl 2.0b4 it has a build in XSLT support. You can either use the Apache
>        Xercesâ      Xalan 1.2 and libxslt 1.0.4.
> 
>        To install Xalan, download the Xalan archive for your OS from
>        http://xml.apache.org/dist/xalanâ
> 
>        For Linux it is Xalanâ1_2ânux.tar.gz For Solaris it is Xalanâ1_2âlaris.tar.gz
> 
>        Extract the archive and make the shared libraries available to the system, either by
>        adding the directories to LD_LIBRARY_PATH or by coping them to a library directory, e.g.
>        /usr/local/lib and run ldconfig â The two ncessary libraries can be found under
> 
>            xercesâ          xmlâ       Now you only have to enter the basepath of where you have extraced the Xalan archive, when
>        Makefile.PL asks you for it and proceed as normal.
> 
>        NOTE: For special hints on compiling XALAN see belo
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

-- 
__________________________
Brooklyn Linux Solutions

So many immigrant groups have swept through our town 
that Brooklyn, like Atlantis, reaches mythological 
proportions in the mind of the world  - RI Safir 1998

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://fairuse.nylxs.com

"Yeah - I write Free Software...so SUE ME"

http://www.mrbrklyn.com - Consulting
http://www.inns.net <-- Happy Clients
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....


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


Re: Problem with GetSession (was: Syntax=perl problem)

Posted by Ruben Safir <ru...@www2.mrbrklyn.com>.
Where do i get this now?  I saw this in the INSTALL POD

Ruben
 XML and XSLT support

       Starting with Embperl 2.0b4 it has a build in XSLT support. You can either use the Apache
       Xercesâ      Xalan 1.2 and libxslt 1.0.4.

       To install Xalan, download the Xalan archive for your OS from
       http://xml.apache.org/dist/xalanâ

       For Linux it is Xalanâ1_2ânux.tar.gz For Solaris it is Xalanâ1_2âlaris.tar.gz

       Extract the archive and make the shared libraries available to the system, either by
       adding the directories to LD_LIBRARY_PATH or by coping them to a library directory, e.g.
       /usr/local/lib and run ldconfig â The two ncessary libraries can be found under

           xercesâ          xmlâ       Now you only have to enter the basepath of where you have extraced the Xalan archive, when
       Makefile.PL asks you for it and proceed as normal.

       NOTE: For special hints on compiling XALAN see belo

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


RE: Can't locate currReq.al (was: Problem with GetSession)

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

> 
> > Is the called script a standalone CGI script or is it 
> executed under 
> > mod_perl?
> 
> I would like to try both. Should both work?
> 

Yes, it works, but your code has to be a little different, because when the
subrequest happend under mod_perl the session is already setup, while in the
CGI, because it's a new process, it has to be setup first.

 if ($Embperl::req)
	{
	$udat = $Embperl::req -> GetSession() ;
	}
 else
	{
	$udat = Embperl::Req::SetupSession() ;
	}

In case you change something in the session data during your CGI, you need
to call

 if (!$Embperl::req)
	{
	Embperl::Req::CleanupSession() ;
	}

> 
> and I have done 
> 
> use Embperl;
> $udat = Embperl::Req::GetSession();
> 
> in the called script, and it still gives the same error.
> 

You see in the example above that I have changed the way I call GetSession.
This one should work. The other one does not work, because CurrReq () is an
old function, that does not exists anymore, so there is no way for Perl to
find. Sorry, I missed this during my last answer

Gerald


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


Re: Can't locate currReq.al (was: Problem with GetSession)

Posted by allen haim <al...@netherrealm.net>.
> Is the called script a standalone CGI script or is it executed under
> mod_perl?

I would like to try both. Should both work?

> Did you done a
> 
>  use Embperl ;
> ?

In my httpd.conf I have

PerlModule Embperl
LoadModule  embperl_module /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Embperl/Embperl.so

and I have done 

use Embperl;
$udat = Embperl::Req::GetSession();

in the called script, and it still gives the same error.

When I run under mod_perl, it's:

[Thu Jun 09 15:16:33 2005] [error] [client 127.0.0.1] Can't locate auto/Embperl/CurrReq.al in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Embperl) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Embperl.pm line 350, referer: http://127.0.0.1/warreng/results/results-nav.html?run_dir=/usr/local/apache2/htdocs/warreng/runs/1118247449;species=Drosophila%20melanogaster%204.0;hits_file=/usr/local/apache2/htdocs/warreng/runs/1118247449/hits.xml;       
------------

and when I run under cgi-bin, it's

[Thu Jun 09 15:09:32 2005] [error] [client 127.0.0.1] Use of inherited AUTOLOAD for non-method Embperl::CurrReq() is deprecated at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Embperl.pm line 350., referer: http://127.0.0.1/warreng/results/results-nav.html?run_dir=/usr/local/apache2/htdocs/warreng/runs/1118247449;species=Drosophila%20melanogaster%204.0;hits_file=/usr/local/apache2/htdocs/warreng/runs/1118247449/hits.xml;
[Thu Jun 09 15:09:32 2005] [error] [client 127.0.0.1] Can't locate auto/Embperl/CurrReq.al in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Embperl) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Embperl.pm line 350, referer: http://127.0.0.1/warreng/results/results-nav.html?run_dir=/usr/local/apache2/htdocs/warreng/runs/1118247449;species=Drosophila%20melanogaster%204.0;hits_file=/usr/local/apache2/htdocs/warreng/runs/1118247449/hits.xml;                        

--------------

I don't have any experience with auto/Dynaload/etc. How can I tell if
Embperl.pm is importing all the correct symbols from Embperl.so?

Thank you

Allen

On Thu, Jun 09, 2005 at 06:42:57AM +0200, Gerald Richter wrote:
> > 
> > now I am doing only this:
> > 
> > $udat = Embperl::Req::GetSession();
> > 
> 
> Did you done a
> 
>  use Embperl ;
> ?
> 
> > in the called script; however I still get the error:
> 
> Is the called script a standalone CGI script or is it executed under
> mod_perl?
> 
> > 
> > what is CurrReq.al and why does it not exist?
> > 
> 
> Perl tries to find Embperl::CurrReq (), but it is not loaded, so it tries to
> find it as autoload function, which also not exists.
> 
> Actually it is defined in Embperl.so, which seems not correctly initialized.
> 
> Gerald
> 
> 
> 

-- 



now through the seven oceans, 
i am a star most famed;
many leggies have I lost,
many have I gained.

-donovan


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


RE: Can't locate currReq.al (was: Problem with GetSession)

Posted by Gerald Richter <ri...@ecos.de>.
> 
> now I am doing only this:
> 
> $udat = Embperl::Req::GetSession();
> 

Did you done a

 use Embperl ;
?

> in the called script; however I still get the error:

Is the called script a standalone CGI script or is it executed under
mod_perl?

> 
> what is CurrReq.al and why does it not exist?
> 

Perl tries to find Embperl::CurrReq (), but it is not loaded, so it tries to
find it as autoload function, which also not exists.

Actually it is defined in Embperl.so, which seems not correctly initialized.

Gerald




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


Can't locate currReq.al (was: Problem with GetSession)

Posted by allen haim <al...@netherrealm.net>.
Hi Gerald,

now I am doing only this:

$udat = Embperl::Req::GetSession();

in the called script; however I still get the error:

-------------

[Wed Jun 08 16:22:13 2005] [error] Can't locate auto/Embperl/CurrReq.al in @INC (@INC contains: /usr/local/apache2/htdocs/warreng/ /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-th read-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/li b/perl5/vendor_perl . /usr/local/apache2) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Embperl.pm line 350\n[Wed Jun 08 16:22:13 2005] [warn] [24374]ERR:  32:  Warning in Perl code: Constant subroutine ModPerl::ROOT::ModPerl::

---------------

what is CurrReq.al and why does it not exist?

Allen

On Wed, Jun 08, 2005 at 05:24:04AM +0200, Gerald Richter wrote:
> > 
> > I would like to call a CGI script, and have %udat be 
> > available to it. I thought the way to do that was:
> > 
> > Embperl::Req::SetupSession($req_rec);
> > Execute({subreq => '/cgi-perl/env_test.pl?param1=...&param2=...'});
> > 
> 
> Since you are already using Embperl, you don't need to call SetupSession
> 
> 
> > and then in thescript.pl I would put:
> > 
> > %udat = Embperl::Req::GetSession($req_rec);
> > 
> 
> This does not take the Apache Request Record and it returns a reference to
> %udat, so jus call it as
> 
> $udat = Embperl::Req::GetSession();
> 
> This should work.
> 
> Gerald
> 
> 

-- 
happy random snippet from Allen Haim reviewing Allen Haim:


He often begins a song with a story of the type, "I wrote this song when ... ", and the title and lyrics will match accordingly.


[more at http://www.netherrealm.net/~allen/songs]

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


RE: Problem with GetSession (was: Syntax=perl problem)

Posted by Gerald Richter <ri...@ecos.de>.
> 
> I would like to call a CGI script, and have %udat be 
> available to it. I thought the way to do that was:
> 
> Embperl::Req::SetupSession($req_rec);
> Execute({subreq => '/cgi-perl/env_test.pl?param1=...&param2=...'});
> 

Since you are already using Embperl, you don't need to call SetupSession


> and then in thescript.pl I would put:
> 
> %udat = Embperl::Req::GetSession($req_rec);
> 

This does not take the Apache Request Record and it returns a reference to
%udat, so jus call it as

$udat = Embperl::Req::GetSession();

This should work.

Gerald



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


Re: Syntax=perl problem

Posted by allen haim <al...@netherrealm.net>.
Thanks -- that should work.

Now, I'm having more problems.

I would like to call a CGI script, and have %udat be available to it. I
thought the way to do that was:

Embperl::Req::SetupSession($req_rec);
Execute({subreq => '/cgi-perl/env_test.pl?param1=...&param2=...'});

and then in thescript.pl I would put:

%udat = Embperl::Req::GetSession($req_rec);

However, this results in the following error:

[Fri Jun 03 15:17:39 2005] [error] Can't locate auto/Embperl/CurrReq.al in @INC(@INC contains: /usr/local/apps/warreng/htdocs/warreng/ /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .  /usr/local/apps/warreng) at /usr/lib/perl5/site_perl/5.6.1/i386-linux/Embperl.pm line 350[Fri Jun 03 15:17:39 2005] [error] [7152]ERR:  500: env_test.pl(1): Error (no description) 500 (status=200) /cgi-perl/warreng/env_test.pl~~

and in fact CurrReq.al doesn't exist anywhere in the /usr/lib/perl5 tree.



--------

So another way would be to use

Execute({inputfile => "/absolute/path/to/script", syntax => 'Perl'})

but since it's a CGI script with lots of parameters, including cookies set
by other people, I don't know how to make that work.

----------

I may have to fall back on using %udat in the calling script and then
getting the EMBPERL_UID by parsing the headers, and then manually grepping
the session file 

(e.g.  /tmp/0bbff30336fd9dead9d8543e80372de5) 

for the values I want but that's definitely a hack.

I'm pretty sure method 1 is the cleanest way. Any help is very appreciated.

Good luck with moving, Gerald. Thanks everyone.

Allen

On Fri, Jun 03, 2005 at 02:15:57PM +0200, Gerald Richter wrote:
> > -----------------------
> > /usr/local/apache2/cgi-perl/warreng/header_test.pl:
> > 
> > #!/usr/bin/perl
> > print 'allen';
> 
> Should be
> 
> print OUT 'allen' ;
> 
> Or you have to put a
> 
> select(OUT) ;
> 
> At the top of your script.
> 
> > 
> > Finally, I added the line:
> > 
> > select((select(STDOUT), $| = 1)[0]);
> > 
> > in header_test.pl.
> > 
> > Now, 'allen' is printed *before* 'output:' is printed.
> > 
> 
> That's because STDOUT goes directly to the client, while OUT goes via
> Embperl.
> 
> Gerald
> 

-- 
happy random snippet from Allen Haim reviewing Allen Haim:


Since he insists on playing only his own mediocre original tunes, audiences are assured of hearing nearly the exact same show every time.


[more at http://www.netherrealm.net/~allen/songs]

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


RE: Syntax=perl problem

Posted by Gerald Richter <ri...@ecos.de>.
> -----------------------
> /usr/local/apache2/cgi-perl/warreng/header_test.pl:
> 
> #!/usr/bin/perl
> print 'allen';

Should be

print OUT 'allen' ;

Or you have to put a

select(OUT) ;

At the top of your script.

> 
> Finally, I added the line:
> 
> select((select(STDOUT), $| = 1)[0]);
> 
> in header_test.pl.
> 
> Now, 'allen' is printed *before* 'output:' is printed.
> 

That's because STDOUT goes directly to the client, while OUT goes via
Embperl.

Gerald


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