Front page | perl.perl5.porters |
Postings from March 2000
Re: perl -MO status
From:
Tom Christiansen
Date:
March 27, 2000 20:01
Subject:
Re: perl -MO status
Message ID:
9910.954216079@chthon
Is this right?
% P -MO=Showlex,retval -e 'sub retval { my $self = shift; my $n = sub { my $arg = shift; return $self->{$arg} } } '
Pad of lexical names for &retval has 5 entries
0: SPECIAL #1 &PL_sv_undef
1: PVNV (0x8193810) "$self"
2: SPECIAL #1 &PL_sv_undef
3: PVNV (0x81938a0) "$n"
4: PVNV (0x81938ac) "&"
Pad of lexical values for &retval has 5 entries
0: AV (0x81944f4) FILL -1
1: NULL (0x80f522c)
2: NULL (0x8193804)
3: NULL (0x8193894)
4: CV (0x81938b8) 0
What's all that well, stuff? And what's the thing whose name is
"&" all about? You run with Xref and it doesn't show up.
% P -MO=Xref -e 'sub retval { my $self = shift; my $n = sub { my $arg = shift; return $self->{$arg} } } '
File -e
Subroutine (definitions)
Package UNIVERSAL
&VERSION s0
&can s0
&isa s0
Package attributes
&bootstrap s0
Package main
&retval s1
Subroutine retval
Package (lexical)
$n i1
$self i1
Package main
@_ 1
Here are more.
% perl -MO=Showlex /tmp/testit
Pad of lexical names for comppadlist has 0 entries
Pad of lexical values for comppadlist has 1 entries
0: SPECIAL #1 &PL_sv_undef
/tmp/testit syntax OK
% perl -MO=Showlex,start /tmp/testit
Pad of lexical names for &start has 27 entries
0: SPECIAL #1 &PL_sv_undef
1: PVNV (0x8193774) "$self"
2: PVNV (0x81937f8) "$tag"
3: PVNV (0x8193810) "$attr"
4: PVNV (0x8193828) "$attrseq"
5: PVNV (0x8193840) "$orig"
6: SPECIAL #1 &PL_sv_undef
7: SPECIAL #1 &PL_sv_undef
8: SPECIAL #1 &PL_sv_undef
9: SPECIAL #1 &PL_sv_undef
10: SPECIAL #1 &PL_sv_undef
11: PVNV (0x8194458) "$tmp"
12: SPECIAL #1 &PL_sv_undef
13: SPECIAL #1 &PL_sv_undef
14: SPECIAL #1 &PL_sv_undef
15: PVNV (0x81944dc) "$encoded"
16: SPECIAL #1 &PL_sv_undef
17: SPECIAL #1 &PL_sv_undef
18: SPECIAL #1 &PL_sv_undef
19: SPECIAL #1 &PL_sv_undef
20: SPECIAL #1 &PL_sv_undef
21: SPECIAL #1 &PL_sv_undef
22: SPECIAL #1 &PL_sv_undef
23: SPECIAL #1 &PL_sv_undef
24: SPECIAL #1 &PL_sv_undef
25: SPECIAL #1 &PL_sv_undef
26: SPECIAL #1 &PL_sv_undef
Pad of lexical values for &start has 27 entries
0: AV (0x81945e4) FILL -1
1: NULL (0x80f56a8)
2: NULL (0x8193768)
3: NULL (0x8193804)
4: NULL (0x819381c)
5: NULL (0x8193834)
6: NULL (0x819384c)
7: NULL (0x8194404)
8: NULL (0x8194428)
9: NULL (0x8194440)
10: NULL (0x8194464)
11: NULL (0x819444c)
12: NULL (0x8194488)
13: NULL (0x81944b8)
14: NULL (0x81944c4)
15: NULL (0x81944d0)
16: NULL (0x81944e8)
17: NULL (0x819450c)
18: NULL (0x819453c)
19: NULL (0x8194548)
20: NULL (0x8194560)
21: NULL (0x8194518)
22: NULL (0x819456c)
23: NULL (0x8194578)
24: NULL (0x8194584)
25: NULL (0x819
[truncate --tchrist]
That was from this guy that you saw before:
% cat /tmp/testit
sub start {
my($self, $tag, $attr, $attrseq, $orig) = @_;
if ($tag eq 'a' && exists $attr->{href}) {
if ($attr->{href} =~ s/\Q$from/$to/g) {
# must reconstruct the start tag based on $tag and $attr.
# wish we instead were told the extent of the 'href' value
# in $orig.
my $tmp = "<$tag";
for (@$attrseq) {
my $encoded = encode_entities($attr->{$_});
$tmp .= qq( $_="$encoded ");
}
$tmp .= ">";
$self->output($tmp);
return;
}
}
$self->output($orig);
}
--tom
-
Re: perl -MO status
by Tom Christiansen
-
perl -MO status
by Tom Christiansen