[Bps-public-commit] r14247 - in Prophet/trunk/lib/Prophet: CLI CLI/Command
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jul 17 22:58:21 EDT 2008
Author: jesse
Date: Thu Jul 17 22:58:21 2008
New Revision: 14247
Modified:
Prophet/trunk/lib/Prophet/CLI/Command/Search.pm
Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm
Prophet/trunk/lib/Prophet/Collection.pm
Prophet/trunk/lib/Prophet/Record.pm
Log:
* Starting to get an app_handle into our records
Modified: Prophet/trunk/lib/Prophet/CLI/Command/Search.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Search.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Search.pm Thu Jul 17 22:58:21 2008
@@ -10,6 +10,7 @@
my $class = $self->_get_record_class->collection_class;
Prophet::App->require_module($class);
my $records = $class->new(
+ app_handle => $self->app_handle,
handle => $self->app_handle->handle,
type => $self->type
);
Modified: Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI/RecordCommand.pm Thu Jul 17 22:58:21 2008
@@ -21,7 +21,7 @@
sub _get_record_class {
my $self = shift;
- my $args = { handle => $self->cli->app_handle->handle, type => $self->type };
+ my $args = { app_handle => $self->cli->app_handle, handle => $self->cli->app_handle->handle, type => $self->type };
if (my $class = $self->record_class ) {
Prophet::App->require_module($class);
return $class->new( $args);
Modified: Prophet/trunk/lib/Prophet/Collection.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Collection.pm (original)
+++ Prophet/trunk/lib/Prophet/Collection.pm Thu Jul 17 22:58:21 2008
@@ -7,6 +7,12 @@
use overload '@{}' => sub { shift->items }, fallback => 1;
use constant record_class => 'Prophet::Record';
+has app_handle => (
+ is => 'rw',
+ isa => 'Maybe[Prophet::App]',
+ required => 0
+);
+
has handle => (
is => 'rw',
isa => 'Prophet::Replica',
@@ -73,7 +79,7 @@
# run coderef against each item;
# if it matches, add it to items
foreach my $key (@$records) {
- my $record = $self->record_class->new( { handle => $self->handle, type => $self->type } );
+ my $record = $self->record_class->new( { app_handle => $self->app_handle, handle => $self->handle, type => $self->type } );
$record->load( uuid => $key );
if ( $coderef->($record) ) {
$self->add_item($record);
Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm (original)
+++ Prophet/trunk/lib/Prophet/Record.pm Thu Jul 17 22:58:21 2008
@@ -18,6 +18,12 @@
=cut
+has app_handle => (
+ isa => 'Maybe[Prophet::App]',
+ is => 'rw',
+ required => 0,
+);
+
has handle => (
is => 'rw',
required => 1,
More information about the Bps-public-commit
mailing list