summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-01-27 15:51:10 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-27 15:20:52 +0000
commitacaaef34ab7836e502b053f317539b0368c50596 (patch)
tree42f6759e88af8f4ee116c561d6b13a6f058e902e /ext
parent86e0f6b68413c3c2e4f11fc18a35c314412ef370 (diff)
downloadperl-acaaef34ab7836e502b053f317539b0368c50596.tar.gz
new switch: don't check prototypes while deparsing
Message-ID: <20020127145110.A16332@rafael> p4raw-id: //depot/perl@14440
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B/Deparse.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm
index a0f0e78020..c373a69299 100644
--- a/ext/B/B/Deparse.pm
+++ b/ext/B/B/Deparse.pm
@@ -490,6 +490,8 @@ sub new {
$self->{'files'}{$1} = 1;
} elsif ($arg eq "-p") {
$self->{'parens'} = 1;
+ } elsif ($arg eq "-P") {
+ $self->{'noproto'} = 1;
} elsif ($arg eq "-l") {
$self->{'linenums'} = 1;
} elsif ($arg eq "-q") {
@@ -2779,6 +2781,7 @@ sub method {
# or ("", $args_after_prototype_demunging) if it does.
sub check_proto {
my $self = shift;
+ return "&" if $self->{'noproto'};
my($proto, @args) = @_;
my($arg, $real);
my $doneok = 0;
@@ -3781,6 +3784,22 @@ C<B::Deparse,-p> will print
which probably isn't what you intended (the C<'???'> is a sign that
perl optimized away a constant value).
+=item B<-P>
+
+Disable prototype checking. With this option, all function calls are
+deparsed as if no prototype was defined for them. In other words,
+
+ perl -MO=Deparse,-P -e 'sub foo (\@) { 1 } foo @x'
+
+will print
+
+ sub foo (\@) {
+ 1;
+ }
+ &foo(\@x);
+
+making clear how the parameters are actually passed to C<foo>.
+
=item B<-q>
Expand double-quoted strings into the corresponding combinations of