#
package B;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
use XSLoader ();
require Exporter;
@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);
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
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
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 : ();
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 {
}
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;