On Fri, 25 May 2001, Geoffrey Young wrote:

>
>
> > -----Original Message-----
> > From: Ken Williams [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 25, 2001 11:06 AM
> > To: Geoffrey Young
> > Cc: modperl-2.0 dev-list
> > Subject: RE: Apache2:: namespace, prerequisite checking and
> > CPAN listing
> >
> [snip]
> >
> > It should be sufficient to do:
> >
> >   use mod_perl;
> >   BEGIN { die "horribly" if $mod_perl::VERSION >= 2 }
> >
> > It's very handy to remember that 'use' is just 'require' and
> > 'import' in
> > a 'BEGIN' block.

I don't think this is that simple, given that mod_perl.pm wasn't loaded
yet. BEGIN {} will take precedence and then $mod_perl::VERSION will be yet
undef. I think the really clean way to go is :

BEGIN { use mod_perl; }
BEGIN { die "horribly" if $mod_perl::VERSION >= 2 }

but then mod_perl.pm will be already loaded for all 3rd party modules. So
it'll probably will be fine anyway. Still ugly.

use mod_perl 2;
use mod_perl 1;

will be much cooler  :)

> right, but we're talking about idioms here.  I feel kinda empty sometimes
> because I can't use 'no' the same way I can use 'use' when it comes to
> versioning.  not to mention that it seems awfully snobbish (well, this is
> perl ;) to assume that the next version of something is the most important
> aspect of the software, especially as apache, mod_perl, and perl all go into
> major syntax and behavior revisions...
>
> >
> > That said, it seems like it should be easy to implement the construct
> > you originally wanted, and it would be generally useful.
>
> :)
>
> I started poking around toke.c and the pp stuff, but all of that is way
> beyond my humble abilities...

take a look at this:
http://simon-cozens.org/writings/perlhacktut.html
a cool stuff

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to