dk has asked for the wisdom of the Perl Monks concerning the following question:
I'm confused because I cannot figure out myself something as (supposedly:) simple as exporting names. I want to declare a method write as such:
use subs qw(write); sub write(&) { ... } write { 42 }
This works until I want to define write(&) in another package, at which stage I get problems. Basically, I tried combinations along this code:
with and without Exporter (I know it does the same thing, but just in case), with and without use subs, but the net result is that I cannot find what is the proper syntax. Anyone knows the magic spell?package A; sub write(&) {} package B; use subs qw(write); *write = \&A::write; write { 42 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: redefining CORE:: names
by almut (Canon) on Dec 10, 2007 at 13:37 UTC | |
by dk (Chaplain) on Dec 10, 2007 at 14:55 UTC | |
|
Re: redefining CORE:: names
by lodin (Hermit) on Dec 10, 2007 at 15:05 UTC | |
by dk (Chaplain) on Dec 11, 2007 at 07:29 UTC |