Padre::Util - Padre Non-Wx Utility Functions


The Padre::Util package is a internal storage area for miscellaneous functions that aren't really Padre-specific that we want to throw somewhere convenient so they won't clog up task-specific packages.

All functions are exportable and documented for maintenance purposes, but except for in the Padre core distribution you are discouraged in the strongest possible terms from using these functions, as they may be moved, removed or changed at any time without notice.



    my $type = newline_type( $string );

Returns None if there was not CR or LF in the file.

Returns UNIX, Mac or Windows if only the appropriate newlines were found.

Returns Mixed if line endings are mixed.



* The text in which we need to search

* The regular expression

* The offset within the text where we the last match started so the next forward match must start after this.

* The offset within the text where we the last match ended so the next backward match must end before this.

* backward bit (1 = search backward, 0 = search forward)


The _T function is used for strings that you do not want to translate immediately, but you will be translating later (multiple times).

The only reason this function needs to exist at all is so that the translation tools can identify the string it refers to as something that needs to be translated.

Functionally, this function is just a direct pass-through with no effect.


  # Find the prove utility
  my $prove = Padre::Util::pwhich('prove');

The pwhich function discovers the path to the installed perl script which is in the same installation directory as the Perl user to run Padre itself, ignoring the regular search PATH.

Returns the locally-formatted path to the script, or false (null string) if the utilily does not exist in the current Perl installation.


Given a file it will try to locate the root directory of the given project. This is a temporary work around till we get full project support but it is used by some (SVK) plugins.


Copyright 2008-2009 The Padre development team as listed in

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.