You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@eXtropia.com> on 2003/02/26 06:08:39 UTC
[Patch] $Apache::Server::StrictPerlSections backwards
compatiblilty
if $Apache::Server::StrictPerlSections is true, syntax error in <Perl >
sections aborts server startup, otherwise, you only get a warning.
$Id: Apache-Server-StrictPerlSections.patch,v 1.2 2003/02/26 05:07:17 gozer Exp $
Index: STATUS
===================================================================
RCS file: /home/cvspublic/modperl-2.0/STATUS,v
retrieving revision 1.34
diff -u -I'$Id' -I'$Revision' -r1.34 STATUS
--- STATUS 20 Feb 2003 00:41:51 -0000 1.34
+++ STATUS 26 Feb 2003 05:04:35 -0000
@@ -154,7 +154,6 @@
* Apache::PerlSections missing features for backwards compatibility:
- $Apache::Server::SaveConfig
- $Apache::ReadConfig::DocumentRoot
- - $Apache::Server::StrictPerlSections
- Apache::PerlSections->store(filename)
Report: Philippe M. Chiasson <go...@cpan.org>
Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.37
diff -u -I'$Id' -I'$Revision' -r1.37 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c 21 Dec 2002 03:46:07 -0000 1.37
+++ src/modules/perl/modperl_cmd.c 26 Feb 2003 05:04:36 -0000
@@ -316,6 +316,8 @@
#define MP_DEFAULT_PERLSECTION_HANDLER "Apache::PerlSection"
#define MP_DEFAULT_PERLSECTION_PACKAGE "Apache::ReadConfig"
+#define MP_STRICT_PERLSECTIONS_SV \
+perl_get_sv("Apache::Server::StrictPerlSections", FALSE)
MP_CMD_SRV_DECLARE(perldo)
{
@@ -327,6 +329,7 @@
const char *package_name = NULL;
int status = OK;
AV *args = Nullav;
+ SV *sv;
#ifdef USE_ITHREADS
MP_dSCFG(s);
pTHX;
@@ -369,7 +372,16 @@
eval_pv(arg, FALSE);
if (SvTRUE(ERRSV)) {
- return SvPVX(ERRSV);
+ if ((sv = MP_STRICT_PERLSECTIONS_SV) && SvTRUE(sv)) {
+ return SvPVX(ERRSV);
+ }
+ else {
+ modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d %s",
+ parms->directive->filename,
+ parms->directive->line_num,
+ SvPVX(ERRSV)));
+
+ }
}
if (handler) {
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@e(x|X)tropia\.com/ 88C3A5A5
(122FF51B/C634E37B)
http://www.eXtropia.com/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
88C3 A5A5
Re: [Patch] $Apache::Server::StrictPerlSections backwards
compatiblilty
Posted by Stas Bekman <st...@stason.org>.
+1 on the latest version
also don't forget to update Changes.
__________________________________________________________________
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: [Patch] $Apache::Server::StrictPerlSections backwards
compatiblilty
Posted by "Philippe M. Chiasson" <go...@eXtropia.com>.
# $Id: Apache-Server-StrictPerlSections.patch,v 1.3 2003/02/26 06:41:00 gozer Exp $
Index: STATUS
===================================================================
RCS file: /home/cvspublic/modperl-2.0/STATUS,v
retrieving revision 1.34
diff -u -I'$Id' -I'$Revision' -r1.34 STATUS
--- STATUS 20 Feb 2003 00:41:51 -0000 1.34
+++ STATUS 26 Feb 2003 06:39:42 -0000
@@ -154,7 +154,6 @@
* Apache::PerlSections missing features for backwards compatibility:
- $Apache::Server::SaveConfig
- $Apache::ReadConfig::DocumentRoot
- - $Apache::Server::StrictPerlSections
- Apache::PerlSections->store(filename)
Report: Philippe M. Chiasson <go...@cpan.org>
Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.37
diff -u -I'$Id' -I'$Revision' -r1.37 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c 21 Dec 2002 03:46:07 -0000 1.37
+++ src/modules/perl/modperl_cmd.c 26 Feb 2003 06:39:47 -0000
@@ -316,6 +316,8 @@
#define MP_DEFAULT_PERLSECTION_HANDLER "Apache::PerlSection"
#define MP_DEFAULT_PERLSECTION_PACKAGE "Apache::ReadConfig"
+#define MP_STRICT_PERLSECTIONS_SV \
+get_sv("Apache::Server::StrictPerlSections", FALSE)
MP_CMD_SRV_DECLARE(perldo)
{
@@ -369,7 +371,17 @@
eval_pv(arg, FALSE);
if (SvTRUE(ERRSV)) {
- return SvPVX(ERRSV);
+ SV *strict;
+ if ((strict = MP_STRICT_PERLSECTIONS_SV) && SvTRUE(strict)) {
+ return SvPVX(ERRSV);
+ }
+ else {
+ modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d %s",
+ parms->directive->filename,
+ parms->directive->line_num,
+ SvPVX(ERRSV)));
+
+ }
}
if (handler) {
On Wed, 2003-02-26 at 14:02, Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> > if $Apache::Server::StrictPerlSections is true, syntax error in <Perl >
> > sections aborts server startup, otherwise, you only get a warning.
> [...]
> > +#define MP_STRICT_PERLSECTIONS_SV \
> > +perl_get_sv("Apache::Server::StrictPerlSections", FALSE)
>
> perlapi.pod says that perl_ should be dropped:
>
> get_sv Returns the SV of the specified Perl scalar. If "create" is
> set and the Perl variable does not exist then it will be cre-
> ated. If "create" is not set and the variable does not exist
> then NULL is returned.
>
> NOTE: the perl_ form of this function is deprecated.
>
> SV* get_sv(const char* name, I32 create)
>
>
> > MP_CMD_SRV_DECLARE(perldo)
> > {
> > @@ -327,6 +329,7 @@
> > const char *package_name = NULL;
> > int status = OK;
> > AV *args = Nullav;
> > + SV *sv;
> > #ifdef USE_ITHREADS
> > MP_dSCFG(s);
> > pTHX;
> > @@ -369,7 +372,16 @@
> > eval_pv(arg, FALSE);
> >
> > if (SvTRUE(ERRSV)) {
> > - return SvPVX(ERRSV);
>
> could move 'SV *sv' in here
>
> > + if ((sv = MP_STRICT_PERLSECTIONS_SV) && SvTRUE(sv)) {
>
> the same perlapi entry says, that NULL is returned if get_sv(...,FALSE)
> doesn't find that variable. So shouldn't it check:
>
> if ((sv = MP_STRICT_PERLSECTIONS_SV) != NULL )
>
> or is it essentially the same?
>
> otherwise +1
>
> __________________________________________________________________
> 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
>
>
--
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@e(x|X)tropia\.com/ 88C3A5A5
(122FF51B/C634E37B)
http://www.eXtropia.com/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
88C3 A5A5
Re: [Patch] $Apache::Server::StrictPerlSections backwards
compatiblilty
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> if $Apache::Server::StrictPerlSections is true, syntax error in <Perl >
> sections aborts server startup, otherwise, you only get a warning.
[...]
> +#define MP_STRICT_PERLSECTIONS_SV \
> +perl_get_sv("Apache::Server::StrictPerlSections", FALSE)
perlapi.pod says that perl_ should be dropped:
get_sv Returns the SV of the specified Perl scalar. If "create" is
set and the Perl variable does not exist then it will be cre-
ated. If "create" is not set and the variable does not exist
then NULL is returned.
NOTE: the perl_ form of this function is deprecated.
SV* get_sv(const char* name, I32 create)
> MP_CMD_SRV_DECLARE(perldo)
> {
> @@ -327,6 +329,7 @@
> const char *package_name = NULL;
> int status = OK;
> AV *args = Nullav;
> + SV *sv;
> #ifdef USE_ITHREADS
> MP_dSCFG(s);
> pTHX;
> @@ -369,7 +372,16 @@
> eval_pv(arg, FALSE);
>
> if (SvTRUE(ERRSV)) {
> - return SvPVX(ERRSV);
could move 'SV *sv' in here
> + if ((sv = MP_STRICT_PERLSECTIONS_SV) && SvTRUE(sv)) {
the same perlapi entry says, that NULL is returned if get_sv(...,FALSE)
doesn't find that variable. So shouldn't it check:
if ((sv = MP_STRICT_PERLSECTIONS_SV) != NULL )
or is it essentially the same?
otherwise +1
__________________________________________________________________
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