Leser: 2
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
my %tags = (
a => \&anchor_handler,
img => \&image_handler,
frame => \&frame_handler,
);
sub dispatcher {
my ($self, $attributes, $tagname) = @_;
if (exists $tags{$tagname}) {
$tags{$tagname}->($self, $attributes);
}
}
}
Quotekabel@linux:~/progs/perl> perl
{
my %a = 1 .. 4;
sub print_a { foreach (keys %a) { print $_ . " => " . $a{$_} . "\n";}}
}
print_a ();
1 => 2
3 => 4
kabel@linux:~/progs/perl>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ perl -wle'
{
my %tags = (
a => \&anchor_handler,
);
sub dispatcher {
my ($self, $attributes, $tagname) = @_;
if (exists $tags{$tagname}) {
$tags{$tagname}->($self, $attributes);
}
}
}
sub anchor_handler { print "sub anchor_handler(@_)" }
dispatcher("self","attr","a");'
sub anchor_handler(self attr)
$
Quotekabel@linux:~/progs/perl> cat pad_test.pl
use strict;
use PadWalker qw/ peek_my /;
print_hiho ();
my $a = "hohi";
my $lex_vars = peek_my (0);
print "der hash hiho existiert ";
unless (exists ($lex_vars->{'%hiho'})) {
print "nicht!";
}
print "!\n";
print "\$a existiert aber\n" if exists $lex_vars->{'$a'};
my %hiho = 1 .. 6;
sub print_hiho {
while (my ($key, $value) = each %hiho) {
print "$key -> $value\n";
}
}
kabel@linux:~/progs/perl> perl -w pad_test.pl
der hash hiho existiert nicht!!
$a existiert aber
kabel@linux:~/progs/perl>
Quotekabel@linux:~/progs/perl> perl
use strict;
my $hiho if 0;
$hiho = "hallo!";
print "$hiho\n";
hallo!
kabel@linux:~/progs/perl>
Quote$reader->notice (what => both_cases, $dispatcher_sub_definition->is_closure (relative_to => $tags_definition));
|< 1 2 >| | 18 Einträge, 2 Seiten |