On Fri Nov 15 15:02:56 2013, haarg wrote:
Show quoted text> On Fri Nov 15 13:51:11 2013, DJERIUS wrote:
> > On Fri Nov 15 13:03:55 2013, haarg wrote:
> > > On Fri Nov 15 12:36:46 2013, DJERIUS wrote:
> > > > On Thu Nov 14 07:00:17 2013, SIMONW wrote:
> > > > > I got a prototype working by looking for the presence of
> > > > > %main::fatpacked but that's obviously not a great longterm
> > > > > solution.
> > > > >
> > > > >
> > > >
> > > > Ok, here are my takes on this:
> > > >
> > > >
https://github.com/djerius/App-
> > > > FatPacker/commit/e7051d24e8b8cc6556d3e2fcdaf00a1348e4a791
> > > >
> > > >
https://github.com/djerius/Module-
> > > > Pluggable/commit/a92be511035f6479fe5d8ff93277060150ac8e4e
> > > >
> > > > It shoves an object into @INC rather than a subroutine ref.
> > > >
> > > > I prefer this solution as it's based upon behavior (whether the
> > > > @INC
> > > > hook provides a method) rather than by name.
> > > >
> > > > That way we can define an API and it'll be completely independent
> > > > of
> > > > knowing who is doing what.
> > >
> > > This will need some slight adjustment to work in perl 5.6. It
> > > should
> > > just be a matter of moving the version check inside the INC sub,
> > > returning the sub rather than the filehandle.
> >
> > Is there some subtlety I'm missing? We already know which version of
> > perl is running prior to defining the INC sub; the code returns a sub
> > if $] < 5.008, the object otherwise. So < 5.008 can never see a
> > filehandle. If the object is in play, we already know we're >=
> > 5.008,
> > so it can return the filehandle.
> >
> > Or...?
>
> The 5.6 code should also use an object. The only difference should be
> in what is returned from the INC sub.
I'm obviously not up on my Perl archeology.
Digging through the docs for require I find this:
5.6: no mention of INC hooks
http://search.cpan.org/~gsar/perl-5.6.1/pod/perlfunc.pod#require
5.8: hooks may be sub, array, or object. first level sub must return undef or filehandle
http://search.cpan.org/~jhi/perl-5.8.0/pod/perlfunc.pod#require
5.10+: hooks may be sub, array, or object. first level sub returns filehandle or sub or nothing
http://search.cpan.org/~dapm/perl-5.10.1/pod/perlfunc.pod#require
Your statement and the original code suggest the docs for 5.6 are incomplete, and should be
5.6: hook may be sub or object. first level sub returns sub or undef but not filehandle
That would imply that 5.8 swapped the sub for a filehandle (or that its docs are wrong) and that
5.10 reintroduced the sub.
I'm confused.