I'd like to be able to write code like use foo (bar => \&baz) but not have to put the use() call after the contents of sub baz {}. Typical perl source code has its use() calls at or near the top, any "main" code and then subroutine definitions. The use of subroutine references in use() code is interesting because use() itself is evaluated at BEGIN-time which is during parsing which means that all perl source code which is farther down in the file hasn't yet been parsed and isn't available for use. So it isn't valid to take a reference to something that hasn't yet been defined and suddenly normal perl code standards don't work.
How do I make this code sane?
use Alzabo::MethodMaker( schema => 'greenpartydb', class_root => 'GreenPartyDB::Database', all => 1, name_maker => \&name_maker ); sub name_maker { ... }
In reply to Code references as use() parameters by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |