[Bps-public-commit] r14646 - in Path-Dispatcher/trunk: lib/Path/Dispatcher t
sartak at bestpractical.com
sartak at bestpractical.com
Wed Jul 30 14:41:03 EDT 2008
Author: sartak
Date: Wed Jul 30 14:41:02 2008
New Revision: 14646
Added:
Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm
Path-Dispatcher/trunk/t/100-declarative.t
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/Makefile.PL
Log:
r68073 at onn: sartak | 2008-07-30 14:40:56 -0400
Begin Path::Dispatcher::Declarative
Modified: Path-Dispatcher/trunk/Makefile.PL
==============================================================================
--- Path-Dispatcher/trunk/Makefile.PL (original)
+++ Path-Dispatcher/trunk/Makefile.PL Wed Jul 30 14:41:02 2008
@@ -5,6 +5,7 @@
requires 'Moose';
requires 'MooseX::AttributeHelpers';
+requires 'Sub::Exporter';
build_requires 'Test::More';
Added: Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm Wed Jul 30 14:41:02 2008
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+package Path::Dispatcher::Declarative;
+use strict;
+use warnings;
+use Sub::Exporter;
+
+my $exporter = Sub::Exporter::build_exporter({
+ exports => {
+ },
+ groups => {
+ default => [':all'],
+ },
+
+});
+
+sub import {
+ my $self = shift;
+ my $pkg = caller;
+ my @args = grep { !/^-[Bb]ase/ } @_;
+
+ # they must have specified '-base' if there are no args
+ if (@args != @_) {
+ no strict 'refs';
+ push @{ $pkg . '::ISA' }, $self
+ }
+
+ $exporter->($self, @args);
+}
+
+1;
+
Added: Path-Dispatcher/trunk/t/100-declarative.t
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/t/100-declarative.t Wed Jul 30 14:41:02 2008
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+do {
+ package MyApp::Dispatcher;
+ use Path::Dispatcher::Declarative -base;
+};
+
+ok(MyApp::Dispatcher->isa('Path::Dispatcher::Declarative'), "use Path::Dispatcher::Declarative -base sets up ISA");
+
+do {
+ package MyApp::Dispatcher::NoBase;
+ use Path::Dispatcher::Declarative;
+};
+
+ok(!MyApp::Dispatcher::NoBase->isa('Path::Dispatcher::Declarative'), "use Path::Dispatcher::Declarative without -base does not set up ISA");
+
More information about the Bps-public-commit
mailing list