-
-
23 Sep 2014 20:15:05 UTC
- Distribution: DBIx-VersionedSubs
- Module version: 0.08
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (1)
- Testers (380 / 0 / 0)
- Kwalitee
Bus factor: 1- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (15.96KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Class::Data::Inheritable
- DBD::SQLite
- HTTP::Server::Simple
- Template
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
DBIx::VersionedSubs::Hash - store subroutines in a simple hash
SYNOPSIS
package My::App; use strict; use base 'DBIx::VersionedSubs::Hash'; __PACKAGE__->{code} = { say_hello => sub {print "Hello World"}, }; package main; use strict; my $app = My::App->new({code => {},dsn => $dsn ); while (my $request = Some::Server->get_request) { $app->update_code(); # update code from the DB $app->handle_request->($request); }
ABSTRACT
This module overrides some methods in DBIx::VersionedSubs and replaces the normal namespace based code storage with simple storage in a hash. This is useful if you want multiple code versions in a mod_perl environment for example.
Package->new({ %ARGS })
Creates a new object and initializes it from the class default values as inherited from DBIx::VersionedSubs.
If you pass in a hashref to the
code
key, all subroutines will be stored in it. You can also use this feature to pass in a package hash (like%My::App::
), then this module will be almost identical in usage to DBIx::VersionedSubs itself. The difference between the two is that subroutine names with characters outside of\w
will not create subroutines in other namespaces with this module.$app->dispatch( FUNCTION, ARGS )
This is a shorthand method for
return $self->{code}->{$function}->(@ARGS);
except with error checking
AUTHOR
Max Maischein, <corion@cpan.org>
LICENSE
This module is licensed under the same terms as Perl itself.
Module Install Instructions
To install DBIx::VersionedSubs, copy and paste the appropriate command in to your terminal.
cpanm DBIx::VersionedSubs
perl -MCPAN -e shell install DBIx::VersionedSubs
For more information on module installation, please visit the detailed CPAN module installation guide.