You figured it out? Odd, I seem to remember spending a chunk of time cutting down your code in order to determine what the problem was, then providing you with some simple examples. Thanks for the credit.
It's possible taking a reference to a function shouldn't behave this way. Unfortunately, in practice, with the way Perl is implemented, it needs to. In order to be able to take a reference to a function that has not yet been defined you have to add a symbol table entry. ->can, defined, etc. all need to work with this symbol table entry, because you've essentially made a promise that you will define the subroutine.
If you remove this behavior then it will be required that all subroutines be defined before ever being referred to. Given the dynamic nature of Perl you can't even check this promise until the subroutine is called; a subroutine could be defined at any point during compile- or run-time.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.