In perl.git, the branch maint-5.12 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/90c7fed9e2319ea4c2b125b9458ed385ecb85d8f?hp=115e83076034aec9315114fb123b0003b5664a15>

- Log -----------------------------------------------------------------
commit 90c7fed9e2319ea4c2b125b9458ed385ecb85d8f
Author: Ævar Arnfjörð Bjarmason <[email protected]>
Date:   Tue Apr 27 16:35:39 2010 +0000

    Correct POD link to perlrun.pod to be more accurate
    
    Now liking to the specific section in perlrun that discusses
    sitecustomize.pl
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>

M       pod/perlvar.pod

commit 5b77effe3139b8d5d7c928f64c430868f5fb6b5c
Author: Ævar Arnfjörð Bjarmason <[email protected]>
Date:   Tue Apr 27 16:33:43 2010 +0000

    Add POD index entries for sitecustomize and sitecustomize.pl
    
    This covers all non-perldelta occurrences of documentation that
    discusses sitecustomize.pl
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>

M       pod/perlrun.pod
M       pod/perlvar.pod

commit 928c009c1747b5d911b7da3c11e42edefd3bd948
Author: Philippe Bruhat (BooK) <[email protected]>
Date:   Tue Apr 27 18:12:36 2010 +0200

    Improve documentation about sitecustomize.pl.
    
    This documentation patch is more a rewording of the content of
    http://www.nntp.perl.org/group/perl.perl5.porters/2007/10/msg129930.html
    than anything original.
    
    The actual authors are therefore Michael G Schwern, Jan Dubois, Peter
    Dintelmann, and H.Merijn Brand.
    
    Signed-off-by: Philippe Bruhat (BooK) <[email protected]>
    Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>

M       pod/perlrun.pod

commit caea4ec2c833c780ba5c7cd1a7d947339cf375a0
Author: Rafael Garcia-Suarez <[email protected]>
Date:   Mon Apr 26 09:23:52 2010 +0200

    Don't use Test::More in t/op/* tests

M       t/op/utf8magic.t

commit 6af88f0d661fafdd0401bc92bf25c253c47b34d4
Author: gfx <[email protected]>
Date:   Sun Apr 25 22:02:09 2010 +0200

    Fix utf8::is_utf8 to respect GMAGIC (e.g. $1)

M       MANIFEST
A       t/op/utf8magic.t
M       universal.c
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST         |    1 +
 pod/perlrun.pod  |   24 +++++++++++++++++++++++-
 pod/perlvar.pod  |    4 +++-
 t/op/utf8magic.t |   25 +++++++++++++++++++++++++
 universal.c      |    3 ++-
 5 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100644 t/op/utf8magic.t

diff --git a/MANIFEST b/MANIFEST
index 38144c8..4e21c70 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4501,6 +4501,7 @@ t/op/unshift.t                    See if unshift works
 t/op/upgrade.t                 See if upgrading and assigning scalars works
 t/op/utf8cache.t               Tests malfunctions of utf8 cache
 t/op/utf8decode.t              See if UTF-8 decoding works
+t/op/utf8magic.t               See if utf8:: functions handle magic variables
 t/op/utfhash.t                 See if utf8 keys in hashes behave
 t/op/utftaint.t                        See if utf8 and taint work together
 t/op/vec.t                     See if vectors work
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index f510707..1d91694 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -440,7 +440,7 @@ behaves just like B<-e>, except that it implicitly enables 
all
 optional features (in the main compilation unit). See L<feature>.
 
 =item B<-f>
-X<-f>
+X<-f> X<sitecustomize> X<sitecustomize.pl>
 
 Disable executing F<$Config{sitelib}/sitecustomize.pl> at startup.
 
@@ -450,6 +450,28 @@ This is a hook that allows the sysadmin to customize how 
perl behaves.
 It can for instance be used to add entries to the @INC array to make perl
 find modules in non-standard locations.
 
+Perl actually inserts the following code:
+
+    BEGIN {
+        do { local $!; -f "$Config{sitelib}/sitecustomize.pl"; }
+            && do "$Config{sitelib}/sitecustomize.pl";
+    }
+
+Since it is an actual C<do> (not a C<require>), F<sitecustomize.pl>
+doesn't need to return a true value. The code is run in package C<main>,
+in its own lexical scope. However, if the script dies, C<$@> will not
+be set.
+
+The value of C<$Config{sitelib}> is also determined in C code and not
+read from C<Config.pm>, which is not loaded.
+
+The code is executed B<very> early. For example, any changes made to
+C<@INC> will show up in the output of `perl -V`. Of course, C<END>
+blocks will be likewise executed very late.
+
+To determine at runtime if this capability has been compiled in your
+perl, you can check the value of C<$Config{usesitecustomize}>.
+
 =item B<-F>I<pattern>
 X<-F>
 
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index febf15f..9985d1c 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -1368,6 +1368,7 @@ The current set of warning checks enabled by the C<use 
warnings> pragma.
 See the documentation of C<warnings> for more details.
 
 =item ${^WIN32_SLOPPY_STAT}
+X<sitecustomize> X<sitecustomize.pl>
 
 If this variable is set to a true value, then stat() on Windows will
 not try to open the file. This means that the link count cannot be
@@ -1377,7 +1378,8 @@ is considerably faster, especially for files on network 
drives.
 
 This variable could be set in the F<sitecustomize.pl> file to
 configure the local Perl installation to use "sloppy" stat() by
-default.  See L<perlrun> for more information about site
+default.  See the documentation for B<-f> in
+L<perlrun|perlrun/"Command Switches"> for more information about site
 customization.
 
 =item $EXECUTABLE_NAME
diff --git a/t/op/utf8magic.t b/t/op/utf8magic.t
new file mode 100644
index 0000000..3d942c0
--- /dev/null
+++ b/t/op/utf8magic.t
@@ -0,0 +1,25 @@
+#!perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    require './test.pl';
+}
+
+plan tests => 4;
+
+use strict;
+
+my $str = "\x{99f1}\x{99dd}"; # "camel" in Japanese kanji
+$str =~ /(.)/;
+
+ok utf8::is_utf8($1), "is_utf8(unistr)";
+scalar "$1"; # invoke SvGETMAGIC
+ok utf8::is_utf8($1), "is_utf8(unistr)";
+
+utf8::encode($str); # off the utf8 flag
+$str =~ /(.)/;
+
+ok !utf8::is_utf8($1), "is_utf8(bytes)";
+scalar "$1"; # invoke SvGETMAGIC
+ok !utf8::is_utf8($1), "is_utf8(bytes)";
diff --git a/universal.c b/universal.c
index ce56d0b..006baa2 100644
--- a/universal.c
+++ b/universal.c
@@ -794,7 +794,8 @@ XS(XS_utf8_is_utf8)
      if (items != 1)
         croak_xs_usage(cv, "sv");
      else {
-       const SV * const sv = ST(0);
+       SV * const sv = ST(0);
+       SvGETMAGIC(sv);
            if (SvUTF8(sv))
                XSRETURN_YES;
            else

--
Perl5 Master Repository

Reply via email to