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 save
26 # Save to the file we were loaded from
27 $file->save;
28
29 # Save a copy to somewhere else
30 $file->save( 'Module2.pm' );
31
32 The "save" method works similarly to the one in the parent
33 PPI::Document class, saving a copy of the document to a file.
34
35 The difference with this subclass is that if "save" is not passed any
36 filename, it will save it back to the file it was loaded from.
37
38 Note: When saving to a different file, it is considered to be saving a
39 copy and so the value returned by the "filename" accessor will stay the
40 same, and not change to the new filename.
41
43 - May need to overload some methods to forcefully prevent Document
44 objects becoming children of another Node.
45
47 See the support section in the main module.
48
50 Adam Kennedy <adamk@cpan.org>
51
53 Copyright 2001 - 2011 Adam Kennedy.
54
55 This program is free software; you can redistribute it and/or modify it
56 under the same terms as Perl itself.
57
58 The full text of the license can be found in the LICENSE file included
59 with this module.
60
61
62
63perl v5.32.1 2021-01-27 PPI::Document::File(3)