The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Meta::Lang::Perl::Perl - tool to ease interaction with Perl.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

        MANIFEST: Perl.pm
        PROJECT: meta
        VERSION: 0.17

SYNOPSIS

        package foo;
        use Meta::Lang::Perl::Perl qw();
        my($object)=Meta::Lang::Perl::Perl->new();
        my($result)=$object->method();

DESCRIPTION

This module eases interaction with the Perl language interpreter.

FUNCTIONS

        BEGIN()
        is_perl($)
        is_lib($)
        is_bin($)
        is_test($)
        get_prefix_lib()
        get_prefix_bin()
        remove_prefix_lib($)
        remove_prefix_bin($)
        remove_prefix($)
        get_version_mm($)
        get_version_mm_unix($)
        get_version($)
        load_module($)
        unload_module($)
        call_method($$$)
        get_module_isa($)
        get_module_see($)
        get_file_isa($);
        get_file_see($);
        get_module_pod_isa($);
        get_module_pod_see($);
        get_file_pod_isa($);
        get_file_pod_see($);
        run($)
        profile($)
        man($)
        man_file($)
        man_deve($)
        module_to_file($)
        module_to_search_file($)
        file_to_module($)
        module_to_link($)
        get_pods($)
        get_pods_new($)
        get_name($)
        get_my_name($)
        get_use_text($)
        get_use($)
        TEST($)

FUNCTION DOCUMENTATION

BEGIN()

Bootstrap method to find the perl interpreter for you.

is_perl($)

This method will return true iff the file in question is a perl file (script or library).

is_lib($)

This method receives a file name and return true if the file is a perl library.

is_bin($)

This method receives a file name and return true if the file is a perl binary.

is_test($)

This method receives a file name and returns true if the file is a perl test file.

get_prefix_lib()

This returns the prefix for perl modules stored in the baseline.

get_prefix_bin()

This returns the prefix for perl binaries stored in the baseline.

remove_prefix_lib($)

This method removes a prefix from a baseline related module.

remove_prefix_bin($)

This method removes a prefix from a baseline related script.

remove_prefix($)

This method receives a perl file (script or lib) and removes its prefix.

get_version_mm($)

This method gets a filename of a perl module and returns it's version number. This method uses ExtUtils::MakeMaker. The actual code that ExtUtils::MakeMaker uses in from MM_Unix. There is a problem with this method that emits strange warning. This method returns 0 in case the version cannot be established.

get_version_mm_unix($)

This method gets a filename of a perl module and returns it's version number. This method calls ExtUtils::MM_Unix directly to avoid the MakeMaker warnings. The method does not create an ExtUtils::MM_Unix object since it's method makes no use of the object passed. This may cause problems in the future. This method returns 0 in case the version cannot be established.

get_version($)

This method gets a filename of a perl module and returns it's version number. This is my own version. Unlike the MM code which parses the modules actual text (opens the file etc...) my code loads the module (which is at least as long) but them proceeds to get the $VERSION variable from the package using perl reference techniques.

load_module($)

This method will load a module.

unload_module($)

This method will unload a module. It uses the Symbol package to do it's thing.

call_method($$$)

This method will call the method for the package received with the arguments received.

get_module_isa($)

This will get the ISA part of the module which is supplied by module name. The code loads the modules and uses references to achieve this. The code is pretty unefficient as it loads the module and the just looks up the ISA variable.

get_module_see($)

This will get the use part of the module which is supplied by module name.

get_file_isa($)

Pass this method a file name and it will return the ISA part of the module. It just uses the get_module_isa method.

get_file_see($)

Pass this method a file name and it will return the use part of the module. It just uses the get_module_see method.

get_module_pod_isa($)

This method will return the isa part of a module in a manner fitting to be included in a POD document. You can use various automated tools to put this automatically in your "SUPER CLASSES" section.

get_module_pod_see($)

This method will return the usage part of a module in a mannger fitting to be included in a POD document. You can use various automated tools to put this automatically in your "SEE ALSO" section.

get_file_pod_isa($)

This does exactly as get_pod_isa but for a file name only.

get_file_pod_see($)

This does exactly as get_pod_see but for a file name only.

run($)

Routine to run the perl script it receives as input.

profile($)

Routine to run the perl profile on the script it receives as input.

man($)

Routine to show a manual page of a perl module (the parameter). The parameter is passed directly to perldoc.

man_file($)

Routine to show a manual page of a file. The perldoc is told that the argument is a file.

man_deve($)

This routine will show a manual page of a development module.

module_to_file($)

This will translate a module name to a baseline relative file name.

module_to_search_file($)

This will translate a module name to a module file to search for (without the perl/lib prefix...

file_to_module($)

This will translate a file name to a module name.

module_to_link($)

This method will translate a module name to a link which could be put in a pod section. Currently it just adds the "(3)" suffix to the name which could be problematic if things change too much.

get_pods($)

This method will extract pods from a perl source and will return them as a hash.

get_pods_new($)

This method will extract pods from a perl text and will return them as a hash. Intead of doing the parsing myself (which I don't like doing since I want to make someone else do the work) I use Pod::POM.

get_name($)

This will return the name of the executable. Input is the NAME pod paragraph.

get_my_pod($)

This method will retrieve the text of the pod section which has the name passed from the current scripts source code.

get_my_name()

This method is suitable for use by scripts who want to extract their name from their own source. No input is reqiured since current script is assumed.

get_use_text($)

This method receives a piece of perl code and returns an array with all modules used by that code. The implementation currently consists of a simple parser and is probably incorrect but good enought for what I want for now. You are welcome to improve the implementation.

get_use($)

This method receives a perl file name and returns an array with all the modules used by that perl file. The implementation simply loads the file into a string and calls the above get_use_text.

TEST($)

Test suite for this module.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

        Name: Mark Veltzer
        Email: mailto:veltzer@cpan.org
        WWW: http://www.veltzer.org
        CPAN id: VELTZER

HISTORY

        0.00 MV more perl packaging
        0.01 MV perl packaging again
        0.02 MV more Perl packaging
        0.03 MV md5 project
        0.04 MV database
        0.05 MV perl module versions in files
        0.06 MV movies and small fixes
        0.07 MV graph visualization
        0.08 MV md5 progress
        0.09 MV thumbnail user interface
        0.10 MV import tests
        0.11 MV dbman package creation
        0.12 MV more thumbnail issues
        0.13 MV website construction
        0.14 MV improve the movie db xml
        0.15 MV web site automation
        0.16 MV SEE ALSO section fix
        0.17 MV md5 issues

SEE ALSO

Error(3), ExtUtils::MM_Unix(3), ExtUtils::MakeMaker(3), Meta::Module::Info(3), Meta::Utils::File::File(3), Meta::Utils::File::Patho(3), Meta::Utils::File::Remove(3), Meta::Utils::Progname(3), Meta::Utils::System(3), Meta::Utils::Utils(3), Pod::POM(3), Symbol(3), strict(3)

TODO

-write my own get_version code (simple parsing with no eval suitable for internal modules).

-the unload module function does not work well (you cannot reload the model after that). find better solutions.

-chage the _see methods to _use.