1PPI::Document::File(3)User Contributed Perl DocumentationPPI::Document::File(3)
2
3
4
6 PPI::Document::File - A Perl Document located in a specific file
7
9 WARNING: This class is experimental, and may change without notice
10
11 PPI::Document::File provides a PPI::Document subclass that represents a
12 Perl document stored in a specific named file.
13
15 new
16 my $file = PPI::Document::File->new( 'Module.pm' );
17
18 The "new" constructor works the same as for the regular one, except
19 that the only params allowed is a file name. You cannot create an
20 "anonymous" PPI::Document::File object, not can you create an empty
21 one.
22
23 Returns a new PPI::Document::File object, or "undef" on error.
24
25 filename
26 The "filename" accessor returns the name of the file in which the
27 document is stored.
28
29 save
30 # Save to the file we were loaded from
31 $file->save;
32
33 # Save a copy to somewhere else
34 $file->save( 'Module2.pm' );
35
36 The "save" method works similarly to the one in the parent
37 PPI::Document class, saving a copy of the document to a file.
38
39 The difference with this subclass is that if "save" is not passed any
40 filename, it will save it back to the file it was loaded from.
41
42 Note: When saving to a different file, it is considered to be saving a
43 copy and so the value returned by the "filename" accessor will stay the
44 same, and not change to the new filename.
45
47 - May need to overload some methods to forcefully prevent Document
48 objects becoming children of another Node.
49
51 See the support section in the main module.
52
54 Adam Kennedy <adamk@cpan.org>
55
57 Copyright 2001 - 2011 Adam Kennedy.
58
59 This program is free software; you can redistribute it and/or modify it
60 under the same terms as Perl itself.
61
62 The full text of the license can be found in the LICENSE file included
63 with this module.
64
65
66
67perl v5.16.3 2011-02-26 PPI::Document::File(3)