Re: BEGIN <> BEGIN
- From: xhoster@xxxxxxxxx
- Date: 31 May 2006 15:22:23 GMT
"Ferry Bolhar" <bol@xxxxxxxxxxxxxxxxx> wrote:
Hi,
I understand that a "use <module> <vars>;" is similar to
BEGIN {
require <module>;
<module>->import(<args>);
}
When writing BEGIN blocks myself and looking at the
compiled script with B::Deparse, I can see my BEGIN
blocks, but not the BEGIN blocks created by "use".
B::Deparse takes many options, you need to play with them.
$ perl -MO=Deparse,-x5 -e 'use CGI;'
sub BEGIN {
require CGI;
do {
'CGI'->import
};
}
-e syntax OK
Are these BEGIN blocks special in some way? Are
these actually BEGIN blocks or just blocks behaving
_similar_ to BEGIN blocks?
I'm not sure. B::Deparse does say that:
Note that in a few cases this translation can't be
perfectly carried back into the source code -- if the
loop's initializer declares a my variable, for
instance, it won't have the correct scope outside of
the loop.
I don't know if BEGIN blocks are another of those few cases or not.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- References:
- BEGIN <> BEGIN
- From: Ferry Bolhar
- BEGIN <> BEGIN
- Prev by Date: Re: phone number regular expression problem
- Next by Date: accessing hash values with %hash->{foo} ?
- Previous by thread: Re: BEGIN <> BEGIN
- Next by thread: safe-module and namespaces
- Index(es):
Relevant Pages
|
|