[COMMIT LOGREPORT] service/all/lib/Lire ImportJob.pm,1.11,1.12 DlfConverterProcess.pm,1.15,1.16

Francis J. Lacoste flacoste at users.sourceforge.net
Tue Jun 21 16:58:14 CEST 2005


Update of /cvsroot/logreport/service/all/lib/Lire
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19879/all/lib/Lire

Modified Files:
	ImportJob.pm DlfConverterProcess.pm 
Log Message:
Added a $time parameter for the ImportJob.


Index: ImportJob.pm
===================================================================
RCS file: /cvsroot/logreport/service/all/lib/Lire/ImportJob.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ImportJob.pm	29 Jun 2004 18:37:03 -0000	1.11
+++ ImportJob.pm	21 Jun 2005 14:57:59 -0000	1.12
@@ -281,19 +281,23 @@
 
 =pod
 
-=head2 run( $store )
+=head2 run( $store, [$time] )
 
-Runs this ImportJob and import it into the $store DlfStore.
+Runs this ImportJob and import it into the $store DlfStore. The $time
+parameter will be used to determine the time window covered by period.
+It defaults to the current time.
 
 =cut
 
 sub run {
-    my ( $self, $store ) = @_;
+    my ( $self, $store, $time ) = @_;
 
     check_object_param( $store, 'store', 'Lire::DlfStore' );
 
+    $time ||= time();
+
     my $process = new Lire::DlfConverterProcess( $self, $store );
-    $process->run_import_job();
+    $process->run_import_job( $time );
 
     my $converter = Lire::PluginManager->get_plugin( 'dlf_converter',
                                                      $self->{'_converter'} );

Index: DlfConverterProcess.pm
===================================================================
RCS file: /cvsroot/logreport/service/all/lib/Lire/DlfConverterProcess.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DlfConverterProcess.pm	7 Jun 2004 16:42:04 -0000	1.15
+++ DlfConverterProcess.pm	21 Jun 2005 14:58:00 -0000	1.16
@@ -67,21 +67,24 @@
 
 =pod
 
-=head2 run_import_job()
+=head2 run_import_job( [$time] )
 
 Import the log data from ImportJob as DLF. This method will throw an
-exception if it is called more than once.
+exception if it is called more than once. The $time parameter will be
+used to determine the time window covered by period. It defaults to the
+current time.
 
 =cut
 
 sub run_import_job {
-    my $self = $_[0];
+    my ( $self, $time ) = @_;
 
+    $time ||= time;
     croak $self->{'_job'}->name(), " ImportJob was already processed"
       if $self->{'_convert_called'};
 
     $self->{'_job_id'} = $self->{'_job'}->name() . '-' .
-      strftime( "%Y%m%d_%H%M%S", localtime )
+      strftime( "%Y%m%d_%H%M%S", localtime $time )
         unless exists $self->{'_job_id'};
 
     $self->{'_time_start'} = time;

-- 
To UNSUBSCRIBE, email to commit-request at logreport.org with a subject of 
"unsubscribe". Trouble? Send an email with subject "help" to 
commit-request at logreport.org



More information about the Commit mailing list