[Bps-public-commit] r16909 - in Path-Dispatcher/trunk: lib/Path/Dispatcher
sartak at bestpractical.com
sartak at bestpractical.com
Tue Nov 18 19:17:09 EST 2008
Author: sartak
Date: Tue Nov 18 19:17:08 2008
New Revision: 16909
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher/Path.pm
Log:
r75769 at onn: sartak | 2008-11-18 19:17:06 -0500
Support for single string arg in new: Path::Dispatcher::Path->new("/my/path")
Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Path.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Path.pm (original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Path.pm Tue Nov 18 19:17:08 2008
@@ -14,6 +14,18 @@
predicate => 'has_metadata',
);
+# allow Path::Dispatcher::Path->new($path)
+around BUILDARGS => sub {
+ my $orig = shift;
+ my $self = shift;
+
+ if (@_ == 1 && !ref($_[0])) {
+ unshift @_, 'path';
+ }
+
+ $self->$orig(@_);
+};
+
__PACKAGE__->meta->make_immutable;
no Moose;
More information about the Bps-public-commit
mailing list