NAME
PApp::Package - Application Package Class.
SYNOPSIS
# not normally "use"d in application code.
DESCRIPTION
Every application in PApp is represented as a PApp::Package (currently this also defines a unique namespace). This Module defines the PApp::Package
and PApp::Module
classes.
- $ppkg->config([key])
-
Returns a hash-ref (no options) with the current configuration information, or a specific configuration value for the current application.
Examples:
my $path = $ppkg->config("path"); my $cfg = $ppkg->config; my $path = $cfg{path};
- $ppkg->for_all_packages (callback<papp,path,name>, initial-path)
-
Run a sub for all packages in a papp.
- $ppkg->load_stylesheet($path, [$type, [$domain, $lang]])
-
Load a PApp::XSLT stylesheet of type $type (either
pxml
(default unless guessed by the extension) orxml
and language$lang
into the package and return it. It is planned to do some caching in the future. - $ppkg->refer('callback', [ARGS...]);
-
This method
refer
's a callback (see PApp::Callback::refer) defined using the callback element on the package level and returns the resulting coderef. - $ppkg->gen_lexical($value)
-
(internal). Generate a new lexical to be used in compilation and return it's name (including '$').
- $ppkg->insert($name, $module, $conf) [EXPERIMENTAL]
-
Insert the given package at the current position, optionally setting the default module to
$module
and$PApp::curconf
to$conf
. If no name is given (or $name is undef), the package will be embedded under it's "natural" name, otherwise the given name is used to differentiate between different instances of the same package.The PApp namespace (i.e. <%S> and <%A>) will be shared with the inserted package.
You can (currently) access packages embedded in another module using the $ppkg->{pkg}{packagename} syntax.
This API might not be stable.
- $ppkg->embed($name, $module, $conf) [EXPERIMENTAL]
-
Embed the given package. This function is identical to the insert method above with the exception of the namespace (eg. %S) , which will NOT be shared with the embedding package.
You can (currently) access packages embedded in another module using the $ppkg->{pkg}{packagename} syntax.
This API might not be stable.
SEE ALSO
PApp.
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/