You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ricky <ri...@virtual-map.com> on 2002/05/01 08:51:56 UTC
Re: PerlRun problem: can't find method "uri"?
On Tuesday 30 April 2002 03:44 pm, you wrote:
> You better fix these errors, and keep 'use strict' in place. Then
> PerlRun should work without any problems in most cases. If after fixing
> those problems you still have problems, come back with your relevant
> questions again.
> It's a good idea to have your code running under 'use strict' no matter
> if you use mod_perl or not. This will save you a lot of grief in a long
> run.
---
I agree with Stas that if you fix the problems with your script running
under "strict" this will most likely go away.
---
I see, thank you for the suggestion.
There are so many error in the script, usually related with global variable.
I change/add this in the script.
global variable: use var qw($myvar $in);
local variable: my $myvar;
I still don't know how to change this variable:
local($long, $lat, $level);
[error] PerlRun: 'Global symbol "$long" requires explicit package name at
/home/httpd/...
> It depends on your definition of "easier".
>
> Easier==sloppier: better stay away from mod_perl.
> Easier==more flexible: go with mod_perl.
>
> As for the speed, I doubt you will find something *significantly* faster
> than mod_perl. Assuming that you learn how to get the most our of mod_perl.
---
It will be much faster to fix your CGI scripts so they run under
mod_perl than to re-write them in PHP or JSP.
---
I see.
Well, we will try to porting 1 big script to see the speed different.
Any help would be great
> [p.s. please make sure you reply back to the list!]
Ok :)
Best Regards,
Ricky
Re: PerlRun problem: can't find method "uri"?
Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 08:51 01.05.2002, Ricky wrote:
>On Tuesday 30 April 2002 03:44 pm, you wrote:
> > You better fix these errors, and keep 'use strict' in place. Then
> > PerlRun should work without any problems in most cases. If after fixing
> > those problems you still have problems, come back with your relevant
> > questions again.
>
> > It's a good idea to have your code running under 'use strict' no matter
> > if you use mod_perl or not. This will save you a lot of grief in a long
> > run.
>---
>I agree with Stas that if you fix the problems with your script running
>under "strict" this will most likely go away.
>---
>
>I see, thank you for the suggestion.
>There are so many error in the script, usually related with global variable.
>I change/add this in the script.
>
>global variable: use var qw($myvar $in);
You still need to watch out for their use; even if they're declared as
global and pass "use strict" doesn't mean they won't create the subtleties
related to global variables in mod_perl. I strongly advise you to read the
mod_perl Guide at
http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/index.html
and for your problems here the "Perl Reference" and "CGI to mod_perl
porting" guidelines.
>local variable: my $myvar;
>
>I still don't know how to change this variable:
>
>local($long, $lat, $level);
>
>[error] PerlRun: 'Global symbol "$long" requires explicit package name at
>/home/httpd/...
You should be able to declare them as my(), except if you're doing:
{
local $var = 'something';
subroutine();
}
and then:
sub subroutine {
print $var;
}
In that case you should probably be moving to :
{
my $var = 'something';
subroutine($var);
}
sub subroutine {
my $var = shift;
print $var;
}
Which is generally better and will work the best, without surprises. Again,
see the references I pointed you to above, they are really good.
> > It depends on your definition of "easier".
> >
> > Easier==sloppier: better stay away from mod_perl.
> > Easier==more flexible: go with mod_perl.
> >
> > As for the speed, I doubt you will find something *significantly* faster
> > than mod_perl. Assuming that you learn how to get the most our of mod_perl.
>---
>It will be much faster to fix your CGI scripts so they run under
>mod_perl than to re-write them in PHP or JSP.
>---
>I see.
>Well, we will try to porting 1 big script to see the speed different.
>Any help would be great
If you want something, you have to pay for it with your time :) You won't
get free speed without good coding. Anyway, we're ready to help out with
any questions not answered in the Guide.
--
Per Einar Ellefsen
per.einar@skynet.be