The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

GX::Meta::Util - Utility functions

SYNOPSIS

None.

DESCRIPTION

This module provides various utility functions.

FUNCTIONS

Public Functions

eval_code

Compiles the given Perl source code and returns the result.

    $result = eval_code( $source, $variables );
Arguments:
  • $source ( string )

  • $variables ( HASH reference ) [ optional ]

Returns:
  • $result ( scalar )

file_to_module_name

Returns the module name for the given filename.

    $module = file_to_module_name( $file );
Arguments:
  • $file ( string )

Returns:
  • $module ( string )

Exceptions:

find_module_file

Returns the absolute path to the file the specified module would currently be loaded from, or undef if the module file cannot be found in any of the @INC paths.

    $path = find_module_file( $module );
Arguments:
  • $module ( string )

Returns:
  • $path ( string | undef )

Exceptions:

find_modules

Returns a list with the names of the modules located in the specified directory.

    @modules = find_modules( $directory, $base_directory );
Arguments:
  • $directory ( string )

  • $base_directory ( string ) [ optional ]

Returns:
  • @modules ( strings )

load_module

Tries to load the specified module, returning true on success and false on failure. Compile errors are not trapped.

    $result = load_module( $module );
Arguments:
  • $module ( string )

Returns:
  • $result ( bool )

Exceptions:

In void context, load_module() throws a GX::Meta::Exception if the module cannot be loaded.

    load_module( $module );
Arguments:
  • $module ( string )

Exceptions:

module_inc_file

Returns the absolute path to the file the specified module was loaded from, or undef if the module is not loaded or was not loaded from a file.

    $path = module_inc_file( $module );
Arguments:
  • $module ( string )

Returns:
  • $path ( string | undef )

Exceptions:

module_inc_key

Returns the %INC key for the specified module.

    $key = module_inc_key( $module );
Arguments:
  • $module ( string )

Returns:
  • $key ( string )

Exceptions:

module_inc_value

Returns / sets the %INC value for the specified module.

    $value = module_inc_value( $module );
    $value = module_inc_value( $module, $value );
Arguments:
  • $module ( string )

  • $value ( string ) [ optional ]

Returns:
  • $value ( string )

Exceptions:

module_is_installed

Returns true if the specified module is installed, otherwise false.

    $result = module_is_installed( $module );
Arguments:
  • $module ( string )

Returns:
  • $result ( bool )

Exceptions:

module_is_loaded

Returns true if the specified module is loaded, otherwise false.

    $result = module_is_loaded( $module );
Arguments:
  • $module ( string )

Returns:
  • $result ( bool )

Exceptions:

module_to_file_name

Returns the localized filename for the specified module.

    $file = module_to_file_name( $module );
Arguments:
  • $module ( string )

Returns:
  • $file ( string )

Exceptions:

subpackage_names

Returns a list with the (unqualified) names of the subpackages of the specified package.

    @names = subpackage_names( $package );
Arguments:
  • $package ( string )

Returns:
  • @names ( strings )

Exceptions:

unload_module

Unloads the specified module.

    unload_module( $module );
Arguments:
  • $module ( string )

Exceptions:

wipe_package

Undefines every symbol that lives in the symbol table of the specified package. Danger, Will Robinson!

    wipe_package( $package );
Arguments:
  • $package ( string )

Exceptions:

SEE ALSO

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright (c) 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.