in reply to sub BEGIN
is this something like anonymous sub but gets applied before code is compiled?
It is a (specially) named block, called by Perl before processing the rest of the module. See perlmod for details.
But I don't understand how to access sub BEGIN
What do you mean by "access sub BEGIN"?
If you mean how do you call it? You don't.
If you mean how do you use the package? I think the answer is that in the normal way of things you wouldn't. It appears to be a sub package of a larger suite that is intended to be called internally only. The one subroutine (method?!) it contains--that rather nastily, remotely insinuates itself in to a complete different package space--is a rather clumsy replication of exists.
Basically, once the module is loaded, the hash has been constructed. But, the BEGIN block is probably unnecessary. The module would work just the same without it.
And whenever anyone calls SOAP::Deserializer::typecast() passing ($self, $value, $name, $attrs, $children, $type), if $type exists in the hash, it returns $value, otherwise undef.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sub BEGIN
by Anonymous Monk on May 10, 2010 at 16:03 UTC | |
by BrowserUk (Patriarch) on May 10, 2010 at 22:06 UTC | |
by ikegami (Patriarch) on May 10, 2010 at 17:14 UTC | |
by Anonymous Monk on May 10, 2010 at 17:23 UTC | |
by ikegami (Patriarch) on May 10, 2010 at 17:48 UTC | |
by tye (Sage) on May 10, 2010 at 20:24 UTC | |
| |
by tye (Sage) on May 10, 2010 at 20:17 UTC | |
by Anonymous Monk on May 10, 2010 at 20:48 UTC |