[Bps-public-commit] r14855 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Wed Aug 6 12:49:43 EDT 2008
Author: sartak
Date: Wed Aug 6 12:49:40 2008
New Revision: 14855
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/App.pm
Prophet/trunk/lib/Prophet/CLI.pm
Prophet/trunk/lib/Prophet/Record.pm
Log:
r68871 at onn: sartak | 2008-08-06 12:49:18 -0400
Revert mismerge
Modified: Prophet/trunk/lib/Prophet/App.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/App.pm (original)
+++ Prophet/trunk/lib/Prophet/App.pm Wed Aug 6 12:49:40 2008
@@ -60,7 +60,7 @@
for my $package ( $self->app_replica_types) {
$self->require($package);
next unless $package->can('scheme');
- Prophet::Replica->register_replica_scheme(scheme => $package->scheme, class => $package)
+ Prophet::Replica->register_replica_scheme(scheme => $package->scheme, class => $package)
}
}
@@ -87,16 +87,16 @@
my $self = shift;
my %args = ( module => undef, quiet => undef, @_);
my $class = $args{'module'};
-
+
# Quick hack to silence warnings.
# Maybe some dependencies were lost.
unless ($class) {
warn sprintf("no class was given at %s line %d\n", (caller)[1,2]);
return 0;
- }
-
+ }
+
return 1 if $self->already_required($class);
-
+
# .pm might already be there in a weird interaction in Module::Pluggable
my $file = $class;
$file .= ".pm"
@@ -122,6 +122,18 @@
return 1;
}
+=head2 already_required class
+
+Helper function to test whether a given class has already been require'd.
+
+=cut
+
+sub already_required {
+ my ($self, $class) = @_;
+ my $path = join('/', split(/::/,$class)).".pm";
+ return ( $INC{$path} ? 1 : 0);
+}
+
__PACKAGE__->meta->make_immutable;
no Moose;
Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI.pm Wed Aug 6 12:49:40 2008
@@ -340,17 +340,17 @@
}
}
-=head2 run_another_command ( args => $hashref, props => $hashref, type => 'str' )
+=head2 change_attributes ( args => $hashref, props => $hashref, type => 'str' )
-A hook for running a second command from within a command without having
-to use the commandline argument parsing.
+A hook for running a second command from within a command without having
+to use the commandline argument parsing.
If C<type>, C<uuid>, or C<primary_commands> are not passed in, the values
from the previous command run are used.
=cut
-sub run_another_command {
+sub change_attributes {
my $self = shift;
my %args = @_;
@@ -366,9 +366,10 @@
}
}
if (my $props = $args{props}) {
- foreach my $prop (keys %$props) {
- $self->set_prop($prop => $props->{$prop});
- $self->add_to_prop_set($prop);
+ foreach my $prop (@$props) {
+ my $key = $prop->{prop};
+ my $value = $prop->{value};
+ $self->set_prop($key => $value);
}
}
if (my $type = $args{type}) {
@@ -378,9 +379,6 @@
if (my $primary_commands = $args{primary_commands}) {
$self->primary_commands($primary_commands);
}
- if ( my $cmd_obj = $self->_get_cmd_obj() ) {
- $cmd_obj->run();
- }
}
=head2 clear_args
@@ -392,7 +390,7 @@
sub clear_args {
my $self = shift;
- foreach my $arg ($self->args) {
+ foreach my $arg ($self->arg_names) {
$self->delete_arg($arg);
}
}
@@ -406,7 +404,7 @@
sub clear_props {
my $self = shift;
- foreach my $prop ($self->props) {
+ foreach my $prop ($self->prop_names) {
$self->delete_prop($prop);
}
$self->prop_set( ( ) );
Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm (original)
+++ Prophet/trunk/lib/Prophet/Record.pm Wed Aug 6 12:49:40 2008
@@ -281,7 +281,7 @@
=head2 prop $name
-Returns the current value of the property C<$name> for this record.
+Returns the current value of the property C<$name> for this record.
(This is a convenience method wrapped around L</get_props>.
=cut
@@ -294,7 +294,7 @@
=head2 delete_prop { name => $name }
-Deletes the current value for the property $name.
+Deletes the current value for the property $name.
TODO: how is this different than setting it to an empty value?
@@ -436,7 +436,8 @@
=head2 default_props $props_ref
Takes a reference to a hash of props and looks up the defaults for those
-props, if they exist. Sets the values of the props in the hash to the defaults.
+props, if they exist (by way of C<default_prop_$prop> routines). Sets the
+values of the props in the hash to the defaults.
=cut
@@ -459,7 +460,8 @@
=head2 _default_summary_format
-returns a formatted string that is the summary for the record.
+A string of the default summary format for record types that do not
+define their own summary format.
A summary format should consist of format_string,field pairs, separated
by | characters.
@@ -564,7 +566,7 @@
=head2 format_summary
Returns a formatted string that is the summary for the record. In an
-array context, returns a list of
+array context, returns a list of
=cut
More information about the Bps-public-commit
mailing list