[Bps-public-commit] r14836 - in Prophet/trunk: .
spang at bestpractical.com
spang at bestpractical.com
Tue Aug 5 20:18:03 EDT 2008
Author: spang
Date: Tue Aug 5 20:17:50 2008
New Revision: 14836
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm
Log:
r47748 at loki: spang | 2008-08-06 00:19:11 +0100
podify RecordCommand
Modified: Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm Tue Aug 5 20:17:50 2008
@@ -19,6 +19,16 @@
isa => 'Prophet::Record',
);
+=head2 _get_record_class [{ type => 'type' }]
+
+Tries to determine a record class from either the given type argument or
+the current object's C<$type> attribute.
+
+Returns a new instance of the record class on success, or throws a fatal
+error with a stack trace on failure.
+
+=cut
+
sub _get_record_class {
my $self = shift;
my %args = validate(@_, {
@@ -44,14 +54,30 @@
}
}
+=head2 _load_record
+
+Attempts to load the record specified by the C<uuid> attribute.
+
+Returns the loaded record on success, or throws a fatal error if no
+record can be found.
+
+=cut
+
sub _load_record {
my $self = shift;
my $record = $self->_get_record_class;
- $record->load( uuid => $self->uuid )
+ $record->load( uuid => $self->uuid )
|| $self->fatal_error("I couldn't find the record " . $self->uuid);
return $record;
}
+=head2 _type_to_record_class $type
+
+Takes a type and tries to figure out a record class name from it.
+Returns C<'Prophet::Record'> if no better class name is found.
+
+=cut
+
sub _type_to_record_class {
my $self = shift;
my $type = shift;
More information about the Bps-public-commit
mailing list