1PPI::Transform(3)     User Contributed Perl Documentation    PPI::Transform(3)
2
3
4

NAME

6       PPI::Transform - Abstract base class for document transformation
7       classes
8

DESCRIPTION

10       "PPI::Transform" provides an API for the creation of classes and
11       objects that modify or transform PPI documents.
12

METHODS

14       new [ param1 => $value, param2 => $value ]
15
16       The "new" constructor creates a new object for your "PPI::Transform"
17       subclass. A default constructor is provided for you which takes no
18       params and creates a basic, empty, object.
19
20       If you wish to have your transform constructor take params, these must
21       be in the form of a list of key/value pairs.
22
23       Returns a new "PPI::Transform"-compatible object, or "undef" if pro‐
24       vided bad constructor params.
25
26       document
27
28       The "document" method should be implemented by each subclass, and takes
29       a single argument of a PPI::Document object, modifying it in place as
30       appropriate for the particular transform class.
31
32       That's right, this method will not clone and should not clone the docu‐
33       ment object. If you do not want the original to be modified, you need
34       to clone it yourself before passing it in.
35
36       Returns the document anyway, as a convenience, or "undef" if an error
37       occurs. By default this error should just be that you passed in some‐
38       thing that wasn't a PPI::Document, but may include additional errors
39       depending on the subclass.
40
41       apply
42
43       The "apply" method is used to apply the transform to something. The
44       argument must be a PPI::Document, or something which can be turned into
45       a one and then be written back to again.
46
47       Currently, this list is limited to a "SCALAR" reference, although a
48       handler registration process is available for you to add support for
49       additional types of object should you wish (see the source for this
50       module).
51
52       Returns true if the transform was applied, false if there is an error
53       in the transform process, or may die if there is a critical error in
54       the apply handler.
55
56       file $filename [, $output ]
57
58       The "file" method modifies a Perl document by filename. If passed a
59       single parameter, it modifies the file in-place. If provided a second
60       parameter, it will attempt to save the modified file to the alternative
61       filename.
62
63       Returns true on success, or "undef" on error.
64

TO DO

66       - May need to overload some methods to forcefully prevent Document
67       objects becoming children of another Node.
68

SUPPORT

70       See the support section in the main module.
71

AUTHOR

73       Adam Kennedy <adamk@cpan.org>
74
76       Copyright 2001 - 2006 Adam Kennedy.
77
78       This program is free software; you can redistribute it and/or modify it
79       under the same terms as Perl itself.
80
81       The full text of the license can be found in the LICENSE file included
82       with this module.
83
84
85
86perl v5.8.8                       2006-09-23                 PPI::Transform(3)
Impressum