GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PADRE::UTIL (3)

.ds Aq ’

NAME

Padre::Util - Padre non-Wx Utility Functions

CONTENTS

DESCRIPTION

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.

FUNCTIONS

CWslurp



    my $content = Padre::Util::slurp( $file );
    if ( $content ) {
        print $$content;
    } else {
        # Handle errors appropriately
    }



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.

All file reading is done with binmode enabled, and data is returned by reference to avoid needless copying.

Returns the content of the file as a SCALAR reference if the file exists and can be read.

Returns false if loading of the file failed.

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.

CWnewline_type



    my $type = Padre::Util::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.

CWparse_variable



    my $version = Padre::Util::parse_variable($file, VERSION);



Parse a $file and return what $VERSION (or some other variable) is set to by the first assignment.

It will return the string "undef" if it can’t figure out what $VERSION is. $VERSION should be for all to see, so our $VERSION or plain $VERSION are okay, but my $VERSION is not.

parse_variable() will try to use version before checking for $VERSION so the following will work.



    $VERSION = qv(1.2.3);



Originally based on parse_version from ExtUtils::MakeMaker.

CW_T

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.

CWshare

If called without a parameter returns the share directory of Padre. If called with a parameter (e.g. Perl6) returns the share directory of Padre::Plugin::Perl6. Uses File::ShareDir inside.

CWrun_in_directory



    Padre::Util::run_in_directory( $command, $directory );



Runs the provided command in the directory. 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 system command.

Returns 1 on success and 0 on failure.

CWrun_in_directory_two

Plugin replacment for perl command qx{...} to avoid black lines in non *inux os



        qx{...};
        run_in_directory_two( cmd => ...);



optional parameters are dir and return type



        run_in_directory_two(cmd => ..., dir => $dir);
        run_in_directory_two(cmd => ..., dir => $dir, option => type);



also



        run_in_directory_two(cmd => ..., option => type);



return type 1 default, returns a string return type 2 error only for testing nb you might need to chomp result but thats for you.

return type 0 hash_ref
example 1,


        Padre::Util::run_in_directory_two(cmd => svn --version --quiet);

        "1.6.12
        "



example 2,


        Padre::Util::run_in_directory_two(cmd => svn --version --quiet, option => 0);

        \ {
                error    "",
                input    "svn --version --quiet",
                output   "1.6.12
        "
        }



COPYRIGHT

Copyright 2008-2013 The Padre development team as listed in Padre.pm.

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PADRE::UTIL (3) 2013-11-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.