PApp::Env - communicate between processes and the outside.
use PApp::Env;
This module can be used to get and set some kind of ``environment'' variables shared between all papp applications. When inside a PApp environment (e.g. inside a papp program) this module uses PApp's state database handle. Outside the module it tries to open a connection to the database itself, so it can be used e.g. from shell script to communicate data asynchronously to the module.
If you pass in a reference, the Storable module (Storable) will be used to serialize and deserialize it.
Environment variable names (often referred as key in this document) are treated case-insensitive if the database allows it. The contents will be treated as opaque binary objects (again, if the database supports it).
The only database supported by this module is MySQL, so the above is currently true in all cases.
Calls to lockenv can be nested.
modifyenv { $_[0]++ } "myapp_counter";
The modification will be done atomically. modifyenv
returns whatever
the BLOCK returned.
- should also support a tied hash interface.
- setenv requires mysql (actually a replace command), but it's so much easier & faster that way.
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/