Re: BEGIN <> BEGIN



"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
.



Relevant Pages

  • RE: Value of Copyright
    ... State limitations in usage, state clearly that some parts shipped belongs to ... I've discussed the subject with customer a couple of times and they backed ... out of the idea of buying the source code when I told them that once the ... I have been asked to quote for writing a VB program for a potential one time ...
    (microsoft.public.vb.general.discussion)
  • Re: Writing text at an angle on a VB Form
    ... (without source code, of course) ... authors of the Windows font smoothing technology that is included with Win98 onwards or somene ... else who perhaps provides you with a third party solution) has to do the work for you if, ... you are incapable of writing the code yourself. ...
    (comp.lang.basic.visual.misc)
  • Re: Can I Decompile asm to cpp source code
    ... >>Is ther any decompiler to make cpp source code from asm code. ... > Writing a good decompiler is at least as much work as writing a good ... Since there's an n:m relationship between source code and object code, ... blocks of instructions), the output is severely incomplete relative to the ...
    (comp.lang.cpp)
  • Re: Where do i start?
    ... Try looking at some of the C source code examples associated with an ARM ... > I am wanting to migrate to ARM and and wanting to start writing in C ...
    (comp.arch.embedded)
  • commenting, was Re: Use of declare blocks
    ... the programmer's knowledge at the time of writing is lost with ... the missing comment and has to be regained. ... It would be nice to do something similar with source code and comments. ...
    (comp.lang.ada)