Andrian Zubko > personal > personal

Download:
personal-0.22.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.22   Source  

NAME ^

personal - packages personalizer

SYNOPSIS ^

  use lib qw(.);
  use personal 'My::Package' => qw(func1 func2 $var1);

  personal('My::Package')->method;

DESCRIPTION ^

This is namespace collisions solution for scripts working under mod_perl.

Every package, loaded with 'use personal' will be renamed "on the fly" into some unique name and tied to the current script. That mean, what every script can have his personal packages.

To be compatible with 'use personal' directive, package must pass this three simple rules:

Important notice! Under mod_perl2 you must using absolute paths to your personal packages directories in 'use lib' directive.

INTERFACE ^

use personal 'PACKAGE'

Alternative to 'use PACKAGE ()'. PACKAGE will be compiled (if don't compiled yet) without import() method calling.

use personal 'PACKAGE' => qw(:DEFAULT)

Alternative to 'use PACKAGE'. The ':DEFAULT' is instruction for 'Exporter' module for exporting default symbols.

use personal PACKAGE => qw( ... )

Alternative to 'use PACKAGE qw( ... )'.

Important notice! You can using your own import() method in your personal packages as you wish, without any limits.

personal(PACKAGE)

Returns real package name. Argument PACKAGE must be one of the names of loaded packages for the current area.

Real names looks like: personal::_000000000001, personal::_000000000002, etc...

EXPORT ^

Function personal() is exporting alltimes.

ADVANCED FEATURE ^

By default all personal packages tied to script name, but you can share some personal packages between some different scripts under mod_perl. For this you can using directive 'PerlSetVar PersonalArea' in httpd.conf:

  <Directory /some/dir>
    PerlSetVar PersonalArea "area_1"
  </Directory>

In this example all mod_perl scripts in /some/dir will have they common personal packages tied to "area_1" key.

BACKWARD COMPATIBILITY ^

mod_cgi also supported without any changes.

NOTES ^

personal::Reloader will be soon. General idea of this sub-class will be next: if any changes of personal packages based on some script(s) will be detected, then all that personal packages will be deleted from cache and all that script(s) will be reloaded. This will guarantee correct symbols re-importing.

BUGS ^

Please report them to author.

AUTHOR ^

Andrian Zubko aka Ondr, <ondr@cpan.org>

syntax highlighting: