[Bps-public-commit] Prophet branch, config-gitlike, updated. 35ff302990eeee5a6a7099b770e27fda9894ba03
jesse
jesse at bestpractical.com
Mon Jul 6 17:43:43 EDT 2009
The branch, config-gitlike has been updated
via 35ff302990eeee5a6a7099b770e27fda9894ba03 (commit)
from 6e48c78ac98acf607203a2fac0f3b5067ddc13db (commit)
Summary of changes:
lib/Prophet/CLIContext.pm | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 35ff302990eeee5a6a7099b770e27fda9894ba03
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jul 6 17:43:28 2009 -0400
looser uuid regex, factor out a set_id method
diff --git a/lib/Prophet/CLIContext.pm b/lib/Prophet/CLIContext.pm
index 609e68d..244e02c 100644
--- a/lib/Prophet/CLIContext.pm
+++ b/lib/Prophet/CLIContext.pm
@@ -143,7 +143,7 @@ The regex to use for matching the id argument (luid / uuid).
=cut
-our $ID_REGEX = '(?:\d+|[A-Za-z0-9\-\_]{22}|[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})';
+our $ID_REGEX = qr'(?:\d+|[A-Za-z0-9\-\_]{22}|[0-9a-fA-F\-]{32,36})';
=head2 setup_from_args
@@ -312,12 +312,20 @@ sub set_type {
sub set_id_from_primary_commands {
my $self = shift;
-
+
if ( (my $id = pop @{$self->primary_commands}) =~ $ID_REGEX ) {
- $self->set_arg( id => $id );
- $self->set_uuid;
+ $self->set_id($id);
}
+
}
+sub set_id {
+ my $self = shift;
+ my $id = shift;
+ $self->set_arg( id => $id );
+ $self->set_uuid;
+}
+
+
__PACKAGE__->meta->make_immutable;
no Any::Moose;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list