Click here to get back home

BEGIN, INIT etc...

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
BEGIN, INIT etc... pgodfrin 03-26-2008
---> Re: BEGIN, INIT etc... Gunnar Hjalmars...03-26-2008
Posted by pgodfrin on March 26, 2008, 3:22 pm
Please log in for more thread options
Greetings,
Anyone know of a good article that discusses when and why you would
use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?

thanks,
pg

Posted by Gunnar Hjalmarsson on March 26, 2008, 4:49 pm
Please log in for more thread options
pgodfrin wrote:
> Anyone know of a good article that discusses when and why you would
> use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?

perldoc perlmod

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by pgodfrin on March 26, 2008, 4:49 pm
Please log in for more thread options
> pgodfrin wrote:
> > Anyone know of a good article that discusses when and why you would
> > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
>
> perldoc perlmod
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

been there done that. Can we do better?
pg

Posted by xhoster on March 26, 2008, 6:37 pm
Please log in for more thread options
> > pgodfrin wrote:
> > > Anyone know of a good article that discusses when and why you would
> > > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
> >
> > perldoc perlmod
> >
>
> been there done that. Can we do better?

What parts do you think need improving?

After reading my installed perlmod, I know what BEGIN and END do, and I
know that if I want to do what they do, then I should use the one that does
what I want done. I don't know what more to ask of documentation than
that. For CHECK and INIT, I know that they are used for things I will
probably rarely if ever need to do, but they are in the back of mind,
reminding me to re-read the docs if I ever do decide I might need them.
Again, It isn't clear to me what more is needed.

After reading the 5.10 perlmod, I see that UNITCHECK should be used if
I need something like CHECK but which is run in string evals (and some
other special constructs) unlike CHECK. Maybe it should point out that
UNITCHECK is newer and perhaps existing CHECK and INIT code would be better
done in the newer style as UNITCHECK code.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Posted by pgodfrin on March 26, 2008, 8:00 pm
Please log in for more thread options
On Mar 26, 5:37 pm, xhos...@gmail.com wrote:
> > > pgodfrin wrote:
> > > > Anyone know of a good article that discusses when and why you would
> > > > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
>
> > > perldoc perlmod
>
> > been there done that. Can we do better?
>
> What parts do you think need improving?
>
> After reading my installed perlmod, I know what BEGIN and END do, and I
> know that if I want to do what they do, then I should use the one that does
> what I want done. I don't know what more to ask of documentation than
> that. For CHECK and INIT, I know that they are used for things I will
> probably rarely if ever need to do, but they are in the back of mind,
> reminding me to re-read the docs if I ever do decide I might need them.
> Again, It isn't clear to me what more is needed.
>
> After reading the 5.10 perlmod, I see that UNITCHECK should be used if
> I need something like CHECK but which is run in string evals (and some
> other special constructs) unlike CHECK. Maybe it should point out that
> UNITCHECK is newer and perhaps existing CHECK and INIT code would be better
> done in the newer style as UNITCHECK code.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> this fact.

Hi Xho,
Sorry - didn't mean to impugn the quality of the docs. All I was
looking for is some sort of article from a trade rag, for instance,
that discussed the utility of those code blocks. You know, maybe some
sort of article where a really good Perl programmer describes how he
(or she :) ) uses those code blocks in an effective manner.

That's all.

smiles,
pg

Similar ThreadsPosted
Q on BEGIN and INIT April 19, 2005, 3:05 pm
Should I use BEGIN, CHECK, or INIT? October 27, 2004, 8:32 pm
CHECK and INIT May 19, 2006, 11:00 am
BEGIN <> BEGIN May 31, 2006, 5:32 am
Where to begin with Perl 6 September 5, 2005, 11:03 am
BEGIN { package Foo; use Foo } December 24, 2005, 6:49 pm
Nub question - were to begin? April 26, 2006, 2:33 pm
bless an object in a BEGIN block (Singleton) October 13, 2006, 3:02 am
BEGIN not safe after errors--compilation aborted February 22, 2008, 11:26 am
Regular expression to match any line that DOESN'T begin with a particular string March 22, 2006, 7:48 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap