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
17 my $file = PPI::Document::File->new( 'Module.pm' );
18
19 The "new" constructor works the same as for the regular one, except
20 that the only params allowed is a file name. You cannot create an
21 "anonymous" PPI::Document::File object, not can you create an empty
22 one.
23
24 Returns a new PPI::Document::File object, or "undef" on error.
25
26 filename
27
28 The "filename" accessor returns the name of the file in which the docu‐
29 ment is stored.
30
31 save
32
33 # Save to the file we were loaded from
34 $file->save;
35
36 # Save a copy to somewhere else
37 $file->save( 'Module2.pm' );
38
39 The "save" method works similarly to the one in the parent PPI::Docu‐
40 ment class, saving a copy of the document to a file.
41
42 The difference with this subclass is that if "save" is not passed any
43 filename, it will save it back to the file it was loaded from.
44
45 Note: When saving to a different file, it is considered to be saving a
46 copy and so the value returned by the "filename" accessor will stay the
47 same, and not change to the new filename.
48
50 - May need to overload some methods to forcefully prevent Document
51 objects becoming children of another Node.
52
54 See the support section in the main module.
55
57 Adam Kennedy <adamk@cpan.org>
58
60 Copyright 2001 - 2006 Adam Kennedy. All rights reserved.
61
62 This program is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65 The full text of the license can be found in the LICENSE file included
66 with this module.
67
68
69
70perl v5.8.8 2006-09-23 PPI::Document::File(3)