Re: [mp2] mod_perl test suite fails
On Sun, 2003-12-14 at 03:18, Stas Bekman wrote:
> Great. I have now integrated this test into Apache-Test. Can you please verify
> that modperl-2.0's 'make test' refuses to run when modperl-2.0 is checked out
> under /root? Please use the latest cvs version:
> http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
Hmm, I checked out the latest cvs version (cvs -d
:pserver:[EMAIL PROTECTED]:/home/cvspublic co modperl-2.0) , but
the tests still do not work...
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -clean
APACHE_USER= APACHE_GROUP= APACHE_PORT= APACHE= APXS= \
/usr/bin/perl -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -bugreport -verbose=0
*** root mode: changing the files ownership to 'nobody' (99:99)
*** testing whether 'nobody' is able to -rwx /root/modperl-2.0/t
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun
-e 'eval { Apache::TestRun::run_root_fs_test(99, 99,
q[/root/modperl-2.0/t]) }';
apache/add_config.dubious
Test returned status 255 (wstat 65280, 0xff00)
Scalar found where operator expected at (eval 174) line 1, near "'int'
$__val"
(Missing operator before $__val?)
apache/cgihandler.NOK 1# Failed test 1 in
apache/cgihandler.t at line 16
apache/cgihandler.NOK 2# Failed test 2 in
apache/cgihandler.t at line 20
apache/cgihandler.FAILED tests
1-2
Failed 2/2 tests, 0.00% okay
apache/conftree...request has failed (the response code
was: 500)
see t/logs/error_log for more details
Regards
Volker
PS: If you want, I can send you the error_log.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] mod_perl test suite fails
Volker Kroll wrote:
On Sun, 2003-12-14 at 03:18, Stas Bekman wrote:
Great. I have now integrated this test into Apache-Test. Can you please verify
that modperl-2.0's 'make test' refuses to run when modperl-2.0 is checked out
under /root? Please use the latest cvs version:
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
Hmm, I checked out the latest cvs version (cvs -d
:pserver:[EMAIL PROTECTED]:/home/cvspublic co modperl-2.0) , but
the tests still do not work...
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -clean
APACHE_USER= APACHE_GROUP= APACHE_PORT= APACHE= APXS= \
/usr/bin/perl -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -bugreport -verbose=0
*** root mode: changing the files ownership to 'nobody' (99:99)
*** testing whether 'nobody' is able to -rwx /root/modperl-2.0/t
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun
-e 'eval { Apache::TestRun::run_root_fs_test(99, 99,
q[/root/modperl-2.0/t]) }';
PS: If you want, I can send you the error_log.
no, no, it has nothing to do with the error_log, Can I see what you get when
running:
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
-e 'eval {Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])}';
And this:
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
-e 'Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])';
I just wrapped the code that you have confirmed to be working into a
subroutine Apache::TestRun::run_root_fs_test. This was done because not all
shells can accept very long input.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] mod_perl test suite fails
On Mon, 2003-12-15 at 10:29, Stas Bekman wrote:
> no, no, it has nothing to do with the error_log, Can I see what you get when
> running:
>
> /usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
> -e 'eval {Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])}';
OK
>
> And this:
>
> /usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
> -e 'Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])';
OK
Regards
Volker
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
[mp2] src/modules/perl/modperl_mgv.c
With the current mp2 sources, a couple of variables in
modperl_mgv.c need to be declared earlier for Win32:
Index: src/modules/perl/modperl_mgv.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v
retrieving revision 1.28
diff -u -r1.28 modperl_mgv.c
--- src/modules/perl/modperl_mgv.c 15 Dec 2003 03:13:36 - 1.28
+++ src/modules/perl/modperl_mgv.c 15 Dec 2003 15:41:29 -
@@ -185,9 +185,9 @@
static void package2filename(apr_pool_t *p, const char *package,
char **filename, int *len)
{
-*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
const char *s;
char *d;
+*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
for (s = package, d = *filename; *s; s++, d++) {
if (*s == ':' && s[1] == ':') {
--
best regards,
randy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] apr/finfo test 10 fails on Windows
On Fri, 12 Dec 2003, Steve Hay wrote: > I've just run the mp2 testsuite using the latest CVS version and got one > test failure: > > = > >perl t/TEST -verbose apr/finfo.t > [...] > # Running under perl version 5.008002 for MSWin32 > # Current time local: Fri Dec 12 17:36:14 2003 > # Current time GMT: Fri Dec 12 17:36:14 2003 > # Using Test.pm version 1.24 > [...] > # testing : $r->finfo->atime() > # expected: 1071249888 > # received: 1071250580 > not ok 10 > [...] > FAILED test 10 > Failed 1/17 tests, 94.12% okay (less 6 skipped tests: 10 okay, > 58.82%) > Failed Test Stat Wstat Total Fail Failed List of Failed > --- > apr/finfo.t 171 5.88% 10 > 6 subtests skipped. > = > > Nothing relevant appears in the error log. > > Versions: WinXP, MSVC6, perl-5.8.2, apache-2.0.48, mod_perl-cvs I've just tried it too, with the latest mp2 cvs, and don't see this failure ... Does it still fail? The only difference between my system and yours is I'm using the perl-5.8.1 sources of ActivePerl build 807 - could this make a difference? -- best regards, randy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[mp2] finding apxs on Win32
In lib/Apache/Build.pm, some tries are made to find
apxs and apr-config, and success is tested using -x $try.
For this test to succeed on Win32 a .bat extension is
needed. The following diff:
===
Index: lib/Apache/Build.pm
===
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.151
diff -u -r1.151 Build.pm
--- lib/Apache/Build.pm 15 Dec 2003 05:29:35 - 1.151
+++ lib/Apache/Build.pm 15 Dec 2003 16:32:53 -
@@ -102,7 +102,8 @@
my $apxs;
my @trys = ($Apache::Build::APXS,
$self->{MP_APXS},
-$ENV{MP_APXS});
+$ENV{MP_APXS},
+catfile $self->{MP_AP_PREFIX}, 'bin', 'apxs');
unless (IS_MOD_PERL_BUILD) {
#if we are building mod_perl via apxs, apxs should already be known
@@ -114,8 +115,10 @@
'/usr/local/apache/bin/apxs';
}
-for (@trys) {
-next unless ($apxs = $_);
+my $ext = WIN32 ? '.bat' : '';
+for my $try (@trys) {
+$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
+next unless ($apxs = $try);
chomp $apxs;
last if -x $apxs;
}
@@ -831,8 +834,10 @@
if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
}
+my $ext = WIN32 ? '.bat' : '';
for (@tries) {
my $try = catfile $_, "apr-config";
+$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
next unless -x $try;
$self->{apr_config_path} = $try;
}
adds this extension for Win32, if it's not already present.
It also, in trying to find apxs, searches for
MP_AP_PREFIX/bin/apxs.
--
best regards,
randy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
[mp2] mod_perl.pm abstract
It might be convenient to add an abstract and name
for lib/mod_perl.pm in a pod section, for search.cpan.org
and perhaps some other tools (eg, in generating a ppm
package). This diff:
=
Index: Makefile.PL
===
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.133
diff -u -r1.133 Makefile.PL
--- Makefile.PL 12 Dec 2003 07:14:40 - 1.133
+++ Makefile.PL 15 Dec 2003 16:46:22 -
@@ -64,6 +64,7 @@
ModPerl::BuildMM::WriteMakefile(
NAME => 'mod_perl',
VERSION => $VERSION,
+ABSTRACT_FROM => 'lib/mod_perl.pm',
EXE_FILES => [EMAIL PROTECTED],
DEFINE=> get_DEFINE(),
macro => {
Index: lib/mod_perl.pm
===
RCS file: /home/cvs/modperl-2.0/lib/mod_perl.pm,v
retrieving revision 1.12
diff -u -r1.12 mod_perl.pm
--- lib/mod_perl.pm 10 Nov 2003 21:11:53 - 1.12
+++ lib/mod_perl.pm 15 Dec 2003 16:46:22 -
@@ -9,3 +9,8 @@
1;
__END__
+
+=head1 NAME
+
+mod_perl - Embed a Perl interpreter in the Apache/2.x HTTP server
+
===
does this, as well as adding an ABSTRACT_FROM attribute
for WriteMakefile.
--
best regards,
randy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] apr/finfo test 10 fails on Windows
Randy Kobes wrote:
>On Fri, 12 Dec 2003, Steve Hay wrote:
>
>
>
>>I've just run the mp2 testsuite using the latest CVS version and got one
>>test failure:
>>
>>=
>> >perl t/TEST -verbose apr/finfo.t
>>[...]
>># Running under perl version 5.008002 for MSWin32
>># Current time local: Fri Dec 12 17:36:14 2003
>># Current time GMT: Fri Dec 12 17:36:14 2003
>># Using Test.pm version 1.24
>>[...]
>># testing : $r->finfo->atime()
>># expected: 1071249888
>># received: 1071250580
>>not ok 10
>>[...]
>>FAILED test 10
>>Failed 1/17 tests, 94.12% okay (less 6 skipped tests: 10 okay,
>>58.82%)
>>Failed Test Stat Wstat Total Fail Failed List of Failed
>>---
>>apr/finfo.t 171 5.88% 10
>>6 subtests skipped.
>>=
>>
>>Nothing relevant appears in the error log.
>>
>>Versions: WinXP, MSVC6, perl-5.8.2, apache-2.0.48, mod_perl-cvs
>>
>>
>
>I've just tried it too, with the latest mp2 cvs, and don't
>see this failure ... Does it still fail? The only difference
>between my system and yours is I'm using the perl-5.8.1
>sources of ActivePerl build 807 - could this make a
>difference?
>
>
I just retested with the cvs version that I grabbed last Friday and
found that it worked, but only once: thereafter it fails again!
More testing shows that if I "touch" the file that it is stat()'ing
(t/htdocs/index.html) to give it file times of >1 hour ago then the
offending test works, but any repeat tests immediately after that fail
again:
C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[OK]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
...
C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[OK]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t
[Fails test 10]
...
Bizarre! Do you observe this behaviour? If not, then I'll give
ActivePerl 807 a try myself.
I get the same thing happening with the latest cvs which I've just
grabbed (with your patch for modperl_mgv.c).
An obvious "fix" is to utime() the file in question to set the file
times to >1 hour ago:
=
--- t/response/TestAPR/finfo.pm.orig2003-12-01 19:16:51.0 +
+++ t/response/TestAPR/finfo.pm2003-12-15 16:52:38.000161500 +
@@ -42,6 +42,10 @@
my $file = Apache->server_root_relative(catfile qw(htdocs index.html));
+# make the file times >1 hour ago so that the tests work on Win32 (!)
+my $then = time - (61 * 60);
+utime $then, $then, $file;
+
# stat tests
{
# populate the finfo struct first
=
This works for me, but it's very strange. I wonder what the real
problem is?
- Steve
Radan Computational Ltd.
The information contained in this message and any files transmitted with it are
confidential and intended for the addressee(s) only. If you have received this
message in error or there are any problems, please notify the sender immediately. The
unauthorized use, disclosure, copying or alteration of this message is strictly
forbidden. Note that any views or opinions presented in this email are solely those
of the author and do not necessarily represent those of Radan Computational Ltd. The
recipient(s) of this message should check it and any attached files for viruses: Radan
Computational will accept no liability for any damage caused by any virus transmitted
by this email.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] apr/finfo test 10 fails on Windows
On Mon, 15 Dec 2003, Steve Hay wrote: > I just retested with the cvs version that I grabbed last Friday and > found that it worked, but only once: thereafter it fails again! > > More testing shows that if I "touch" the file that it is stat()'ing > (t/htdocs/index.html) to give it file times of >1 hour ago then the > offending test works, but any repeat tests immediately after that fail > again: > > C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [OK] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > ... > C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [OK] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t > [Fails test 10] > ... > > Bizarre! Do you observe this behaviour? If not, then I'll give > ActivePerl 807 a try myself. No, I don't see this, even running 3 tests in a row like this, and even if I edit the file so as to give it a new modification time ... You're right - that's very strange! After you run the test, does the file modification time of index.html change? > I get the same thing happening with the latest cvs which I've just > grabbed (with your patch for modperl_mgv.c). > > An obvious "fix" is to utime() the file in question to set the file > times to >1 hour ago: I've heard, but I forget in what context, problems with file times less than 1 hour on Win32, so this does ring a bell .. -- best regards, randy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] finding apxs on Win32
Randy Kobes wrote: >In lib/Apache/Build.pm, some tries are made to find >apxs and apr-config, and success is tested using -x $try. >For this test to succeed on Win32 a .bat extension is >needed. The following diff: > Works for me -- I now have the apr-ext/uuid being run for the first time. (And it passes.) Thanks, Randy! - Steve Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] apr/finfo test 10 fails on Windows
Randy Kobes wrote: >On Mon, 15 Dec 2003, Steve Hay wrote: > > > >>I just retested with the cvs version that I grabbed last Friday and >>found that it worked, but only once: thereafter it fails again! >> >>More testing shows that if I "touch" the file that it is stat()'ing >>(t/htdocs/index.html) to give it file times of >1 hour ago then the >>offending test works, but any repeat tests immediately after that fail >>again: >> >>C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[OK] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>... >>C:\Temp\modperl-2.0>\cygwin\bin\touch 12151545 t/htdocs/index.html >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[OK] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>C:\Temp\modperl-2.0>perl t/TEST -verbose apr/finfo.t >>[Fails test 10] >>... >> >>Bizarre! Do you observe this behaviour? If not, then I'll give >>ActivePerl 807 a try myself. >> >> > >No, I don't see this, even running 3 tests in a row like >this, and even if I edit the file so as to give it a new >modification time ... You're right - that's very strange! > >After you run the test, does the file modification time of >index.html change? > No (well, not unless I've changed it with touch or utime() ;) > > > >>I get the same thing happening with the latest cvs which I've just >>grabbed (with your patch for modperl_mgv.c). >> >>An obvious "fix" is to utime() the file in question to set the file >>times to >1 hour ago: >> >> > >I've heard, but I forget in what context, problems with file >times less than 1 hour on Win32, so this does ring a bell .. > There are definitely problems with stat()'ing files modified in the "opposite" Daylight Saving Time "season" (Daylight Time vs Standard Time), but this file is modified today so is obviously the same season, and I'm in GMT Standard Time too, so there isn't even any Time Zone involved. The only other problem that I'm aware of is that the granularity of file times in FAT file systems is 2 seconds, but, again, that's irrelevant here as I'm on NTFS. Looks like I'll have to give ActivePerl 807 a whirl tomorrow, then. - Steve Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: modperl-2.0 Changes
On Sun, 2003-12-14 at 19:13, [EMAIL PROTECTED] wrote:
> stas2003/12/14 19:13:36
>
> Modified:src/modules/perl modperl_mgv.c
>.Changes
> Log:
> Prevent a problem where an autovivified package (stash) prevents from
> modperl_mgv to load the file with that package (until now it was
> checking whether the stash existed already and skipped the loading if
> that was the case). Now checking %INC and attempting to load the
> module. Reporting the failure only if the module has failed to load
> and the stash is not defined (so that it's possible to autovivify
> packages without loading them from an external file).
>
> Revision ChangesPath
> 1.28 +56 -12modperl-2.0/src/modules/perl/modperl_mgv.c
>
> Index: modperl_mgv.c
> ===
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v
> retrieving revision 1.27
> retrieving revision 1.28
> diff -u -u -r1.27 -r1.28
> --- modperl_mgv.c 18 Sep 2003 07:58:46 - 1.27
> +++ modperl_mgv.c 15 Dec 2003 03:13:36 - 1.28
> @@ -181,6 +181,31 @@
>}
>#endif
>
> +
> +static void package2filename(apr_pool_t *p, const char *package,
> + char **filename, int *len)
> +{
> +*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
> +const char *s;
> +char *d;
Sorry, I know how annoying this problem can be :
modperl_mgv.c: In function `package2filename':
modperl_mgv.c:189: warning: ISO C90 forbids mixed declarations and code
Reorded and checked-in!
> +for (s = package, d = *filename; *s; s++, d++) {
> +if (*s == ':' && s[1] == ':') {
> +*d = '/';
> +s++;
> +}
> +else {
> +*d = *s;
> +}
> +}
> +*d++ = '.';
> +*d++ = 'p';
> +*d++ = 'm';
> +*d = '\0';
> +
> +*len = d - *filename;
> +}
> +
>/* currently used for complex filters attributes parsing */
>/* XXX: may want to generalize it for any handlers */
>#define MODPERL_MGV_DEEP_RESOLVE(handler, p) \
> @@ -259,23 +284,42 @@
>}
>}
>
> -if (!(stash || (stash = gv_stashpv(name, FALSE))) &&
> -MpHandlerAUTOLOAD(handler)) {
> -MP_TRACE_h(MP_FUNC,
> - "package %s not defined, attempting to load\n", name);
> -
> -if (modperl_require_module(aTHX_ name, FALSE)) {
> -MP_TRACE_h(MP_FUNC, "loaded %s package\n", name);
> -if (!(stash = gv_stashpv(name, FALSE))) {
> -MP_TRACE_h(MP_FUNC, "%s package still does not exist\n",
> - name);
> +if (!stash && MpHandlerAUTOLOAD(handler)) {
> +int len;
> +char *filename;
> +SV **svp;
> +
> +package2filename(p, name, &filename, &len);
> +svp = hv_fetch(GvHVn(PL_incgv), filename, len, 0);
> +
> +if (!(svp && *svp != &PL_sv_undef)) { /* not in %INC */
> +MP_TRACE_h(MP_FUNC,
> + "package %s not in %INC, attempting to load '%s'\n",
> + name, filename);
> +
> +if (modperl_require_module(aTHX_ name, FALSE)) {
> +MP_TRACE_h(MP_FUNC, "loaded %s package\n", name);
> +}
> +else {
> +MP_TRACE_h(MP_FUNC, "failed to load %s package\n", name);
>return 0;
>}
>}
>else {
> -MP_TRACE_h(MP_FUNC, "failed to load %s package\n", name);
> -return 0;
> +MP_TRACE_h(MP_FUNC, "package %s seems to be loaded\n"
> + " $INC{%s)='%s';\n",
> + name, filename, SvPV_nolen(*svp));
>}
> +}
> +
> +/* try to lookup the stash only after loading the module, to avoid
> + * the case where a stash is autovivified by a user before the
> + * module was loaded, preventing from loading the module
> + */
> +if (!(stash || (stash = gv_stashpv(name, FALSE {
> +MP_TRACE_h(MP_FUNC, "package %s seems to be loaded, "
> + "but can't find its stash\n", name);
> +return 0;
>}
>
>if ((gv = gv_fetchmethod(stash, handler_name)) && (cv = GvCV(gv))) {
>
>
>
> 1.281 +8 -0 modperl-2.0/Changes
>
> Index: Changes
> ===
> RCS file: /home/cvs/modperl-2.0/Changes,v
> retrieving revision 1.280
> retrieving revision 1.281
> diff -u -u -r1.280 -r1.281
> --- Changes 15 Dec 2003 02:50:22 - 1.280
> +++ Changes 15 Dec 2003 03:13:36 - 1.281
> @@ -12,6 +12,14 @@
>
>=item 1.99_12-dev
>
> +Prevent a problem where an autovivified package (st
Re: [mp2] mod_perl test suite fails
Volker Kroll wrote:
On Mon, 2003-12-15 at 10:29, Stas Bekman wrote:
no, no, it has nothing to do with the error_log, Can I see what you get when
running:
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
-e 'eval {Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])}';
OK
And this:
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
-e 'Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])';
OK
That's very strange. two emails ago you said that this worked:
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=107123974823141&w=2
use File::Spec::Functions qw(catfile);
my($uid, $gid) = (getpwnam(qq[nobody]))[2..3];
$( = $) = $gid+0;
die qq[failed to change gid to $gid] if $( != $gid;
$< = $> = $uid+0;
die qq[failed to change uid to $uid] if $< != $uid;
my $dir = qq[/root];
my $file = catfile $dir, qq[.apache-test-file-$$-].time.int(rand);
END { unlink $file };
# -w
open TEST, qq[>$file] or die qq[failed to open $file: $!];
# -x
-f $file or die qq[$file cannot be looked up];
close TEST;
# -r
opendir DIR, $dir or die qq[failed to open dir $dir: $!];
defined readdir DIR or die qq[failed to read dir $dir: $!];
close DIR;
# all tests passed
print q{OK};
and started it out of a file.
I got:
failed to open /root/.apache-test-file-8981-10712397220: Permission
denied at test line 11.
Can you please look at run_root_fs_test()
in Apache/TestRun.pm and see what went wrong in transition? It should die with
the same error as above.
You can modify the sub and test your changes, by running:
/usr/bin/perl -Mlib=/root/modperl-2.0/Apache-Test/lib -MApache::TestRun \
-e 'Apache::TestRun::run_root_fs_test(99, 99, q[/root/modperl-2.0/t])';
Thank you.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] src/modules/perl/modperl_mgv.c
Randy Kobes wrote:
With the current mp2 sources, a couple of variables in
modperl_mgv.c need to be declared earlier for Win32:
Index: src/modules/perl/modperl_mgv.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v
retrieving revision 1.28
diff -u -r1.28 modperl_mgv.c
--- src/modules/perl/modperl_mgv.c 15 Dec 2003 03:13:36 - 1.28
+++ src/modules/perl/modperl_mgv.c 15 Dec 2003 15:41:29 -
@@ -185,9 +185,9 @@
static void package2filename(apr_pool_t *p, const char *package,
char **filename, int *len)
{
-*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
const char *s;
char *d;
+*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
for (s = package, d = *filename; *s; s++, d++) {
if (*s == ':' && s[1] == ':') {
Thanks Randy, Philippe has committed this one already. In the future just go
ahead and commit this kind of things.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: modperl-2.0 Changes
Philippe M. Chiasson wrote:
+static void package2filename(apr_pool_t *p, const char *package,
+ char **filename, int *len)
+{
+*filename = apr_palloc(p, (strlen(package)+4)*sizeof(char));
+const char *s;
+char *d;
Sorry, I know how annoying this problem can be :
modperl_mgv.c: In function `package2filename':
modperl_mgv.c:189: warning: ISO C90 forbids mixed declarations and code
Reorded and checked-in!
Thanks Philippe,
I'm still waiting for the Mandrake gcc release which supports the new flag:
-Wdeclaration-after-statement, introduced about 6 months ago :(
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Patch mp2] #2 PerlSections namespace
On Thu, 2003-12-11 at 15:49, Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> > Following this discussion:
> > http://marc.theaimsgroup.com/?t=10710004043&r=1&w=2
> >
> > I've made a few adjustements and cleanups.
> >
> > The following patch adds ModPerl::Util::file2package() to build a safe
> > package from a pathname or filename.
>
> Do you think we should really expose it in the public API? package2filename is
> clear and generic, but file2package does a few assumptions that might not be
> suitable to users. Do you think it'll really speed up registry? If not I'd
> keep it as an internal util function.
After some thinking, I've come to agree with your opinion on this one.
It's easy to expose too many things, and you end up with a big
commitment to a big API. And in this case, there is so little to gain
from it.
> > This is in turn used by sections to put each block in it's own
> > namespace.
> >
> > Configuration data placed in Apache::ReadConfig:: directly is processed
> > after the end of each blocks to preserve current behaviour.
> > Should be marked as deprecated as soon as users can feed their own
> > configuration to Apache::PerlSections (not possible quite yet)
>
> I'd deprecate it for a few releases to let people time to make the transition
> and then completely drop the support (at the latest by 2.0 release).
I'll work up a patch that will warn if Apache::ReadConfig:: is used
directly. How does that sound?
"[warn] Direct usage of %Apache::ReadConfig:: is deprecated"
But for this to be any use, I'd also implement the alternatives to
add_config() we discussed last week (add_hash, add_namespace, add_glob,
etc)
> > How about this?
>
> haven't tested, but conceptually looks good.
>
> > Index: src/modules/perl/modperl_cmd.c
>
> > +namespace = modperl_file2package(p, parms->directive->filename);
> > +
> > +package_name = apr_psprintf(p, "%s::%s::line_%d",
> > +package_name,
> ^
> > +namespace,
> > +parms->directive->line_num);
>
> can this be a different name? It doesn't feel very good when you use
> 'package_name' to create 'package_name', e.g. call the component as
> package_base_name?
noted!
> > +#define MP_VALID_PATH_DELIM(c) ((c) == '/' || (c) =='\\')
>
> is it always '\\'? couldn't it be ""?
Just stripping any occurences of those, so becomes __, that's all.
> > +char *modperl_file2package(apr_pool_t *p, const char *file)
> > +{
> > +char *package;
> > +char *c;
> > +const char *f;
> > +int len = strlen(file)+1;
> > +
> > +/* First, skip invalid prefix characters */
> > +while (!MP_VALID_PKG_CHAR(*file)) {
> > +file++;
> > +len--;
> > +}
> > +
> > +/* Then figure out how big the package name will be like */
> > +for(f = file; *f; f++) {
> > +if (MP_VALID_PATH_DELIM(*f)) {
> > +len++;
> > +}
> > +}
> > +
> > +package = apr_pcalloc(p, len);
> > +
> > +/* Then, replace bad characters with '_' */
> > +for (c = package; *file; c++, file++) {
> > +if (MP_VALID_PKG_CHAR(*file)) {
> > +*c = *file;
> > +}
> > +else if (MP_VALID_PATH_DELIM(*file)) {
> > +
> > +/* Eliminate subsequent duplicate path delim */
> > +while (*(file+1) && MP_VALID_PATH_DELIM(*(file+1))) {
> > +file++;
> > +}
> > +
> > +/* path delim not until end of line */
> > +if (*(file+1)) {
> > +*c = *(c+1) = ':';
> > +c++;
> > +}
> > +}
> > +else {
> > +*c = '_';
> > +}
> > +}
>
> ayi, why does it look so much simpler in perl:
>
> # Escape everything into valid perl identifiers
> $package =~ s/([^A-Za-z0-9_])/sprintf("_%2x", unpack("C", $1))/eg;
>
> # make sure that the sub-package doesn't start with a digit
> $package =~ s/^(\d)/_$1/;
Because perl rocks!
> can't we mirror this 1:1 with much simpler code?
Wish we could, but I don't think I'd feel good about calling back into
perl-land from perldo just for this.
> [...]
>
> kudos on docs and tests!
Working up on the next patch, and already checked in the small doc patch
to ModPerl::Util without filename2package
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Re: [mp2] finding apxs on Win32
Randy Kobes wrote:
In lib/Apache/Build.pm, some tries are made to find
apxs and apr-config, and success is tested using -x $try.
For this test to succeed on Win32 a .bat extension is
needed. The following diff:
===
Index: lib/Apache/Build.pm
===
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.151
diff -u -r1.151 Build.pm
--- lib/Apache/Build.pm 15 Dec 2003 05:29:35 - 1.151
+++ lib/Apache/Build.pm 15 Dec 2003 16:32:53 -
@@ -102,7 +102,8 @@
my $apxs;
my @trys = ($Apache::Build::APXS,
$self->{MP_APXS},
-$ENV{MP_APXS});
+$ENV{MP_APXS},
+catfile $self->{MP_AP_PREFIX}, 'bin', 'apxs');
could this be committed separately? Since it's a different change...
unless (IS_MOD_PERL_BUILD) {
#if we are building mod_perl via apxs, apxs should already be known
@@ -114,8 +115,10 @@
'/usr/local/apache/bin/apxs';
}
-for (@trys) {
-next unless ($apxs = $_);
+my $ext = WIN32 ? '.bat' : '';
+for my $try (@trys) {
+$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
+next unless ($apxs = $try);
$ext is well defined ('.bat' : ''), why would you check if it's defined? I'd say:
$try .= $ext if $try and $try !~ /$ext$/;
chomp $apxs;
last if -x $apxs;
}
@@ -831,8 +834,10 @@
if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
}
+my $ext = WIN32 ? '.bat' : '';
for (@tries) {
my $try = catfile $_, "apr-config";
+$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
here $try is also well defined (catfile), so all you need is:
$try .= $ext if $try !~ /$ext$/;
next unless -x $try;
$self->{apr_config_path} = $try;
now, in both cases why not adjust the code that fills @tries in? which should
be as simple as:
if (WIN32) {
my $ext = ".bat";
@tries = map { $_ . $ext unless $_ =~ /$ext$/} @tries;
}
This is untested.
But you don't have to change the code that does the actual testing, which
keeps it simple and it's easy to see that WIN32 has a special case, instead of
messing with the end code.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2] mod_perl.pm abstract
Randy Kobes wrote:
It might be convenient to add an abstract and name
for lib/mod_perl.pm in a pod section, for search.cpan.org
and perhaps some other tools (eg, in generating a ppm
package). This diff:
=
Index: Makefile.PL
===
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.133
diff -u -r1.133 Makefile.PL
--- Makefile.PL 12 Dec 2003 07:14:40 - 1.133
+++ Makefile.PL 15 Dec 2003 16:46:22 -
@@ -64,6 +64,7 @@
ModPerl::BuildMM::WriteMakefile(
NAME => 'mod_perl',
VERSION => $VERSION,
+ABSTRACT_FROM => 'lib/mod_perl.pm',
EXE_FILES => [EMAIL PROTECTED],
DEFINE=> get_DEFINE(),
macro => {
I'd realign the rest of the keys to keep it neat ;)
Index: lib/mod_perl.pm
===
RCS file: /home/cvs/modperl-2.0/lib/mod_perl.pm,v
retrieving revision 1.12
diff -u -r1.12 mod_perl.pm
--- lib/mod_perl.pm 10 Nov 2003 21:11:53 - 1.12
+++ lib/mod_perl.pm 15 Dec 2003 16:46:22 -
@@ -9,3 +9,8 @@
1;
__END__
+
+=head1 NAME
+
+mod_perl - Embed a Perl interpreter in the Apache/2.x HTTP server
+
===
does this, as well as adding an ABSTRACT_FROM attribute
for WriteMakefile.
Hehe, felt like deja vu ;)
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=10205111651&w=2
The whole thread is here:
http://marc.theaimsgroup.com/?t=10299885072&r=1&w=2
I can't remember why wasn't it applied back then. I think I was planning to
add docs/api/mod_perl.pod... but please go ahead and commit it.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: rfc: ModPerl::ModuleSetup
Geoffrey Young wrote:
Here is Makefile.PL from Apache-Peek, most of which should be moved to
that module. I'm talking about functions:
satisfy_mp_generation;
satisfy_perl_generation;
wanted_mp_generation;
the outer functions look ok. I'd leave satsify_perl_generation for the
users themselves, at least in it's current state.
Thanks Geoff,
So the remaining issue is where to put this module. As I suggested before it
shouldn't go into Apache2/ but to the normal @INC. So that Makefile.PL can
find it without trying to load Apache2, for mod_perl 1.x modules.
Since it'll be distributed with mp2, users who have no mp2 won't have it and I
think it's fine. So the 3rd party module author can do:
eval { require ModPerl::ModuleSetup }
and if that has failed then the user has only mp1 installed and so should
Makefile.PL proceed with the build against mp1, otherwise if successful use
satisfy_mp_generation to figure out which version to build against.
We might release it on CPAN too or/and bundle with mp1 as well later on.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: modperl-2.0 Changes
On Sun, 2003-12-14 at 21:38, Stas Bekman wrote:
> [EMAIL PROTECTED] wrote:
> > stas2003/12/14 21:29:35
> >
> > Modified:lib/ModPerl BuildOptions.pm
> >lib/Apache Build.pm
> >.Changes
> > Log:
> > libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched
> > using the gnome packaging tools if available (pkg-config for gnome-2.x
> > and gnome-config for gnome-1.x)
>
> Philippe, can you please check that the old default config ldopts addition is
> still working? I couldn't test it on my setup, which doesn't install libgtop
> into the global /usr/lib or ldconfig cache dirs). Thanks.
Sure, I'll give it a shot, but can you please remind what the "old
default config ldopts" stuff is ? It's been a while since I last played
with gtop.
Thanks!
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
--
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
signature.asc
Description: This is a digitally signed message part
Re: [mp2] finding apxs on Win32
On Mon, 15 Dec 2003, Stas Bekman wrote:
> Randy Kobes wrote:
> > In lib/Apache/Build.pm, some tries are made to find
> > apxs and apr-config, and success is tested using -x $try.
> > For this test to succeed on Win32 a .bat extension is
> > needed. The following diff:
> > ===
> > Index: lib/Apache/Build.pm
> > ===
> > RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
> > retrieving revision 1.151
> > diff -u -r1.151 Build.pm
> > --- lib/Apache/Build.pm 15 Dec 2003 05:29:35 - 1.151
> > +++ lib/Apache/Build.pm 15 Dec 2003 16:32:53 -
> > @@ -102,7 +102,8 @@
> > my $apxs;
> > my @trys = ($Apache::Build::APXS,
> > $self->{MP_APXS},
> > -$ENV{MP_APXS});
> > +$ENV{MP_APXS},
> > +catfile $self->{MP_AP_PREFIX}, 'bin', 'apxs');
>
> could this be committed separately? Since it's a different change...
OK, I'll do that
> > unless (IS_MOD_PERL_BUILD) {
> > #if we are building mod_perl via apxs, apxs should already be known
> > @@ -114,8 +115,10 @@
> > '/usr/local/apache/bin/apxs';
> > }
> >
> > -for (@trys) {
> > -next unless ($apxs = $_);
> > +my $ext = WIN32 ? '.bat' : '';
> > +for my $try (@trys) {
> > +$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
> > +next unless ($apxs = $try);
>
> $ext is well defined ('.bat' : ''), why would you check if it's defined? I'd say:
>
> $try .= $ext if $try and $try !~ /$ext$/;
>
> > chomp $apxs;
> > last if -x $apxs;
> > }
> > @@ -831,8 +834,10 @@
> > if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
> > }
> >
> > +my $ext = WIN32 ? '.bat' : '';
> > for (@tries) {
> > my $try = catfile $_, "apr-config";
> > +$try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
>
> here $try is also well defined (catfile), so all you need is:
>
>$try .= $ext if $try !~ /$ext$/;
>
> > next unless -x $try;
> > $self->{apr_config_path} = $try;
>
> now, in both cases why not adjust the code that fills @tries in? which should
> be as simple as:
>
> if (WIN32) {
> my $ext = ".bat";
> @tries = map { $_ . $ext unless $_ =~ /$ext$/} @tries;
> }
>
> This is untested.
>
> But you don't have to change the code that does the actual
> testing, which keeps it simple and it's easy to see that
> WIN32 has a special case, instead of messing with the end
> code.
That's a better approach - thanks! I'll look into doing
that tonight.
--
best regards,
randy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: modperl-2.0 Changes
Philippe M. Chiasson wrote: On Sun, 2003-12-14 at 21:38, Stas Bekman wrote: [EMAIL PROTECTED] wrote: stas2003/12/14 21:29:35 Modified:lib/ModPerl BuildOptions.pm lib/Apache Build.pm .Changes Log: libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched using the gnome packaging tools if available (pkg-config for gnome-2.x and gnome-config for gnome-1.x) Philippe, can you please check that the old default config ldopts addition is still working? I couldn't test it on my setup, which doesn't install libgtop into the global /usr/lib or ldconfig cache dirs). Thanks. Sure, I'll give it a shot, but can you please remind what the "old default config ldopts" stuff is ? It's been a while since I last played with gtop. libgtop could be installed into the standard dirs like /usr/lib or /usr/local/lib. Until now you could use gtop with mp2 only if that was the case. And only if you had libgtop1. If you had libgtop2 and/or it was installed elsewhere Apache::Build was not able to find it. Now it uses pkg-config for gnome-2.x and gnome-config for gnome-1.x if available to find all the info about libgtop (ldopts and ccopts). If not found it uses the hardcoded default as before. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Patch mp2] #2 PerlSections namespace
Philippe M. Chiasson wrote:
On Thu, 2003-12-11 at 15:49, Stas Bekman wrote:
Philippe M. Chiasson wrote:
Following this discussion:
http://marc.theaimsgroup.com/?t=10710004043&r=1&w=2
I've made a few adjustements and cleanups.
The following patch adds ModPerl::Util::file2package() to build a safe
package from a pathname or filename.
Do you think we should really expose it in the public API? package2filename is
clear and generic, but file2package does a few assumptions that might not be
suitable to users. Do you think it'll really speed up registry? If not I'd
keep it as an internal util function.
After some thinking, I've come to agree with your opinion on this one.
It's easy to expose too many things, and you end up with a big
commitment to a big API. And in this case, there is so little to gain
from it.
good ;)
This is in turn used by sections to put each block in it's own
namespace.
Configuration data placed in Apache::ReadConfig:: directly is processed
after the end of each blocks to preserve current behaviour.
Should be marked as deprecated as soon as users can feed their own
configuration to Apache::PerlSections (not possible quite yet)
I'd deprecate it for a few releases to let people time to make the transition
and then completely drop the support (at the latest by 2.0 release).
I'll work up a patch that will warn if Apache::ReadConfig:: is used
directly. How does that sound?
"[warn] Direct usage of %Apache::ReadConfig:: is deprecated"
But for this to be any use, I'd also implement the alternatives to
add_config() we discussed last week (add_hash, add_namespace, add_glob,
etc)
+1
ayi, why does it look so much simpler in perl:
# Escape everything into valid perl identifiers
$package =~ s/([^A-Za-z0-9_])/sprintf("_%2x", unpack("C", $1))/eg;
# make sure that the sub-package doesn't start with a digit
$package =~ s/^(\d)/_$1/;
Because perl rocks!
can't we mirror this 1:1 with much simpler code?
Wish we could, but I don't think I'd feel good about calling back into
perl-land from perldo just for this.
I didn't suggest to eval_pv into perl, just asking whether we can do the above
in C in the same way?
kudos on docs and tests!
Working up on the next patch, and already checked in the small doc patch
to ModPerl::Util without filename2package
gozer++
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
[Patch mp2] #3 PerlSections namespace
After making the small changes we discussed, here is a simpler version
of the original namespace patch, without exposing it thru
ModPerl::Util and a few style tweaks as per stas's recommendations.
? Doxyfile
? SIGNATURE
? dox
? foo
? perlsection.diff
? src.diff
? build/indent
? lib/C
? lib/threads
? t/modperl/util.t
Index: lib/Apache/PerlSections.pm
===
RCS file: /home/cvs/modperl-2.0/lib/Apache/PerlSections.pm,v
retrieving revision 1.1
diff -u -I$Id: -r1.1 PerlSections.pm
--- lib/Apache/PerlSections.pm 20 Oct 2003 17:44:48 - 1.1
+++ lib/Apache/PerlSections.pm 15 Dec 2003 23:13:28 -
@@ -13,6 +13,7 @@
use Apache::Const -compile => qw(OK);
use constant SPECIAL_NAME => 'PerlConfig';
+use constant SPECIAL_PACKAGE => 'Apache::ReadConfig';
sub new {
my($package, @args) = @_;
@@ -54,24 +55,28 @@
sub symdump {
my($self) = @_;
-my $pack = $self->package;
-
unless ($self->{symbols}) {
-$self->{symbols} = [];
-
no strict;
-
-#XXX: Shamelessly borrowed from Devel::Symdump;
-while (my ($key, $val) = each(%{ *{"$pack\::"} })) {
-local (*ENTRY) = $val;
-if (defined $val && defined *ENTRY{SCALAR}) {
-push @{$self->{symbols}}, [$key, $ENTRY];
-}
-if (defined $val && defined *ENTRY{ARRAY}) {
-push @{$self->{symbols}}, [$key, [EMAIL PROTECTED];
-}
-if (defined $val && defined *ENTRY{HASH} && $key !~ /::/) {
-push @{$self->{symbols}}, [$key, \%ENTRY];
+
+$self->{symbols} = [];
+
+#XXX: Here would be a good place to warn about NOT using
+# Apache::ReadConfig:: directly in sections
+foreach my $pack ($self->package, $self->SPECIAL_PACKAGE) {
+#XXX: Shamelessly borrowed from Devel::Symdump;
+while (my ($key, $val) = each(%{ *{"$pack\::"} })) {
+#We don't want to pick up stashes...
+next if ($key =~ /::$/);
+local (*ENTRY) = $val;
+if (defined $val && defined *ENTRY{SCALAR}) {
+push @{$self->{symbols}}, [$key, $ENTRY];
+}
+if (defined $val && defined *ENTRY{ARRAY}) {
+push @{$self->{symbols}}, [$key, [EMAIL PROTECTED];
+}
+if (defined $val && defined *ENTRY{HASH} && $key !~ /::/) {
+push @{$self->{symbols}}, [$key, \%ENTRY];
+}
}
}
}
Index: src/modules/perl/modperl_cmd.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.51
diff -u -I$Id: -r1.51 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c 17 Nov 2003 01:11:06 - 1.51
+++ src/modules/perl/modperl_cmd.c 15 Dec 2003 23:13:28 -
@@ -361,8 +361,11 @@
apr_table_t *options = NULL;
const char *handler_name = NULL;
modperl_handler_t *handler = NULL;
-const char *package_name = NULL;
+const char *pkg_base = NULL;
+const char *pkg_namespace = NULL;
+const char *pkg_name = NULL;
const char *line_header = NULL;
+ap_directive_t *directive = parms->directive;
int status = OK;
AV *args = Nullav;
SV *dollar_zero = Nullsv;
@@ -397,17 +400,25 @@
handler = modperl_handler_new(p, handler_name);
-if (!(package_name = apr_table_get(options, "package"))) {
-package_name = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_PACKAGE);
-apr_table_set(options, "package", package_name);
+if (!(pkg_base = apr_table_get(options, "package"))) {
+pkg_base = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_PACKAGE);
}
+
+pkg_namespace = modperl_file2package(p, directive->filename);
+
+pkg_name = apr_psprintf(p, "%s::%s::line_%d",
+pkg_base,
+pkg_namespace,
+directive->line_num);
+
+apr_table_set(options, "package", pkg_name);
line_header = apr_psprintf(p, "\n#line %d %s\n",
- parms->directive->line_num,
- parms->directive->filename);
+ directive->line_num,
+ directive->filename);
/* put the code about to be executed in the configured package */
-arg = apr_pstrcat(p, "package ", package_name, ";", line_header,
+arg = apr_pstrcat(p, "package ", pkg_name, ";", line_header,
arg, NULL);
}
@@ -421,7 +432,7 @@
ENTER;
save_item(dollar_zero);
-sv_setpv(dollar_zero, parms->directive->filename);
+sv_setpv(dollar_zero, directive->filename);
eval_
Re: cvs commit: modperl-2.0 Changes
On Mon, 2003-12-15 at 12:34, Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> > On Sun, 2003-12-14 at 21:38, Stas Bekman wrote:
> >
> >>[EMAIL PROTECTED] wrote:
> >>
> >>>stas2003/12/14 21:29:35
> >>>
> >>> Modified:lib/ModPerl BuildOptions.pm
> >>> lib/Apache Build.pm
> >>> .Changes
> >>> Log:
> >>> libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched
> >>> using the gnome packaging tools if available (pkg-config for gnome-2.x
> >>> and gnome-config for gnome-1.x)
> >>
> >>Philippe, can you please check that the old default config ldopts addition is
> >>still working? I couldn't test it on my setup, which doesn't install libgtop
> >>into the global /usr/lib or ldconfig cache dirs). Thanks.
> >
> >
> > Sure, I'll give it a shot, but can you please remind what the "old
> > default config ldopts" stuff is ? It's been a while since I last played
> > with gtop.
>
> libgtop could be installed into the standard dirs like /usr/lib or
> /usr/local/lib. Until now you could use gtop with mp2 only if that was the
> case. And only if you had libgtop1. If you had libgtop2 and/or it was
> installed elsewhere Apache::Build was not able to find it. Now it uses
> pkg-config for gnome-2.x and gnome-config for gnome-1.x if available to find
> all the info about libgtop (ldopts and ccopts). If not found it uses the
> hardcoded default as before.
Yes, I just tested it and it all works fine, with or without
pkg-config/gnome-config ;-)
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
--
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
signature.asc
Description: This is a digitally signed message part
Re: cvs commit: modperl-2.0 Changes
Philippe M. Chiasson wrote: On Mon, 2003-12-15 at 12:34, Stas Bekman wrote: Philippe M. Chiasson wrote: On Sun, 2003-12-14 at 21:38, Stas Bekman wrote: [EMAIL PROTECTED] wrote: stas2003/12/14 21:29:35 Modified:lib/ModPerl BuildOptions.pm lib/Apache Build.pm .Changes Log: libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched using the gnome packaging tools if available (pkg-config for gnome-2.x and gnome-config for gnome-1.x) Philippe, can you please check that the old default config ldopts addition is still working? I couldn't test it on my setup, which doesn't install libgtop into the global /usr/lib or ldconfig cache dirs). Thanks. Sure, I'll give it a shot, but can you please remind what the "old default config ldopts" stuff is ? It's been a while since I last played with gtop. libgtop could be installed into the standard dirs like /usr/lib or /usr/local/lib. Until now you could use gtop with mp2 only if that was the case. And only if you had libgtop1. If you had libgtop2 and/or it was installed elsewhere Apache::Build was not able to find it. Now it uses pkg-config for gnome-2.x and gnome-config for gnome-1.x if available to find all the info about libgtop (ldopts and ccopts). If not found it uses the hardcoded default as before. Yes, I just tested it and it all works fine, with or without pkg-config/gnome-config ;-) Great, thanks! __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [mp2 patch] introducing Apache::compat "scoping"
On Sun, 2003-12-14 at 18:33, Stas Bekman wrote:
> The following is yet another attempt to avoid collisions between
> Apache::compat and the real mp2 APIs.
That is indeed an annoying problem.
> Similar to 'use' and 'no' pragma, I'm suggesting to introduce the new
> functions override_mp2_api and restore_mp2_api for those APIs in
> Apache::compat that collide with 2.0 API. The only difference is that one
> needs an explicit call to restore_mp2_api, which I suppose could be done by
> returning an object, which if made a lexically scoped will call
> restore_mp2_api on its own (i.e. DESTROY), but since it's going to be used
> very infrequently and eventually won't be needed at all, I don't see a reason
> to bother. See the compat/request test change for an example in the patch below.
>
> I decided not to use the import() method, but have an explicit function call,
> since import() may make some people think that it imports the overriden
> methods, which it doesn't.
I would probably prefer to use import() just to make things as easy as
possible for the potential users of Apache::compat(), but as long as
it's documented, I don't think I'd mind much.
> I think there are only two functions at the moment that collide with mp2 API:
> Apache::RequestRec::notes and Apache::RequestRec::finfo. There is also
> APR::URI::unparse, which introduces a special case but I think it's harmless.
>
> in June I posted an implementation for 2 more colliding functions:
> Apache::Connection::local_addr
> Apache::Connection::remote_addr
> http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=105452446932154&w=2
> which I will now be able to commit using this new functionality.
>
> The cool thing is that we can introduce a sub-class of Registry which will do
> the wrapping into a handler like so:
Coolness indeed !
> 'sub handler {' .
> 'Apache::compat::override_mp2_api('Apache::RequestRec::notes');' .
>$code .
> 'Apache::compat::restore_mp2_api('Apache::RequestRec::notes');' .
> '}';
>
> or something like that (overriding other subs as well).
>
> Here is the patch:
>
> Index: lib/Apache/compat.pm
> ===
> RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
> retrieving revision 1.90
> diff -u -r1.90 compat.pm
> --- lib/Apache/compat.pm 19 Nov 2003 19:30:11 - 1.90
> +++ lib/Apache/compat.pm 15 Dec 2003 02:02:10 -
> @@ -50,6 +50,86 @@
> $INC{'Apache/Table.pm'} = __FILE__;
> }
>
> +# api => "overriding code"
> +# the overriding code, needs to "return" the original CODE reference
> +# when eval'ed , so that it can be restored later
> +my %overridable_mp2_api = (
> +'Apache::RequestRec::notes' => <<'EOI',
> +{
> +require Apache::RequestRec;
> +my $notes_sub = *Apache::RequestRec::notes{CODE};
> +*Apache::RequestRec::notes = sub {
> +my $r = shift;
> +return wantarray()
> +? ($r->table_get_set(scalar($r->$notes_sub), @_))
> +: scalar($r->table_get_set(scalar($r->$notes_sub), @_));
> +};
> +$notes_sub;
> +}
> +EOI
> +
> +'Apache::RequestRec::finfo' => <<'EOI',
> +{
> +require APR::Finfo;
> +my $finfo_sub = *APR::Finfo::finfo{CODE};
> +sub Apache::RequestRec::finfo {
> +my $r = shift;
> +stat $r->filename;
> +\*_;
> +}
> +$finfo_sub;
> +}
> +EOI
> +);
Why make this code a SCALAR, instead of creating an anonymous sub right
there?
> +my %overridden_mp2_api = ();
> +
> +# this function enables back-compatible APIs which can't coexist with
> +# mod_perl 2.0 APIs with the same name and therefore it should be
> +# avoided if possible.
> +#
> +# it expects a list of fully qualified functions, like
> +# "Apache::RequestRec::finfo"
> +sub override_mp2_api {
> +my (@subs) = @_;
> +
> +for my $sub (@subs) {
> +unless (exists $overridable_mp2_api{$sub}) {
> +die __PACKAGE__ . ": $sub is not overridable";
> +}
> +if(exists $overridden_mp2_api{$sub}) {
> +warn __PACKAGE__ . ": $sub has been already overridden";
> +next;
> +}
> +$overridden_mp2_api{$sub} = eval $overridable_mp2_api{$sub};
> +unless (exists $overridden_mp2_api{$sub} &&
> +ref($overridden_mp2_api{$sub}) eq 'CODE') {
> +die "overriding $sub didn't return a CODE ref";
> +}
> +}
> +}
> +
> +# restore_mp2_api does the opposite of override_mp2_api(), it removes
> +# the overriden API and restores the original mod_perl 2.0 API
> +sub restore_mp2_api {
> +my (@subs) = @_;
> +
> +for my $sub (@subs) {
> +unless (exists $overridable_mp2_api{$sub}) {
> +die __PACKAGE__ . ": $sub is not overridable";
> +}
> +unless (exists $overridden_mp2_api{$sub}) {
> +warn __PACKAGE__ . ": can't restore $sub, " .
> +"as it has not been overridden";
> +next;
>
Re: [mp2 patch] introducing Apache::compat "scoping"
Philippe M. Chiasson wrote:
On Sun, 2003-12-14 at 18:33, Stas Bekman wrote:
The following is yet another attempt to avoid collisions between
Apache::compat and the real mp2 APIs.
That is indeed an annoying problem.
Similar to 'use' and 'no' pragma, I'm suggesting to introduce the new
functions override_mp2_api and restore_mp2_api for those APIs in
Apache::compat that collide with 2.0 API. The only difference is that one
needs an explicit call to restore_mp2_api, which I suppose could be done by
returning an object, which if made a lexically scoped will call
restore_mp2_api on its own (i.e. DESTROY), but since it's going to be used
very infrequently and eventually won't be needed at all, I don't see a reason
to bother. See the compat/request test change for an example in the patch below.
I decided not to use the import() method, but have an explicit function call,
since import() may make some people think that it imports the overriden
methods, which it doesn't.
I would probably prefer to use import() just to make things as easy as
possible for the potential users of Apache::compat(), but as long as
it's documented, I don't think I'd mind much.
You shouldn't need to use this function at all ;)
I prefer not to call it import, because it explicitly says override_mp2_api
'sub handler {' .
'Apache::compat::override_mp2_api('Apache::RequestRec::notes');' .
$code .
'Apache::compat::restore_mp2_api('Apache::RequestRec::notes');' .
'}';
or something like that (overriding other subs as well).
Here is the patch:
Index: lib/Apache/compat.pm
===
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.90
diff -u -r1.90 compat.pm
--- lib/Apache/compat.pm19 Nov 2003 19:30:11 - 1.90
+++ lib/Apache/compat.pm15 Dec 2003 02:02:10 -
@@ -50,6 +50,86 @@
$INC{'Apache/Table.pm'} = __FILE__;
}
+# api => "overriding code"
+# the overriding code, needs to "return" the original CODE reference
+# when eval'ed , so that it can be restored later
+my %overridable_mp2_api = (
+'Apache::RequestRec::notes' => <<'EOI',
+{
+require Apache::RequestRec;
+my $notes_sub = *Apache::RequestRec::notes{CODE};
+*Apache::RequestRec::notes = sub {
+my $r = shift;
+return wantarray()
+? ($r->table_get_set(scalar($r->$notes_sub), @_))
+: scalar($r->table_get_set(scalar($r->$notes_sub), @_));
+};
+$notes_sub;
+}
+EOI
+
+'Apache::RequestRec::finfo' => <<'EOI',
+{
+require APR::Finfo;
+my $finfo_sub = *APR::Finfo::finfo{CODE};
+sub Apache::RequestRec::finfo {
+my $r = shift;
+stat $r->filename;
+\*_;
+}
+$finfo_sub;
+}
+EOI
+);
Why make this code a SCALAR, instead of creating an anonymous sub right
there?
What do you mean?
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: mp2-1.99_12 release next week?
On Sun, 2003-12-14 at 19:26, Stas Bekman wrote:
> I'd like to make the _12 release next week. The usual plan suggestion:
> - post a release candidate on Thu-Fri
> - release on Monday
Sounds good to me!
> Unless someone else wishes to wear the RM cap, I'll do this release.
I sadly don't have enough free time right now to wear that cap.
> If you want something to go in into that release please say that asap.
I'd like at least my recursive patch to get in as a minimum.
After that one, many more smaller patches will follow, fixing
perlsections problems one at a time.
But we've had enough people being hit by that problem that I'd hope to
get the fix in the next release
> The next _13 release will probably happen somewhere at the end of January and
> will probably coincide with the release of 5.8.3 (and I hope that there will
> be no problems introduced this time, as it was with the last 3 releases 5.8.0,
> 5.8.1 and 5.8.2).
Once again, sounds good to me!
> Thanks.
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
signature.asc
Description: This is a digitally signed message part
Re: [Patch mp2] #3 PerlSections namespace
Philippe M. Chiasson wrote:
After making the small changes we discussed, here is a simpler version
of the original namespace patch, without exposing it thru
ModPerl::Util and a few style tweaks as per stas's recommendations.
[...]
Looks great! + a few indent comments ;)
Index: src/modules/perl/modperl_util.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
retrieving revision 1.58
diff -u -I$Id: -r1.58 modperl_util.c
--- src/modules/perl/modperl_util.c 25 Nov 2003 20:31:29 - 1.58
+++ src/modules/perl/modperl_util.c 15 Dec 2003 23:13:28 -
@@ -769,3 +769,53 @@
}
}
#endif
+
+#define MP_VALID_PKG_CHAR(c) (isalnum(c) ||(c) == '_')
^^
+#define MP_VALID_PATH_DELIM(c) ((c) == '/' || (c) =='\\')
^^
+/* Then figure out how big the package name will be like */
+for(f = file; *f; f++) {
^^^
Index: t/conf/extra.last.conf.in
===
[...]
+push @Apache::ReadConfig::Alias,
+['/perl_sections_readconfig', '@DocumentRoot@'];
+$Apache::ReadConfig::Location{'/perl_sections_readconfig'} = {
+ 'PerlInitHandler' => 'ModPerl::Test::add_config',
+ 'AuthType' => 'Basic',
+ 'AuthName' => 'PerlSection',
+ 'PerlAuthenHandler' => 'TestHooks::authen',
+ };
^
indent 4, and align => keys if you feel like ;)
Index: t/response/TestDirective/perldo.pm
===
[...]
+{
+no strict 'refs';
+%Location = %{$TestDirective::perl::PACKAGE . '::Location'};
+}
indent
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: mp2-1.99_12 release next week?
Philippe M. Chiasson wrote: Unless someone else wishes to wear the RM cap, I'll do this release. I sadly don't have enough free time right now to wear that cap. No problem. I can handle that. If you want something to go in into that release please say that asap. I'd like at least my recursive patch to get in as a minimum. After that one, many more smaller patches will follow, fixing perlsections problems one at a time. But we've had enough people being hit by that problem that I'd hope to get the fix in the next release Coolio! __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Patch mp2] #3 PerlSections namespace
On Mon, 2003-12-15 at 16:21, Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> > After making the small changes we discussed, here is a simpler version
> > of the original namespace patch, without exposing it thru
> > ModPerl::Util and a few style tweaks as per stas's recommendations.
> [...]
>
> Looks great! + a few indent comments ;)
>
I am obviously still having a hard time getting my whitespace right ;-(
Thank you everwatching Stas and BAD, BAD gozer ;-)
This patch I believe is proprely cleaned up. If nobody finds anything
wrong about it, I'll get it in tomorrow morning.
Have all a good day!
? lib/C
? lib/threads
Index: lib/Apache/PerlSections.pm
===
RCS file: /home/cvs/modperl-2.0/lib/Apache/PerlSections.pm,v
retrieving revision 1.1
diff -u -I$Id: -r1.1 PerlSections.pm
--- lib/Apache/PerlSections.pm 20 Oct 2003 17:44:48 - 1.1
+++ lib/Apache/PerlSections.pm 16 Dec 2003 01:15:47 -
@@ -13,6 +13,7 @@
use Apache::Const -compile => qw(OK);
use constant SPECIAL_NAME => 'PerlConfig';
+use constant SPECIAL_PACKAGE => 'Apache::ReadConfig';
sub new {
my($package, @args) = @_;
@@ -54,24 +55,28 @@
sub symdump {
my($self) = @_;
-my $pack = $self->package;
-
unless ($self->{symbols}) {
-$self->{symbols} = [];
-
no strict;
-
-#XXX: Shamelessly borrowed from Devel::Symdump;
-while (my ($key, $val) = each(%{ *{"$pack\::"} })) {
-local (*ENTRY) = $val;
-if (defined $val && defined *ENTRY{SCALAR}) {
-push @{$self->{symbols}}, [$key, $ENTRY];
-}
-if (defined $val && defined *ENTRY{ARRAY}) {
-push @{$self->{symbols}}, [$key, [EMAIL PROTECTED];
-}
-if (defined $val && defined *ENTRY{HASH} && $key !~ /::/) {
-push @{$self->{symbols}}, [$key, \%ENTRY];
+
+$self->{symbols} = [];
+
+#XXX: Here would be a good place to warn about NOT using
+# Apache::ReadConfig:: directly in sections
+foreach my $pack ($self->package, $self->SPECIAL_PACKAGE) {
+#XXX: Shamelessly borrowed from Devel::Symdump;
+while (my ($key, $val) = each(%{ *{"$pack\::"} })) {
+#We don't want to pick up stashes...
+next if ($key =~ /::$/);
+local (*ENTRY) = $val;
+if (defined $val && defined *ENTRY{SCALAR}) {
+push @{$self->{symbols}}, [$key, $ENTRY];
+}
+if (defined $val && defined *ENTRY{ARRAY}) {
+push @{$self->{symbols}}, [$key, [EMAIL PROTECTED];
+}
+if (defined $val && defined *ENTRY{HASH} && $key !~ /::/) {
+push @{$self->{symbols}}, [$key, \%ENTRY];
+}
}
}
}
Index: src/modules/perl/modperl_cmd.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.51
diff -u -I$Id: -r1.51 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c 17 Nov 2003 01:11:06 - 1.51
+++ src/modules/perl/modperl_cmd.c 16 Dec 2003 01:15:47 -
@@ -361,8 +361,11 @@
apr_table_t *options = NULL;
const char *handler_name = NULL;
modperl_handler_t *handler = NULL;
-const char *package_name = NULL;
+const char *pkg_base = NULL;
+const char *pkg_namespace = NULL;
+const char *pkg_name = NULL;
const char *line_header = NULL;
+ap_directive_t *directive = parms->directive;
int status = OK;
AV *args = Nullav;
SV *dollar_zero = Nullsv;
@@ -397,17 +400,25 @@
handler = modperl_handler_new(p, handler_name);
-if (!(package_name = apr_table_get(options, "package"))) {
-package_name = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_PACKAGE);
-apr_table_set(options, "package", package_name);
+if (!(pkg_base = apr_table_get(options, "package"))) {
+pkg_base = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_PACKAGE);
}
+
+pkg_namespace = modperl_file2package(p, directive->filename);
+
+pkg_name = apr_psprintf(p, "%s::%s::line_%d",
+pkg_base,
+pkg_namespace,
+directive->line_num);
+
+apr_table_set(options, "package", pkg_name);
line_header = apr_psprintf(p, "\n#line %d %s\n",
- parms->directive->line_num,
- parms->directive->filename);
+ directive->line_num,
+ directive->filename);
/* put the code about to be executed in the configured package */
-arg = apr_pstrcat(p, "package ", package_name, "
Re: [Patch mp2] #3 PerlSections namespace
Philippe M. Chiasson wrote: On Mon, 2003-12-15 at 16:21, Stas Bekman wrote: Philippe M. Chiasson wrote: After making the small changes we discussed, here is a simpler version of the original namespace patch, without exposing it thru ModPerl::Util and a few style tweaks as per stas's recommendations. [...] Looks great! + a few indent comments ;) I am obviously still having a hard time getting my whitespace right ;-( Thank you everwatching Stas and BAD, BAD gozer ;-) ;) This patch I believe is proprely cleaned up. If nobody finds anything wrong about it, I'll get it in tomorrow morning. looks good ;) Have all a good day! you too ;) __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: modperl-2.0/lib/Apache Build.pm
[EMAIL PROTECTED] wrote: randyk 2003/12/15 18:39:00 Modified:lib/Apache Build.pm Log: Reviewed by: stas In testing for the existence of the apxs and apr-config utilities, Win32 needs candidates to have a .bat extension for the -x file test to succeed. It's probably a good idea to log this into the Changes file. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
