diff options
Diffstat (limited to 'cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt')
-rw-r--r-- | cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt b/cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt new file mode 100644 index 000000000000..24039504f698 --- /dev/null +++ b/cddl/contrib/dtracetoolkit/Notes/ALLperl_notes.txt @@ -0,0 +1,44 @@ +************************************************************************** +* The following are notes for all the Perl tracing scripts, +* +* $Id: ALLperl_notes.txt 44 2007-09-17 07:47:20Z brendan $ +* +* COPYRIGHT: Copyright (c) 2007 Brendan Gregg. +************************************************************************** + + +* Where did those "BEGIN" subroutine calls come from? + +The following counts subroutines from the example program, Code/Perl/hello.pl, + + # pl_subcalls.d + Tracing... Hit Ctrl-C to end. + ^C + FILE SUB CALLS + +no subroutines were called, so there is no data to output. + +Now a similar program is traced, Code/Perl/hello_strict.pl, which uses +the "strict" pragma, + + # pl_subcalls.d + Tracing... Hit Ctrl-C to end. + ^C + FILE SUB CALLS + hello_strict.pl BEGIN 1 + strict.pm bits 1 + strict.pm import 1 + +not only were functions from "strict.pm" traced, but a "BEGIN" function +ran from the "hello_strict.pl" program - which doesn't appear to use "BEGIN", + + # cat -n ../Code/Perl/hello_strict.pl + 1 #!./perl -w + 2 + 3 use strict; + 4 + 5 print "Hello World!\n"; + +Perl appears to add a BEGIN block to process the "use" keyword. This makes +some degree of sense. + |