Change 15288 by jhi@alpha on 2002/03/18 13:41:34
Subject: [PATCH B] B::perlstring()
From: Rafael Garcia-Suarez <[EMAIL PROTECTED]>
Date: Sun, 17 Mar 2002 23:06:12 +0100
Message-ID: <20020317230612.A24442@rafael>
Affected files ...
.... //depot/perl/ext/B/B.pm#44 edit
.... //depot/perl/ext/B/B/Deparse.pm#115 edit
.... //depot/perl/ext/B/Makefile.PL#18 edit
Differences ...
==== //depot/perl/ext/B/B.pm#44 (text) ====
Index: perl/ext/B/B.pm
--- perl/ext/B/B.pm.~1~ Mon Mar 18 06:45:06 2002
+++ perl/ext/B/B.pm Mon Mar 18 06:45:06 2002
@@ -7,7 +7,7 @@
#
package B;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
use XSLoader ();
require Exporter;
@@ -18,7 +18,7 @@
@EXPORT_OK = qw(minus_c ppname save_BEGINs
class peekop cast_I32 cstring cchar hash threadsv_names
main_root main_start main_cv svref_2object opnumber
- amagic_generation
+ amagic_generation perlstring
walkoptree_slow walkoptree walkoptree_exec walksymtable
parents comppadlist sv_undef compile_stats timing_info
begin_av init_av end_av regex_padav);
@@ -941,6 +941,11 @@
Returns a double-quote-surrounded escaped version of STR which can
be used as a string in C source code.
+=item perlstring(STR)
+
+Returns a double-quote-surrounded escaped version of STR which can
+be used as a string in Perl source code.
+
=item class(OBJ)
Returns the class of an object without the part of the classname
==== //depot/perl/ext/B/B/Deparse.pm#115 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm.~1~ Mon Mar 18 06:45:06 2002
+++ perl/ext/B/B/Deparse.pm Mon Mar 18 06:45:06 2002
@@ -8,7 +8,7 @@
package B::Deparse;
use Carp;
-use B qw(class main_root main_start main_cv svref_2object opnumber cstring
+use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
OPf_WANT OPf_WANT_VOID OPf_WANT_SCALAR OPf_WANT_LIST
OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL OPf_MOD
OPpLVAL_INTRO OPpOUR_INTRO OPpENTERSUB_AMPER OPpSLICE OPpCONST_BARE
@@ -542,14 +542,14 @@
my $self = B::Deparse->new(@args);
# First deparse command-line args
if (defined $^I) { # deparse -i
- print q(BEGIN { $^I = ).cstring($^I).qq(; }\n);
+ print q(BEGIN { $^I = ).perlstring($^I).qq(; }\n);
}
if ($^W) { # deparse -w
print qq(BEGIN { \$^W = $^W; }\n);
}
if ($/ ne "\n" or defined $O::savebackslash) { # deparse -l and -0
- my $fs = cstring($/) || 'undef';
- my $bs = cstring($O::savebackslash) || 'undef';
+ my $fs = perlstring($/) || 'undef';
+ my $bs = perlstring($O::savebackslash) || 'undef';
print qq(BEGIN { \$/ = $fs; \$\\ = $bs; }\n);
}
my @BEGINs = B::begin_av->isa("B::AV") ? B::begin_av->ARRAY : ();
@@ -1265,9 +1265,7 @@
elsif (($to & WARN_MASK) eq "\0"x length($to)) {
return "no warnings;\n";
}
- my $wb = cstring($to);
- $wb =~ s/([\$@])/\\$1/g;
- return "BEGIN {\${^WARNING_BITS} = $wb}\n";
+ return "BEGIN {\${^WARNING_BITS} = ".perlstring($to)."}\n";
}
sub declare_hints {
==== //depot/perl/ext/B/Makefile.PL#18 (text) ====
Index: perl/ext/B/Makefile.PL
--- perl/ext/B/Makefile.PL.~1~ Mon Mar 18 06:45:06 2002
+++ perl/ext/B/Makefile.PL Mon Mar 18 06:45:06 2002
@@ -15,14 +15,14 @@
}
WriteMakefile(
- NAME => "B",
- VERSION => "1.00",
- PL_FILES => { 'defsubs_h.PL' => 'defsubs.h' },
- MAN3PODS => {},
- clean => {
- FILES => "perl$e *$o B.c defsubs.h *~"
+ NAME => "B",
+ VERSION_FROM => "B.pm",
+ PL_FILES => { 'defsubs_h.PL' => 'defsubs.h' },
+ MAN3PODS => {},
+ clean => {
+ FILES => "perl$e *$o B.c defsubs.h *~"
}
-);
+);
package MY;
End of Patch.