[Bps-public-commit] Prophet branch, master, updated. 0.73-22-gee3fe65

Ruslan Zakirov ruz at bestpractical.com
Sat Dec 19 20:51:35 EST 2009


The branch, master has been updated
       via  ee3fe65def473fbfa6b1e273513943b9c764fd9f (commit)
       via  b47c06709b8f6ce0e850fa35520337873b890cc5 (commit)
      from  f51e719e322aae1f2e1e101c2943744cef8c9b00 (commit)

Summary of changes:
 lib/Prophet/CLI.pm                    |   23 ++++++++++++++++++-----
 lib/Prophet/Replica/FS/Backend/LWP.pm |    2 +-
 2 files changed, 19 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit b47c06709b8f6ce0e850fa35520337873b890cc5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Dec 20 04:49:53 2009 +0300

    allow apps to skip overriding dispatcher_class

diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index 412153c..f344514 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -16,6 +16,20 @@ has app_class => (
     default => 'Prophet::App',
 );
 
+has dispatcher_class => (
+    is      => 'rw',
+    isa     => 'ClassName',
+    lazy    => 1,
+    default => sub {
+        my $self = shift;
+
+        my $app_class = $self->app_class;
+        my $class = $app_class .'::CLI::Dispatcher';
+        return $class if $app_class->try_to_require( $class );
+        return 'Prophet::CLI::Dispatcher';
+    },
+);
+
 has record_class => (
     is      => 'rw',
     isa     => 'ClassName',
@@ -61,12 +75,11 @@ handles the subcommand for a particular type
 
 =head2 dispatcher_class -> Class
 
-Returns the dispatcher used to dispatch command lines. You'll want to override
-this in your subclass.
-
-=cut
+Returns class name of the dispatcher used to dispatch command lines.
+By default app_class::CLI::Dispatcher is used if it can be loaded
+otherwise L<Prophet::CLI::Dispatcher>. Override using:
 
-sub dispatcher_class { "Prophet::CLI::Dispatcher" }
+    has '+dispatcher_class' => ( default => 'MyApp::Dispatcher' );
 
 =head2 run_one_command
 

commit ee3fe65def473fbfa6b1e273513943b9c764fd9f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Dec 20 04:50:39 2009 +0300

    return that file doesn't exist only when lwp_get returns undef

diff --git a/lib/Prophet/Replica/FS/Backend/LWP.pm b/lib/Prophet/Replica/FS/Backend/LWP.pm
index 6f890b3..56d4423 100644
--- a/lib/Prophet/Replica/FS/Backend/LWP.pm
+++ b/lib/Prophet/Replica/FS/Backend/LWP.pm
@@ -59,7 +59,7 @@ sub append_to_file {
 sub file_exists {
 	my $self = shift;
     my ($file) = validate_pos( @_, 1 );
-        return $self->read_file($file) ? 1 : 0;
+        return defined $self->read_file($file) ? 1 : 0;
 }
 
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list