1Padre::Util(3)        User Contributed Perl Documentation       Padre::Util(3)
2
3
4

NAME

6       Padre::Util - Padre non-Wx Utility Functions
7

DESCRIPTION

9       The "Padre::Util" package is a internal storage area for miscellaneous
10       functions that aren't really Padre-specific that we want to throw
11       somewhere convenient so they won't clog up task-specific packages.
12
13       All functions are exportable and documented for maintenance purposes,
14       but except for in the Padre core distribution you are discouraged in
15       the strongest possible terms from using these functions, as they may be
16       moved, removed or changed at any time without notice.
17

FUNCTIONS

19   "slurp"
20           my $content = Padre::Util::slurp( $file );
21           if ( $content ) {
22               print $$content;
23           } else {
24               # Handle errors appropriately
25           }
26
27       This is a simple slurp implementation, provided as a convenience for
28       internal Padre use when loading trivial unimportant files for which we
29       don't need anything more robust.
30
31       All file reading is done with "binmode" enabled, and data is returned
32       by reference to avoid needless copying.
33
34       Returns the content of the file as a SCALAR reference if the file
35       exists and can be read.
36
37       Returns false if loading of the file failed.
38
39       This function is only expected to be used in situations where the file
40       should almost always exist, and thus the reason why reading the file
41       failed isn't really important.
42
43   "newline_type"
44           my $type = Padre::Util::newline_type( $string );
45
46       Returns "None" if there was not "CR" or "LF" in the file.
47
48       Returns "UNIX", "Mac" or "Windows" if only the appropriate newlines
49       were found.
50
51       Returns "Mixed" if line endings are mixed.
52
53   "get_matches"
54       Parameters:
55
56       ·   The text in which we need to search
57
58       ·   The regular expression
59
60       ·   The offset within the text where we the last match started so the
61           next forward match must start after this.
62
63       ·   The offset within the text where we the last match ended so the
64           next backward match must end before this.
65
66       ·   backward bit (1 = search backward, 0 = search forward) - Optional.
67           Defaults to 0.
68
69   "_T"
70       The "_T" function is used for strings that you do not want to translate
71       immediately, but you will be translating later (multiple times).
72
73       The only reason this function needs to exist at all is so that the
74       translation tools can identify the string it refers to as something
75       that needs to be translated.
76
77       Functionally, this function is just a direct pass-through with no
78       effect.
79
80   "share"
81       If called without a parameter returns the share directory of Padre.  If
82       called with a parameter (e.g. "Perl6") returns the share directory of
83       Padre::Plugin::Perl6
84
85   "get_project_rcs"
86       Given a project directory (see "get_project_dir"), returns the
87       project's Revision Control System ("RCS") by name. This can be either
88       "CVS", "SVN" or "Git". Returns "undef" if none was found.
89
90   "get_project_dir"
91       Given a file it will try to locate the root directory of the given
92       project. This is a temporary work around till we get full project
93       support but it is used by some ("SVK") plug-ins.
94
95   "parse_version"
96       This is a clone of ExtUtils::MakeMaker "parse_version" to prevent
97       loading a bunch of other modules
98
99           my $version = Padre::Util::parse_version($file);
100
101       Parse a $file and return what $VERSION is set to by the first
102       assignment.  It will return the string "undef" if it can't figure out
103       what $VERSION is. $VERSION should be for all to see, so "our $VERSION"
104       or plain $VERSION are okay, but "my $VERSION" is not.
105
106       "parse_version()" will try to "use version" before checking for
107       $VERSION so the following will work.
108
109           $VERSION = qv(1.2.3);
110
112       Copyright 2008-2010 The Padre development team as listed in Padre.pm.
113
114       This program is free software; you can redistribute it and/or modify it
115       under the same terms as Perl itself.
116
117       The full text of the license can be found in the LICENSE file included
118       with this module.
119
120
121
122perl v5.12.1                      2010-06-11                    Padre::Util(3)
Impressum