Contentment::Context - Contextual information for a Contentment request
package Contentment::MyModule; use strict; use warnings; sub Contentment::Context::my_module { my $ctx = shift; return $ctx->{my_module}; } 1;
The context contains information about the application and the current request-response cycle.
If you need access to the current context object, you can always retrieve it by calling:
my $context = Contentment->context;
See Contentment for details.
To create your own context methods, just drop a method into the Contentment::Context class from your own module:
sub Contentment::Context::my_method { 1 }
It's recommended that your method throw an exception on error or if it is accessed before it becomes available or after it is no longer available. This will help during debugging.
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
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.
To install Contentment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contentment
CPAN shell
perl -MCPAN -e shell install Contentment
For more information on module installation, please visit the detailed CPAN module installation guide.