[Bps-public-commit] r11469 - in SVN-PropDB: bin
clkao at bestpractical.com
clkao at bestpractical.com
Thu Apr 3 23:02:39 EDT 2008
Author: clkao
Date: Thu Apr 3 23:02:39 2008
New Revision: 11469
Modified:
SVN-PropDB/bin/sd
SVN-PropDB/lib/Prophet/CLI.pm
SVN-PropDB/lib/Prophet/Record.pm
Log:
more cleanups.
Modified: SVN-PropDB/bin/sd
==============================================================================
--- SVN-PropDB/bin/sd (original)
+++ SVN-PropDB/bin/sd Thu Apr 3 23:02:39 2008
@@ -21,7 +21,8 @@
sub validate_status {
my ($self, %args) = @_;
-
+ # XXX: validater not called when a value is unset, so can't do
+ # mandatory check here
return 1 if scalar grep { $args{props}{status} eq $_ }
qw(new open closed stalled);
@@ -55,19 +56,11 @@
use constant record_class => 'SVB::Model::Ticket';
-
package SVB::Collection::Comment;
use base 'Prophet::Collection';
use constant record_class => 'SVB::Model::Comment';
-sub new {
- my $class = shift;
- my %args = @_;
- return $class->SUPER::new({ %args, type => $class->record_class->record_type });
-}
-
-
package main;
use Prophet::CLI;
Modified: SVN-PropDB/lib/Prophet/CLI.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/CLI.pm (original)
+++ SVN-PropDB/lib/Prophet/CLI.pm Thu Apr 3 23:02:39 2008
@@ -168,8 +168,10 @@
}
sub _get_record {
- my $self = shift;
- return $self->record_class->new( { handle => $self->handle } );
+ my $self = shift;
+ return $self->record_class->new( { handle => $self->handle,
+ type => $self->type,
+ } );
}
sub do_create {
@@ -191,7 +193,7 @@
}
my $record = $cli->_get_record;
- my $records = $record->collection_class->new( handle => $cli->handle );
+ my $records = $record->collection_class->new( handle => $cli->handle, type => $cli->type );
$records->matching(
sub {
my $item = shift;
Modified: SVN-PropDB/lib/Prophet/Record.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Record.pm (original)
+++ SVN-PropDB/lib/Prophet/Record.pm Thu Apr 3 23:02:39 2008
@@ -37,6 +37,7 @@
my $class = shift;
my $self = bless {}, $class;
my $args = ref($_[0]) ? $_[0] : { @_ };
+ Carp::cluck unless $args->{type};
$args->{type} ||= $class->record_type;
my %args = validate( @{[%$args]}, { handle => 1, type => 1 } );
$self->$_( $args{$_} ) for keys(%args);
More information about the Bps-public-commit
mailing list