1PPI::Statement::PackageU(s3e)r Contributed Perl DocumentaPtPiIo:n:Statement::Package(3)
2
3
4

NAME

6       PPI::Statement::Package - A package statement
7

INHERITANCE

9         PPI::Statement::Package
10         isa PPI::Statement
11             isa PPI::Node
12                 isa PPI::Element
13

DESCRIPTION

15       Most PPI::Statement subclasses are assigned based on the value of the
16       first token or word found in the statement. When PPI encounters a
17       statement starting with 'package', it converts it to a "PPI::State‐
18       ment::Package" object.
19
20       When working with package statements, please remember that packages
21       only exist within their scope, and proper support for scoping has yet
22       to be completed in PPI.
23
24       However, if the immediate parent of the package statement is the top
25       level PPI::Document object, then it can be considered to define every‐
26       thing found until the next top-level "file scoped" package statement.
27
28       A file may, however, contain nested temporary package, in which case
29       you are mostly on your own :)
30

METHODS

32       "PPI::Statement::Package" has a number of methods in addition to the
33       standard PPI::Statement, PPI::Node and PPI::Element methods.
34
35       namespace
36
37       Most package declarations are simple, and just look something like
38
39         package Foo::Bar;
40
41       The "namespace" method returns the name of the declared package, in the
42       above case 'Foo::Bar'. It returns this exactly as written and does not
43       attempt to clean up or resolve things like ::Foo to main::Foo.
44
45       If the package statement is done any different way, it returns false.
46
47       file_scoped
48
49       Regardless of whether it is named or not, the "file_scoped" method will
50       test to see if the package declaration is a top level "file scoped"
51       statement or not, based on its location.
52
53       In general, returns true if it is a "file scoped" package declaration
54       with an immediate parent of the top level Document, or false if not.
55
56       Note that if the PPI DOM tree does not have a PPI::Document object at
57       as the root element, this will return false. Likewise, it will also
58       return false if the root element is a PPI::Document::Fragment, as a
59       fragment of a file does not represent a scope.
60

SUPPORT

62       See the support section in the main module.
63

AUTHOR

65       Adam Kennedy <adamk@cpan.org>
66
68       Copyright 2001 - 2006 Adam Kennedy.
69
70       This program is free software; you can redistribute it and/or modify it
71       under the same terms as Perl itself.
72
73       The full text of the license can be found in the LICENSE file included
74       with this module.
75
76
77
78perl v5.8.8                       2006-09-23        PPI::Statement::Package(3)
Impressum