Leser: 1
4 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/perl use strict; use warnings; my $foo = Foo->new; $foo->bar; sub foobar { foo => -bar } package Foo; sub new { bless {} } sub bar { my( $package ) = caller(); no strict 'refs'; print &{$package.'::foobar'}(); } # bar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use strict; use warnings; package buh; use vars '$sub'; $sub=sub{}; sub use_sub { $sub= shift; } sub bar { $handle->(@_); } package main; sub foo { print "foo: @_\n"; } buh::use_sub(\&foo); buh::bar('bar');
4 Einträge, 1 Seite |