1 **************************************************************************
2 * The following are notes for all the Perl tracing scripts,
4 * $Id: ALLperl_notes.txt 44 2007-09-17 07:47:20Z brendan $
6 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
7 **************************************************************************
10 * Where did those "BEGIN" subroutine calls come from?
12 The following counts subroutines from the example program, Code/Perl/hello.pl,
15 Tracing... Hit Ctrl-C to end.
19 no subroutines were called, so there is no data to output.
21 Now a similar program is traced, Code/Perl/hello_strict.pl, which uses
25 Tracing... Hit Ctrl-C to end.
28 hello_strict.pl BEGIN 1
32 not only were functions from "strict.pm" traced, but a "BEGIN" function
33 ran from the "hello_strict.pl" program - which doesn't appear to use "BEGIN",
35 # cat -n ../Code/Perl/hello_strict.pl
40 5 print "Hello World!\n";
42 Perl appears to add a BEGIN block to process the "use" keyword. This makes