You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gary Nielson <gn...@charlotte.infi.net> on 2001/05/30 17:48:47 UTC

Problem getting a cgi program to run

I am running embperl under Redhat 5.2, HTML-Embperl-1.3.2, using
epocgi.pl. Apache doesnt have mod perl installed. I need to run a perl
application that allows users to update Web pages without knowing HTML. I
am having trouble getting it to run under embperl. 

Outside of embperl it is set up to run under Exec CGI. ON a Web page, you
place the following under Apache:

<!--#set var="name" value="Homepage" -->
<!--#exec cgi="/cgi-bin/newsEdit2/department.cgi" -->

Under embperl, I tried that and it didn't work. I then set up:

[- $name = "Homepage" -]
[- Execute ("/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi") -]

in the index.html page and it pulls up the actual code of the program,
rather than running it. I tried setting the [- $optRawInput = 1 -] right
before that code above, since I set SetEnv EMBPERL_ESCMODE 0
in the httpd.conf file. That did not work either. I am hampered too by the
fact that this perl application is encrypted such that you can not edit
the code inside the program. 

How do I get this program to run on an html page under embperl then? The
docs talk about loading packages, using modules, etc. and I am wondering
if that is what I should be looking at, though I am not clear on how to
use it and any pointers, suggestions, examples would be much appreciated. 


-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

Posted by Gerald Richter <ri...@ecos.de>.
>
> Under embperl, I tried that and it didn't work. I then set up:
>
> [- $name = "Homepage" -]
> [- Execute
("/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi") -
]
>

In 1.3.x Execute executes a Embperl page, since your cgi doesn't contain any
[-/+ +/-] etc. blocks, Embperl will just pass it thru.
(In Embperl 2.0, you can say Execute ({inputfile => 'foo.cgi', syntax =>
'Perl'}) to let a perl script running, but this also cannot deal with
encryted Perl sources).

If you had a normal Perl script, you could simply say:

[-
do "/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi"
;
die $@ if ($@) ;
-]

this would execute the whole Perl programm, but again this will not deal
with encyrpted scripts. To get this working with an unaltered sources, you
have to additionaly set the optRedirectStdout  in your httpd.conf (not
inside the page!) .

To deal with encrypted sources you have to start an additional Perl
interpreter and catch the output:

[-

open FH, "/usr/bin/perl
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|" or
die "Cannot start cgi" ;
@output = <FH> ;
close FH ;

# you may alter the output here, e.g. remove http header generated by the
script
print OUT @output ;
-]

Make sure to set optRawInput, or to escape <FH> (or write &lt;FH&gt;)
otherwise Embperl will remove it.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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


Re: Problem getting a cgi program to run

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

> I've suggested one thing below that may getting your first approach
> going.
>
> There still must be a better way though... Creating a new instance of
> the perl interperter is messy.
>

Of course there is, but the problem is the encryption. The decrytion is
handle by Perl modules, so it should be possible to call them manual, but I
never have done this, so I can't say how it works, but if somebody is
interested, the docs should be inside the modules (I think it is the
Filter:: namespace)

If the script wasn't encrypted, you can simply call it with "do", or if you
can alter the source, you can wrap the main programm inside a sub, use
"require" to load the file and call the sub afterwards. The second way
causes the perl file to be compiled only once, which is of course faster
then a "do".

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------





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


BINGO! (was Re: Problem getting a cgi program to run)

Posted by Gary Nielson <gn...@charlotte.infi.net>.
Running it from the command line, I did the following and it works:

[- 
sub newsedit
{
        my ($self, $department) = @_;
        chdir("/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/");
        $ENV{QUERY_STRING} = "name=$department";
        open FH, ("/usr/bin/perl /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|")
                        or die "Cannot start cgi";
        while (<FH>) {
                if ($_ =~ m/Content\-Type\: text\/html/i) { print OUT ""; } else {
                print OUT $_;   }
        }
        close (FH);

}
-]

Basically, I deleted the line that included the path to the newsedit
program in the perl libraries path and changed it to simply changing to
that directory, and it works splendidly. 

Thanks, Gerald and Wim, for all your help on this. I have learned
alot. Thanks for your patience.

Gary

On Thu, 31 May 2001, Gerald Richter wrote:

> > Hi, I tried that and called it with:
> >
> > [-    $subs->newsedit();
> > -]
> >
> > on an html page, but nothing is displayed.
> >
> 
> Does the command from your page
> 
> /usr/bin/perl
> /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi
> 
> work from the command line ? If not, what do you have to do to make it
> working ?
> 
> Gerald
> 
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 
> 

-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

Posted by Gerald Richter <ri...@ecos.de>.
> Hi, I tried that and called it with:
>
> [-    $subs->newsedit();
> -]
>
> on an html page, but nothing is displayed.
>

Does the command from your page

/usr/bin/perl
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi

work from the command line ? If not, what do you have to do to make it
working ?

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




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


Re: Problem getting a cgi program to run

Posted by Gary Nielson <gn...@charlotte.infi.net>.
Hi, I tried that and called it with:

[-    $subs->newsedit();                   
-]

on an html page, but nothing is displayed.

Here is the output from the log:

http://www.cannonschool.org/Curriculum_and_Admissions/embperl.log?0&15635&SRC:

On Thu, 31 May 2001, Gerald Richter wrote:

> 
> 
> > How would I write that in front of the call to perl. I did the following
> > but am getting errors:
> >
> >
> > [-
> > sub newsedit
> > {
> >         unshift(@INC,
> '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ;
> >         open FH, ($ENV{QUERY_STRING} = "name=Homepage" "/usr/bin/perl
> > /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/depart
> > ment.cgi|")
> 
>          open FH, ('QUERY_STRING="name=Homepage" /usr/bin/perl
> /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|')
> 
> or you can try
> 
>     $ENV{QUERY_STRING} = "name=Homepage";
>          open FH, ('/usr/bin/perl
> /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|')
> 
> 
> Gerald
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 
> 

-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

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

> How would I write that in front of the call to perl. I did the following
> but am getting errors:
>
>
> [-
> sub newsedit
> {
>         unshift(@INC,
'/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ;
>         open FH, ($ENV{QUERY_STRING} = "name=Homepage" "/usr/bin/perl
> /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/depart
> ment.cgi|")

         open FH, ('QUERY_STRING="name=Homepage" /usr/bin/perl
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|')

or you can try

    $ENV{QUERY_STRING} = "name=Homepage";
         open FH, ('/usr/bin/perl
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi|')


Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




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


Re: Problem getting a cgi program to run

Posted by Gary Nielson <gn...@charlotte.infi.net>.
How would I write that in front of the call to perl. I did the following
but am getting errors:


[- 
sub newsedit
{
        unshift(@INC, '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ; 
        open FH, ($ENV{QUERY_STRING} = "name=Homepage" "/usr/bin/perl
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/depart
ment.cgi|")
        or die "Cannot start cgi";
        while (<FH>) {
        print OUT $_;
        }
        close (FH);

}
-]

I tried substituting

> >         my ($self, $department) = @_;

with

>           $ENV{QUERY_STRING} = "name=Homepage";

and nothing appeared on the page.


Thanks for your help. I appreciate it very much.

Gary

On Thu, 31 May 2001, Wim Kerkhoff wrote:

> I've suggested one thing below that may getting your first approach
> going.
> 
> There still must be a better way though... Creating a new instance of
> the perl interperter is messy.
> 
> Gary Nielson wrote:
> > 
> > Thank you! I had not realized you had sent a previous email as well. I
> > tried this solution and so far, it has not worked -- and I have some
> > questions about that. But I did find another solution that does work, and
> > I wanted to share that and see if there is any disadvantage to this
> > approach, if there might be more performance degradation this way or not.
> > 
> > First, the problems I encountered with the first approach.
> > I realized that the newsedit, encrypted perl application relies on
> > a variable passed to the apache Web server before initiating
> > the cgi script (see below). When I invoked:
> > 
> > [-
> > sub newsedit
> > {
> >         my ($self, $department) = @_;
> >         unshift(@INC,
> >         '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ;
> 
> Instead of tacking on ?name=Homepage when executing a CGI via a system
> call, or from the command line, I believe you need to do something like
> this:
> 
>           $ENV{QUERY_STRING} = "name=Homepage";
> 
> If that doesn't work, maybe try adding QUERY_STRING=\"name=Homepage\" in
> front of /usr/bin/perl on the next line:
> 
> >         open FH, ("/usr/bin/perl
> >         /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=Homepage|") or
> >                 die "Cannot start cgi";
> >         @output = <FH> ;
> >         close FH ;
> >         print OUT @output ;
> 
> You may want to change this code. Currently it reads all of the output
> of the CGI into a scaler, then prints it out. You could change it to
> print each line as it receives it from the pipe:
> 
> while (<FH>) {
>  print OUT $_;
> }
> close (FH);
> 
> This will use less memory, and the browser will get data as it comes
> available, not in one huge chunk after waiting 2 seconds.
> 
> > }
> > -]
> > 
> > it did not work and I suspected that was why. I do not know for sure. Does
> > this make sense?
> > 
> > When invoked through exec cgi, it passes the following to the apache web
> > server:
> > 
> > <!--#set var="name" value="Homepage" -->
> > <!--#exec cgi="/cgi-bin/newsEdit2/department.cgi" -->
> > 
> > But then I thought of another way. I do not know if this is a good
> > solution or not, but it does work:
> > 
> > [-
> > sub writepage
> >         {
> >         use LWP::Simple;
> >         my ($self, $department) = @_;
> >         $graburl="http://www.cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=$department";
> >         print OUT (get $graburl);
> >         }
> > -]
> > 
> > I invoke it in an html file as:
> > 
> > [- $subs = $param[0];
> >    $subs->writepage ("Homepage");
> > -]
> > 
> > and it comes up. Now I am wondering if by having to make a DNS request to
> > the domain, if I am creating more work and therefore slowing down
> > execution more than if I could actually get the first solution to work
> > right. Or if invoking another instance of perl, in either case, amounts to
> > about the same amount of work. What do you think, and if you think the
> > first approach is the better way, what am I still doing wrong?
> 
> Try and get the first approach to work; it will be much faster and
> easier on the server. With the second approach, two requests are done
> for every request to the Embperl page.s
> 
> 

-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

Posted by Wim Kerkhoff <wi...@merilus.com>.
I've suggested one thing below that may getting your first approach
going.

There still must be a better way though... Creating a new instance of
the perl interperter is messy.

Gary Nielson wrote:
> 
> Thank you! I had not realized you had sent a previous email as well. I
> tried this solution and so far, it has not worked -- and I have some
> questions about that. But I did find another solution that does work, and
> I wanted to share that and see if there is any disadvantage to this
> approach, if there might be more performance degradation this way or not.
> 
> First, the problems I encountered with the first approach.
> I realized that the newsedit, encrypted perl application relies on
> a variable passed to the apache Web server before initiating
> the cgi script (see below). When I invoked:
> 
> [-
> sub newsedit
> {
>         my ($self, $department) = @_;
>         unshift(@INC,
>         '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ;

Instead of tacking on ?name=Homepage when executing a CGI via a system
call, or from the command line, I believe you need to do something like
this:

          $ENV{QUERY_STRING} = "name=Homepage";

If that doesn't work, maybe try adding QUERY_STRING=\"name=Homepage\" in
front of /usr/bin/perl on the next line:

>         open FH, ("/usr/bin/perl
>         /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=Homepage|") or
>                 die "Cannot start cgi";
>         @output = <FH> ;
>         close FH ;
>         print OUT @output ;

You may want to change this code. Currently it reads all of the output
of the CGI into a scaler, then prints it out. You could change it to
print each line as it receives it from the pipe:

while (<FH>) {
 print OUT $_;
}
close (FH);

This will use less memory, and the browser will get data as it comes
available, not in one huge chunk after waiting 2 seconds.

> }
> -]
> 
> it did not work and I suspected that was why. I do not know for sure. Does
> this make sense?
> 
> When invoked through exec cgi, it passes the following to the apache web
> server:
> 
> <!--#set var="name" value="Homepage" -->
> <!--#exec cgi="/cgi-bin/newsEdit2/department.cgi" -->
> 
> But then I thought of another way. I do not know if this is a good
> solution or not, but it does work:
> 
> [-
> sub writepage
>         {
>         use LWP::Simple;
>         my ($self, $department) = @_;
>         $graburl="http://www.cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=$department";
>         print OUT (get $graburl);
>         }
> -]
> 
> I invoke it in an html file as:
> 
> [- $subs = $param[0];
>    $subs->writepage ("Homepage");
> -]
> 
> and it comes up. Now I am wondering if by having to make a DNS request to
> the domain, if I am creating more work and therefore slowing down
> execution more than if I could actually get the first solution to work
> right. Or if invoking another instance of perl, in either case, amounts to
> about the same amount of work. What do you think, and if you think the
> first approach is the better way, what am I still doing wrong?

Try and get the first approach to work; it will be much faster and
easier on the server. With the second approach, two requests are done
for every request to the Embperl page.s

-- 

Regards,

Wim Kerkhoff, Software Engineer
Merilus, Inc.  -|- http://www.merilus.com
Email: wim@merilus.com

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


Re: Problem getting a cgi program to run

Posted by Gary Nielson <gn...@charlotte.infi.net>.
Thank you! I had not realized you had sent a previous email as well. I
tried this solution and so far, it has not worked -- and I have some
questions about that. But I did find another solution that does work, and
I wanted to share that and see if there is any disadvantage to this
approach, if there might be more performance degradation this way or not.

First, the problems I encountered with the first approach.
I realized that the newsedit, encrypted perl application relies on
a variable passed to the apache Web server before initiating
the cgi script (see below). When I invoked:

[-
sub newsedit
{
        my ($self, $department) = @_;
        unshift(@INC,
	'/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2') ;
        open FH, ("/usr/bin/perl
	/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=Homepage|") or
                die "Cannot start cgi";
        @output = <FH> ;
        close FH ;
        print OUT @output ;
}
-]

it did not work and I suspected that was why. I do not know for sure. Does
this make sense?


When invoked through exec cgi, it passes the following to the apache web
server:

<!--#set var="name" value="Homepage" -->
<!--#exec cgi="/cgi-bin/newsEdit2/department.cgi" -->

But then I thought of another way. I do not know if this is a good
solution or not, but it does work:


[-
sub writepage
        {
        use LWP::Simple;
        my ($self, $department) = @_;
	$graburl="http://www.cannonschool.org/cgi-bin/newsEdit2/department.cgi?name=$department";
        print OUT (get $graburl);  
        }
-]

I invoke it in an html file as:


[- $subs = $param[0];
   $subs->writepage ("Homepage");
-]

and it comes up. Now I am wondering if by having to make a DNS request to
the domain, if I am creating more work and therefore slowing down
execution more than if I could actually get the first solution to work
right. Or if invoking another instance of perl, in either case, amounts to
about the same amount of work. What do you think, and if you think the
first approach is the better way, what am I still doing wrong?

Thanks for all your help.

Gary 

 On Thu, 31 May 2001, G.Richter wrote:

> > Please forgive my newbie questions here. I set the following in
> > httpd.conf:
> >
> > # EMBPERL STUFF
> > SetEnv EMBPERL_ESCMODE 0
> > SetEnv EMBPERL_OPTIONS 16,16384
> >
> 
> You have to add these two numbers together:
> 
> SetEnv EMBPERL_OPTIONS 16700
> 
> 
> > and then in the html file, I did the following:
> >
> > [- BEGIN { unshift(@INC,
> > '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/') } -]
> > [- $name = "Homepage" -]
> > [- require
> >
> ('/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi') -
> ]
> >
> 
> require will execute your script only once
> 
> > I felt I needed to add the newsedit path to @INC because I was getting
> > error messages before that embperl could not find modules that were
> > required by department.cgi.
> >
> 
> That's ok
> 
> > I have gotten past those error messages now, but I see in the errors that
> > "
> > [9066]ERR: 24: Line 25: Error in Perl code: No such file or directory at
> > /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2//Relationship.pm
> > line 2."
> >
> > The perl application newsEdit works fine outside of embperl so something
> > must still be wrong with the way I am setting up paths or something. It is
> > hard for me to tell what is on line2 of Relationship.pm because of the
> > encryption it appears the entire program runs on line 2 in vi.
> > Either that or for some reason there are 2 '/' in that error
> > message: cgi-bin/newsEdit2//Relationship.pm
> > line 2. I see nothing in newsedit's config file to explain this.
> >
> 
> line 2 will be the line where the decrytion filter lives, so as seen from
> point of the Perl interpreter everythings comes from line 2
> 
> I wrote two mails with the same subject, but different content. Did you see
> my first mail where I suggested to run a separate Perl interpreter and catch
> the output ? I think this will solve your problems
> 
> Gerald
> 
> 

-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

Posted by "G.Richter" <ri...@ecos.de>.
> Please forgive my newbie questions here. I set the following in
> httpd.conf:
>
> # EMBPERL STUFF
> SetEnv EMBPERL_ESCMODE 0
> SetEnv EMBPERL_OPTIONS 16,16384
>

You have to add these two numbers together:

SetEnv EMBPERL_OPTIONS 16700


> and then in the html file, I did the following:
>
> [- BEGIN { unshift(@INC,
> '/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/') } -]
> [- $name = "Homepage" -]
> [- require
>
('/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi') -
]
>

require will execute your script only once

> I felt I needed to add the newsedit path to @INC because I was getting
> error messages before that embperl could not find modules that were
> required by department.cgi.
>

That's ok

> I have gotten past those error messages now, but I see in the errors that
> "
> [9066]ERR: 24: Line 25: Error in Perl code: No such file or directory at
> /webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2//Relationship.pm
> line 2."
>
> The perl application newsEdit works fine outside of embperl so something
> must still be wrong with the way I am setting up paths or something. It is
> hard for me to tell what is on line2 of Relationship.pm because of the
> encryption it appears the entire program runs on line 2 in vi.
> Either that or for some reason there are 2 '/' in that error
> message: cgi-bin/newsEdit2//Relationship.pm
> line 2. I see nothing in newsedit's config file to explain this.
>

line 2 will be the line where the decrytion filter lives, so as seen from
point of the Perl interpreter everythings comes from line 2

I wrote two mails with the same subject, but different content. Did you see
my first mail where I suggested to run a separate Perl interpreter and catch
the output ? I think this will solve your problems

Gerald



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


Re: Problem getting a cgi program to run

Posted by Gary Nielson <gn...@charlotte.infi.net>.
Please forgive my newbie questions here. I set the following in
httpd.conf:

# EMBPERL STUFF
SetEnv EMBPERL_ESCMODE 0
SetEnv EMBPERL_OPTIONS 16,16384

and then in the html file, I did the following: 

[- BEGIN { unshift(@INC,
'/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/') } -]
[- $name = "Homepage" -]
[- require
('/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi') -]

I felt I needed to add the newsedit path to @INC because I was getting
error messages before that embperl could not find modules that were
required by department.cgi. 

I have gotten past those error messages now, but I see in the errors that
"
[9066]ERR: 24: Line 25: Error in Perl code: No such file or directory at
/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2//Relationship.pm
line 2."

The perl application newsEdit works fine outside of embperl so something
must still be wrong with the way I am setting up paths or something. It is
hard for me to tell what is on line2 of Relationship.pm because of the
encryption it appears the entire program runs on line 2 in vi.
Either that or for some reason there are 2 '/' in that error
message: cgi-bin/newsEdit2//Relationship.pm
line 2. I see nothing in newsedit's config file to explain this.

Thanks for all your help. I really appreciate it.

Gary




On Wed, 30 May 2001, Gerald Richter wrote:

> >
> > [-
> >         $oldfh = select(OUT);
> >         &do();
> >         select ($oldfh);
> > -]
> >
> 
> Instead of the select(OUT) you can set optRedirectStdout in your httpd.conf
> and Embperl will do the same for you.
> 
> Gerald
> 
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 

-- 
Gary Nielson
gary@garynielson.com





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


Re: Problem getting a cgi program to run

Posted by Gerald Richter <ri...@ecos.de>.
>
> [-
>         $oldfh = select(OUT);
>         &do();
>         select ($oldfh);
> -]
>

Instead of the select(OUT) you can set optRedirectStdout in your httpd.conf
and Embperl will do the same for you.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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


Re: Problem getting a cgi program to run

Posted by Wim Kerkhoff <wi...@merilus.com>.
Gary Nielson wrote:
> 
> I am running embperl under Redhat 5.2, HTML-Embperl-1.3.2, using
> epocgi.pl. Apache doesnt have mod perl installed. I need to run a perl
> application that allows users to update Web pages without knowing HTML. I
> am having trouble getting it to run under embperl.

Try something like this:

[-
        require
'/webServer/virtualDW/cannonschool.org/cgi-bin/newsEdit2/department.cgi';
-]

I did something like this to call an older CGI I had... to get it to
play really nice, however, I had to wrap everything in the CGI with sub
do {...}, then in the Embperl page, put a block of code like this:

[-
        $oldfh = select(OUT);
        &do();
        select ($oldfh);
-]

If you can't modify the source to the CGI, I don't know how well this
will work... you may have to do some other magic with packages,
namespaces, and so forth.

In my case, I eventually re-wrote the 800 line perl CGI script in 240
lines of Embperl that actually was easier to use and had more features
:-)

-- 

Regards,

Wim Kerkhoff, Software Engineer
Merilus, Inc.  -|- http://www.merilus.com
Email: wim@merilus.com

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