[Bps-public-commit] r11897 - in sd/trunk/lib/App/SD/Replica: RT

jesse at bestpractical.com jesse at bestpractical.com
Fri Apr 25 16:03:15 EDT 2008


Author: jesse
Date: Fri Apr 25 16:03:12 2008
New Revision: 11897

Modified:
   sd/trunk/lib/App/SD/Replica/Hiveminder.pm
   sd/trunk/lib/App/SD/Replica/RT.pm
   sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm

Log:
* don't explode if you're missing foriegn replica type deps. (also, delay load them for faster startup)

Modified: sd/trunk/lib/App/SD/Replica/Hiveminder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/Hiveminder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/Hiveminder.pm	Fri Apr 25 16:03:12 2008
@@ -5,13 +5,10 @@
 use base qw/Prophet::ForeignReplica/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
-
-use Net::Jifty;
-
 use URI;
 use Memoize;
 use Prophet::ChangeSet;
-use App::SD::Replica::Hiveminder::PullEncoder;
+
 
 __PACKAGE__->mk_accessors(qw/hm_username hm hm_url/);
 use constant scheme => 'hm';
@@ -28,6 +25,9 @@
 
 sub setup {
     my $self = shift;
+
+    require Net::Jifty;
+    require App::SD::Replica::Hiveminder::PullEncoder;
     my ($server) = $self->{url} =~ m/^(.*?)$/
         or die "Can't parse hiveminder server spec";
     my $uri = URI->new($server);

Modified: sd/trunk/lib/App/SD/Replica/RT.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/RT.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/RT.pm	Fri Apr 25 16:03:12 2008
@@ -5,13 +5,10 @@
 use base qw/Prophet::ForeignReplica/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
-use RT::Client::REST       ();
-use RT::Client::REST::User ();
-use RT::Client::REST::Ticket;
-use Memoize;
 use Prophet::ChangeSet;
-use App::SD::Replica::RT::PullEncoder;
 
+
+use Memoize;
 use constant scheme => 'rt';
 
 __PACKAGE__->mk_accessors(qw/rt rt_url rt_queue rt_query/);
@@ -74,6 +71,14 @@
 
 sub setup {
     my $self = shift;
+    
+    # Require rather than use to defer load
+    require RT::Client::REST       ;
+    require RT::Client::REST::User ;
+    require RT::Client::REST::Ticket;
+
+
+
     my ( $server, $type, $query ) = $self->{url} =~ m/^(.*?)\|(.*?)\|(.*)$/
         or die "Can't parse rt server spec";
     my $uri = URI->new($server);
@@ -320,6 +325,7 @@
 
     my $first_rev = ( $args{'after'} + 1 ) || 1;
 
+    require App::SD::Replica::RT::PullEncoder;
     my $recoder = App::SD::Replica::RT::PullEncoder->new( { sync_source => $self } );
     for my $id ( $self->find_matching_tickets ) {
 

Modified: sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm	Fri Apr 25 16:03:12 2008
@@ -5,9 +5,6 @@
 use base qw/Class::Accessor/;
 use Params::Validate qw(:all);
 use UNIVERSAL::require;
-use RT::Client::REST       ();
-use RT::Client::REST::User ();
-use RT::Client::REST::Ticket;
 
 use Memoize;
 



More information about the Bps-public-commit mailing list