You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Dominique Quatravaux <do...@idealx.com> on 2005/02/01 16:01:54 UTC

[WISHLIST] Be able to troubleshoot config file with perl -cx as before

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Stas and fellow mod_perl maintainers,

I would like to be able to do the "perl -cx"-on-the-Apache-config-file
trick described in the Eagle book ("Debugging <perl> sections" in
chapter 8, page 420 in my edition but 428 in some others according to
Google), but I run across the following problem:

$ perl -e 'use strict; use Apache2; use Apache::compat;'
Bareword "Apache::ServerUtil::server_root" not allowed while "strict
subs" in use at /usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm
line 329.
BEGIN not safe after errors--compilation aborted at
/usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm line 412.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

And consequently perl -cx on my Apache configuration file does not
reliably syntax-check my
<perl> section.

I am running mod_perl 1.999.20, I reckon everything else is irrelevant
to this particular problem.

Regards,

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB/5nhMJAKAU3mjcsRAmMoAJwMzOkfn9itHdRlFdrYprKNxW4mbgCeJSv4
aCJPhcRBLl6cTXuGnSBEU8g=
=PY6W
-----END PGP SIGNATURE-----



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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Dominique Quatravaux <do...@idealx.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Geoffrey Young wrote:

| please keep posts on-list for the benefit of all...

Sorry, I forgot (again).

|
| what I meant was that does changing
| Apache::ServerUtil::restart_count to
| Apache::ServerUtil::restart_count() fix the problem, or does it
| then fail someplace else?

It does neither, it fails at the very same place, because this is no
longer a "bareword not allowed" error (that admittedly a pair of
parens would cure) but an "undefined subroutine".

| this kind of error is simple,

With all due respect, I don't think so.

Regards,

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB/64MMJAKAU3mjcsRAr7FAKCigj57mJ6mmw8NywWoc1Yshe4seACfXPuz
WUJ/Tu2x0YiKvlxoOQndIeY=
=g2OX
-----END PGP SIGNATURE-----



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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
please keep posts on-list for the benefit of all...

Dominique Quatravaux wrote:
> 
> | Dominique Quatravaux wrote:
> |
> |> The next error is:
> |>
> |> Undefined subroutine &Apache::ServerUtil::restart_count called at
> |>  /usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm line 75.
> |
> |
> Geoffrey Young wrote:
> 
> | well, does fixing that fix the problem, or are there others?
> 
> Huh? No, as I said I now have an error about an undefined
> Apache::ServerUtil::restart_count method. And prepending a "use
> Apache::ServerUtil;" does not work either.

what I meant was that does changing Apache::ServerUtil::restart_count to
Apache::ServerUtil::restart_count() fix the problem, or does it then fail
someplace else?  this kind of error is simple, but it shouldn't take
iteration after iteration of patches to get it right - since you have the
environment to reproduce the issue and know the fix, apply it until the
problem either goes away or becomes something else :)  if the problem goes
away post a patch and we'll apply it asap.  if it becomes something else
we'll help that go away too :)

--Geoff


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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> $ perl -e 'use strict; use Apache2; use Apache::compat;'
> Bareword "Apache::ServerUtil::server_root" not allowed while "strict
> subs" in use at /usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm
> line 329.
> BEGIN not safe after errors

try this

--Geoff

Index: lib/Apache/compat.pm
===================================================================
--- lib/Apache/compat.pm        (revision 149378)
+++ lib/Apache/compat.pm        (working copy)
@@ -309,7 +309,7 @@

 package Apache::Server;
 # XXX: is that good enough? see modperl/src/modules/perl/mod_perl.c:367
-our $CWD = Apache::ServerUtil::server_root;
+our $CWD = Apache::ServerUtil::server_root();

 our $AddPerlVersion = 1;

@@ -326,7 +326,7 @@
          return File::Spec->catfile(@_);
     }
     else {
-        File::Spec->catfile(Apache::ServerUtil::server_root, @_);
+        File::Spec->catfile(Apache::ServerUtil::server_root(), @_);
     }
 }


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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Stas Bekman <st...@stason.org>.
Dominique Quatravaux wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Stas Bekman wrote:
> 
> |
> | This is not going to work, since it requires a running mod_perl.
> 
> I understand this, and my [WISH] was that it be taught not to.

got you :)

> | I'm pretty sure the perl -cx worked in mp1 only in certain cases,
> | where no mod_perl symbols were used. Try the modperl1 config where
> | you use some Apache module and you will get the same problem.
> |
> Since they do nothing too fancy in their BEGIN blocks, all modules in
> mod_perl 1 except Apache::test compile OK from /usr/bin/perl (even
> though calling any of their subs could obviously fail):
> 
> $ for i in `dpkg -L libapache-mod-perl | grep 'pm$' | perl -pe
> 's|/usr/lib/perl5/(.*).pm|$1|;   s|/|::|g;'`; do perl -M$i -e 1 ||
> echo $i; done
> Can't locate Apache/test.pm in @INC (@INC contains:
> /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5
> /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1
> /usr/local/lib/site_perl .).
> BEGIN failed--compilation aborted.
> Apache::test

what mp2 modules fail to do so, besides Apache::compat?

> Having just "Apache::Compat" compile OK in mod_perl 2 would be enough
> for my needs.

I see. but since you aren't using Apache::compat during config, why not 
just comment it out. I don't think the described situation justfies 
rewriting this module, to s/use/require/ and remove other compile time 
things, making the code a mess and losing some compile time optimizations.

The solution in fact is simple: just replace your 'use Apache::compat; with:

require Apache::compat if $ENV{MOD_PERL};

in which case it won't be loaded unless run under mod_perl.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Dominique Quatravaux <do...@idealx.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stas Bekman wrote:

|
| This is not going to work, since it requires a running mod_perl.

I understand this, and my [WISH] was that it be taught not to.

| I'm pretty sure the perl -cx worked in mp1 only in certain cases,
| where no mod_perl symbols were used. Try the modperl1 config where
| you use some Apache module and you will get the same problem.
|
Since they do nothing too fancy in their BEGIN blocks, all modules in
mod_perl 1 except Apache::test compile OK from /usr/bin/perl (even
though calling any of their subs could obviously fail):

$ for i in `dpkg -L libapache-mod-perl | grep 'pm$' | perl -pe
's|/usr/lib/perl5/(.*).pm|$1|;   s|/|::|g;'`; do perl -M$i -e 1 ||
echo $i; done
Can't locate Apache/test.pm in @INC (@INC contains:
/usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1
/usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.
Apache::test

Having just "Apache::Compat" compile OK in mod_perl 2 would be enough
for my needs.

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCALJtMJAKAU3mjcsRAhfOAKC+K7vOlXsK0coqtbt4OuDZ+oSjgQCgnIo9
xDDaabqSgYqF49XThsYphHc=
=qsu7
-----END PGP SIGNATURE-----



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


Re: [WISHLIST] Be able to troubleshoot config file with perl -cx as before

Posted by Stas Bekman <st...@stason.org>.
Dominique Quatravaux wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Dear Stas and fellow mod_perl maintainers,
> 
> I would like to be able to do the "perl -cx"-on-the-Apache-config-file
> trick described in the Eagle book ("Debugging <perl> sections" in
> chapter 8, page 420 in my edition but 428 in some others according to
> Google), but I run across the following problem:
> 
> $ perl -e 'use strict; use Apache2; use Apache::compat;'
> Bareword "Apache::ServerUtil::server_root" not allowed while "strict
> subs" in use at /usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm
> line 329.
> BEGIN not safe after errors--compilation aborted at
> /usr/local/lib/perl/5.6.1/Apache2/Apache/compat.pm line 412.
> Compilation failed in require at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
> 
> And consequently perl -cx on my Apache configuration file does not
> reliably syntax-check my
> <perl> section.
> 
> I am running mod_perl 1.999.20, I reckon everything else is irrelevant
> to this particular problem.

This is not going to work, since it requires a running mod_perl. I'm 
pretty sure the perl -cx worked in mp1 only in certain cases, where no 
mod_perl symbols were used. Try the modperl1 config where you use some 
Apache module and you will get the same problem.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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