summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xembed.pl2
-rw-r--r--ext/File/Glob/Glob.pm10
-rw-r--r--op.c23
-rw-r--r--perl.c7
-rw-r--r--pod/perlapi.pod34
5 files changed, 56 insertions, 20 deletions
diff --git a/embed.pl b/embed.pl
index 36821923f4..e1ddd674e4 100755
--- a/embed.pl
+++ b/embed.pl
@@ -1675,7 +1675,7 @@ p |void |lex_start |SV* line
p |OP* |linklist |OP* o
p |OP* |list |OP* o
p |OP* |listkids |OP* o
-Ap |void |load_module|U32 flags|SV* name|SV* ver|...
+Apd |void |load_module|U32 flags|SV* name|SV* ver|...
Ap |void |vload_module|U32 flags|SV* name|SV* ver|va_list* args
p |OP* |localize |OP* arg|I32 lexical
Apd |I32 |looks_like_number|SV* sv
diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm
index 561f33154d..da331b1be7 100644
--- a/ext/File/Glob/Glob.pm
+++ b/ext/File/Glob/Glob.pm
@@ -1,13 +1,10 @@
package File::Glob;
use strict;
-use Carp;
our($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS,
$AUTOLOAD, $DEFAULT_FLAGS);
-require Exporter;
use XSLoader ();
-require AutoLoader;
@ISA = qw(Exporter AutoLoader);
@@ -60,6 +57,7 @@ require AutoLoader;
$VERSION = '0.991';
sub import {
+ require Exporter;
my $i = 1;
while ($i < @_) {
if ($_[$i] =~ /^:(case|nocase|globally)$/) {
@@ -67,7 +65,7 @@ sub import {
$DEFAULT_FLAGS &= ~GLOB_NOCASE() if $1 eq 'case';
$DEFAULT_FLAGS |= GLOB_NOCASE() if $1 eq 'nocase';
if ($1 eq 'globally') {
- no warnings;
+ local $^W;
*CORE::GLOBAL::glob = \&File::Glob::csh_glob;
}
next;
@@ -87,11 +85,13 @@ sub AUTOLOAD {
my $val = constant($constname, @_ ? $_[0] : 0);
if ($! != 0) {
if ($! =~ /Invalid/) {
+ require AutoLoader;
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
else {
- croak "Your vendor has not defined File::Glob macro $constname";
+ require Carp;
+ Carp::croak("Your vendor has not defined File::Glob macro $constname");
}
}
eval "sub $AUTOLOAD { $val }";
diff --git a/op.c b/op.c
index f6ec916202..59cbfa39fc 100644
--- a/op.c
+++ b/op.c
@@ -3306,6 +3306,20 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *id, OP *arg)
PL_expect = XSTATE;
}
+/*
+=for apidoc load_module
+
+Loads the module whose name is pointed to by the string part of name.
+Note that the actual module name, not its filename, should be given.
+Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of
+PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
+(or 0 for no flags). ver, if specified, provides version semantics
+similar to C<use Foo::Bar VERSION>. The optional trailing SV*
+arguments can be used to specify arguments to the module's import()
+method, similar to C<use Foo::Bar VERSION LIST>.
+
+=cut */
+
void
Perl_load_module(pTHX_ U32 flags, SV *name, SV *ver, ...)
{
@@ -5848,11 +5862,14 @@ Perl_ck_glob(pTHX_ OP *o)
#if !defined(PERL_EXTERNAL_GLOB)
/* XXX this can be tightened up and made more failsafe. */
if (!gv) {
+ GV *glob_gv;
ENTER;
- Perl_load_module(aTHX_ 0, newSVpvn("File::Glob", 10), Nullsv,
- /* null-terminated import list */
- newSVpvn(":globally", 9), Nullsv);
+ Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("File::Glob", 10), Nullsv,
+ Nullsv, Nullsv);
gv = gv_fetchpv("CORE::GLOBAL::glob", FALSE, SVt_PVCV);
+ glob_gv = gv_fetchpv("File::Glob::csh_glob", FALSE, SVt_PVCV);
+ GvCV(gv) = GvCV(glob_gv);
+ GvIMPORTED_CV_on(gv);
LEAVE;
}
#endif /* PERL_EXTERNAL_GLOB */
diff --git a/perl.c b/perl.c
index 41ffdaaf90..834dc46676 100644
--- a/perl.c
+++ b/perl.c
@@ -1985,10 +1985,11 @@ Perl_eval_pv(pTHX_ const char *p, I32 croak_on_error)
/*
=for apidoc p||require_pv
-Tells Perl to C<require> a module.
+Tells Perl to C<require> the file named by the string argument. It is
+analogous to the Perl code C<eval "require '$file'">. It's even
+implemented that way; consider using Perl_load_module instead.
-=cut
-*/
+=cut */
void
Perl_require_pv(pTHX_ const char *pv)
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index 711db4d828..3f7c2f90e1 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -1086,6 +1086,22 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>.
=for hackers
Found in file scope.h
+=item load_module
+
+Loads the module whose name is pointed to by the string part of name.
+Note that the actual module name, not its filename, should be given.
+Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of
+PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
+(or 0 for no flags). ver, if specified, provides version semantics
+similar to C<use Foo::Bar VERSION>. The optional trailing SV*
+arguments can be used to specify arguments to the module's import()
+method, similar to C<use Foo::Bar VERSION LIST>.
+
+ void load_module(U32 flags, SV* name, SV* ver, ...)
+
+=for hackers
+Found in file op.c
+
=item looks_like_number
Test if an the content of an SV looks like a number (or is a
@@ -1697,7 +1713,9 @@ Found in file handy.h
=item require_pv
-Tells Perl to C<require> a module.
+Tells Perl to C<require> the file named by the string argument. It is
+analogous to the Perl code C<eval "require '$file'">. It's even
+implemented that way; consider using Perl_load_module instead.
NOTE: the perl_ form of this function is deprecated.
@@ -2390,19 +2408,19 @@ false, defined or undefined. Does not handle 'get' magic.
=for hackers
Found in file sv.h
-=item svtype
+=item SvTYPE
-An enum of flags for Perl types. These are found in the file B<sv.h>
-in the C<svtype> enum. Test these flags with the C<SvTYPE> macro.
+Returns the type of the SV. See C<svtype>.
+
+ svtype SvTYPE(SV* sv)
=for hackers
Found in file sv.h
-=item SvTYPE
-
-Returns the type of the SV. See C<svtype>.
+=item svtype
- svtype SvTYPE(SV* sv)
+An enum of flags for Perl types. These are found in the file B<sv.h>
+in the C<svtype> enum. Test these flags with the C<SvTYPE> macro.
=for hackers
Found in file sv.h