Re: getting rid of nested sub lexical problem
[EMAIL PROTECTED] wrote: > > Due to forgetfulness I was recently bitten by the infamous "my() Scoped > Variable in Nested Subroutines" problem using Apache::Registry, and it got > me thinking about whether it is fixable. > > >From the diagnostics: > This problem can usually be solved by making the inner subroutine > anonymous, using the sub {} syntax. When inner anonymous subs that > reference variables in outer subroutines are called or referenced, they > are automatically rebound to the current values of such variables. > > I think it should be possible for Registry to pre-process the source code > to turn all top-level named subroutines into sub refs. For example, > convert subroutines of the form > > sub foo { } > > into > > sub foo { &{ sub { } } } [snip] I think it would be easier to convert sub foo into local *foo = sub That way, you don't have to parse for the matching right brace. Something like: s/sub\s+(\w+)/local *\1 = sub/msg; # untested - just a guess might do the trick. -- Dan Campbell
Re: Perl as DSO...whats wrong with it, specifically?
The one trick that finally enabled me to get mod_perl to work as a DSO with IBM's WebSphere on AIX was a utility named rtl_enable. There were a few changes I had to make to one of mod_perl's makefiles (apaci/Makefile, I think) to get libperl.so to build, but even then httpd would segfault as soon as mod_perl attempted to load a perl XS module. But, now I run 'rtl_enable libperl.so', then replace libperl.so with the file that gets generated. I still have to be careful about what I put in startup.pl, but at least it works. Perl 5.005_03, mod_perl 1.24, IBM C for AIX 5.0, and WebSphere 2.02. -- Dan Campbell