.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Padre::Util 3pm" .TH Padre::Util 3pm "2012-06-27" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Padre::Util \- Padre non\-Wx Utility Functions .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`Padre::Util\*(C'\fR 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. .PP 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. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .SS """slurp""" .el .SS "\f(CWslurp\fP" .IX Subsection "slurp" .Vb 6 \& my $content = Padre::Util::slurp( $file ); \& if ( $content ) { \& print $$content; \& } else { \& # Handle errors appropriately \& } .Ve .PP This is a simple slurp implementation, provided as a convenience for internal Padre use when loading trivial unimportant files for which we don't need anything more robust. .PP All file reading is done with \f(CW\*(C`binmode\*(C'\fR enabled, and data is returned by reference to avoid needless copying. .PP Returns the content of the file as a \s-1SCALAR\s0 reference if the file exists and can be read. .PP Returns false if loading of the file failed. .PP This function is only expected to be used in situations where the file should almost always exist, and thus the reason why reading the file failed isn't really important. .ie n .SS """newline_type""" .el .SS "\f(CWnewline_type\fP" .IX Subsection "newline_type" .Vb 1 \& my $type = Padre::Util::newline_type( $string ); .Ve .PP Returns \f(CW\*(C`None\*(C'\fR if there was not \f(CW\*(C`CR\*(C'\fR or \f(CW\*(C`LF\*(C'\fR in the file. .PP Returns \f(CW\*(C`UNIX\*(C'\fR, \f(CW\*(C`Mac\*(C'\fR or \f(CW\*(C`Windows\*(C'\fR if only the appropriate newlines were found. .PP Returns \f(CW\*(C`Mixed\*(C'\fR if line endings are mixed. .ie n .SS """parse_variable""" .el .SS "\f(CWparse_variable\fP" .IX Subsection "parse_variable" .Vb 1 \& my $version = Padre::Util::parse_variable($file, \*(AqVERSION\*(Aq); .Ve .PP Parse a \f(CW$file\fR and return what \f(CW$VERSION\fR (or some other variable) is set to by the first assignment. .PP It will return the string \f(CW"undef"\fR if it can't figure out what \f(CW$VERSION\fR is. \f(CW$VERSION\fR should be for all to see, so \f(CW\*(C`our $VERSION\*(C'\fR or plain \&\f(CW$VERSION\fR are okay, but \f(CW\*(C`my $VERSION\*(C'\fR is not. .PP \&\f(CW\*(C`parse_variable()\*(C'\fR will try to \f(CW\*(C`use version\*(C'\fR before checking for \&\f(CW$VERSION\fR so the following will work. .PP .Vb 1 \& $VERSION = qv(1.2.3); .Ve .PP Originally based on \f(CW\*(C`parse_version\*(C'\fR from ExtUtils::MakeMaker. .ie n .SS """_T""" .el .SS "\f(CW_T\fP" .IX Subsection "_T" The \f(CW\*(C`_T\*(C'\fR function is used for strings that you do not want to translate immediately, but you will be translating later (multiple times). .PP 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. .PP Functionally, this function is just a direct pass-through with no effect. .ie n .SS """share""" .el .SS "\f(CWshare\fP" .IX Subsection "share" If called without a parameter returns the share directory of Padre. If called with a parameter (e.g. \f(CW\*(C`Perl6\*(C'\fR) returns the share directory of Padre::Plugin::Perl6. Uses File::ShareDir inside. .ie n .SS """run_in_directory""" .el .SS "\f(CWrun_in_directory\fP" .IX Subsection "run_in_directory" .Vb 1 \& Padre::Util::run_in_directory( $command, $directory ); .Ve .PP Runs the provided \f(CW\*(C`command\*(C'\fR in the \f(CW\*(C`directory\*(C'\fR. On win32 platforms, executes the command to provide *true* background process executions without window popups on each execution. on non\-win32 platforms, it runs a \f(CW\*(C`system\*(C'\fR command. .PP Returns 1 on success and 0 on failure. .ie n .SS """run_in_directory_two""" .el .SS "\f(CWrun_in_directory_two\fP" .IX Subsection "run_in_directory_two" Plugin replacment for perl command qx{...} to avoid black lines in non *inux os .PP .Vb 2 \& qx{...}; \& run_in_directory_two(\*(Aq...\*(Aq); .Ve .PP optional parameters are dir and return type .PP .Vb 2 \& run_in_directory_two(\*(Aq...\*(Aq, $dir); \& run_in_directory_two(\*(Aq...\*(Aq, $dir, type); .Ve .PP also .PP .Vb 1 \& run_in_directory_two(\*(Aq...\*(Aq, type); .Ve .PP return type 1 default, returns a string .PP nb you might need to chomp result but thats for you. .PP return type 0 hash_ref .IP "example 1," 4 .IX Item "example 1," .Vb 1 \& Padre::Util::run_in_directory_two(\*(Aqsvn \-\-version \-\-quiet\*(Aq); \& \& "1.6.12 \& " .Ve .IP "example 2," 4 .IX Item "example 2," .Vb 1 \& Padre::Util::run_in_directory_two(\*(Aqsvn \-\-version \-\-quiet\*(Aq, 0); \& \& \e { \& error "", \& input "svn \-\-version \-\-quiet", \& output "1.6.12 \& " \& } .Ve .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2008\-2012 The Padre development team as listed in Padre.pm. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module.