#!/usr/bin/perl use warnings; use strict; package Foo { use Moo; sub msg { printf "On my way to '%s'\n", shift; } sub Berlin { print "I'm in Berlin!\n"; } sub Paris { print "I'm in Paris!\n"; } for my $city (qw( Berlin Paris )) { before $city => sub { msg($city) }; } }; my $obj = Foo->new; $obj->Berlin(); # should go first in msg(), then in Berlin()
In reply to Re: Calling an intermediate method
by choroba
in thread Calling an intermediate method
by trizen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |