-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Ken Williams <ken at mathforum.org> [2003-06-26 18:20]:
> On Thursday, June 26, 2003, at 02:37  PM, Steve Grazzini wrote:
> >There's also a pragma to make the named groups available
> >as implicitly-declared 'my' variables.
> >
> >    use Regexp::Capture;
> >    use strict;
> >
> >    while (<>) {
> >        use capture;
> 
> That seems a little strange to me - doesn't it require a capture.pm 
> module?  Could it be turned on & off by an exported Regexp::Capture 
> function?  Or maybe "use Regexp::Capture qw(lexicals);"?

This got me curious -- this is interesting:

  package Regexp::Capture;

  use strict;
  sub import { warn "Loaded $_[0]!\n" }

  package capture;

  $INC{'capture.pm'} = $INC{'Regexp/Capture.pm'};
  sub import { warn "Loaded $_[0]!\n" }


And this will short-circuit calls to "use capture;" -- require will see
$INC{'capture.pm'} and not look for a file on disk:

  $ perl -MRegexp::Capture -Mcapture -e1
  Loaded Regexp::Capture!
  Loaded capture!  

(There is a Regexp/Capture.pm, but no caption.pm.)

(darren)

- -- 
Things exist, they're just not there.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE++3UMzsinjrVhZaoRArIOAJ9Ibffahht2zpYeKtwfMZWZXDbTYACfR23k
tpXtKeVHUO5LgpgdbmT2Pvs=
=c9jF
-----END PGP SIGNATURE-----

Reply via email to