[Orca-checkins] rev 254 - in trunk/orca: lib/Orca orca

Blair Zajac blair at orcaware.com
Sat Oct 4 14:33:39 PDT 2003


Author: blair
Date: Sat Oct  4 14:33:04 2003
New Revision: 254

Modified:
   trunk/orca/lib/Orca/Utils.pm
   trunk/orca/orca/orca.pl.in
Log:
Move utility functions from orca/orca.pl.in to lib/Orca/Utils.pm.
* orca/orca.pl.in:
  Move &running_stats and rename it to &print_running_stats and move
  &capatialize ...
* lib/Orca/Utils.pm:
  ... to here.


Modified: trunk/orca/lib/Orca/Utils.pm
==============================================================================
--- trunk/orca/lib/Orca/Utils.pm	(original)
+++ trunk/orca/lib/Orca/Utils.pm	Sat Oct  4 14:33:04 2003
@@ -14,14 +14,25 @@
 use Orca::SourceFileIDs qw(new_fids);
 use vars qw(@EXPORT_OK @ISA $VERSION);
 
- at EXPORT_OK = qw(email_message
-                gcd name_to_fsname
+ at EXPORT_OK = qw(capatialize
+                email_message
+                gcd
+                name_to_fsname
                 perl_glob
+                print_running_stats
                 recursive_mkdir
                 unique);
 @ISA       = qw(Exporter);
 $VERSION   = substr q$Revision: 0.01 $, 10;
 
+# Take a string and capatialize only the first character of the
+# string.
+sub capatialize {
+  my $string = shift;
+  substr($string, 0, 1) = uc(substr($string, 0, 1));
+  $string;
+}
+
 # Email the list of people a message.
 sub email_message {
   my ($people, $subject) = @_;
@@ -188,6 +199,23 @@
   return @_ ? @results : new_fids(@results);
 }
 
+# Print a message on the statistics of this running process.  Note the
+# starting time of the script.
+my $start_time = time;
+sub print_running_stats {
+  my $ps_self = '@PS_SELF@';
+  if ($ps_self) {
+    $ps_self =~ s/PID/$$/g;
+    system($ps_self);
+  }
+
+  my $time_span = time - $start_time;
+  my $minutes   = int($time_span/60);
+  my $seconds   = $time_span - 60*$minutes;
+
+  printf "Current running time is %d:%02d minutes.\n", $minutes, $seconds;
+}
+
 # Given a directory name, attempt to make all necessary directories.
 sub recursive_mkdir {
   my $dir = shift;

Modified: trunk/orca/orca/orca.pl.in
==============================================================================
--- trunk/orca/orca/orca.pl.in	(original)
+++ trunk/orca/orca/orca.pl.in	Sat Oct  4 14:33:04 2003
@@ -58,14 +58,15 @@
 use Orca::OldState      qw($orca_old_state
                            load_old_state
                            save_old_state);
-use Orca::Utils         qw(name_to_fsname perl_glob unique);
+use Orca::Utils         qw(capatialize
+                           name_to_fsname
+                           perl_glob
+                           print_running_stats
+                           unique);
 use Orca::SourceFile;
 use Orca::SourceFileIDs qw(@sfile_fids);
 use Orca::HTMLFile      qw($html_hr);
 
-# Note the starting time of the script.
-my $start_time = time;
-
 # Remember the original working directory because it will be needed to
 # remove the locking directory.
 my $start_cwd = cwd;
@@ -231,7 +232,7 @@
 
   # Print the given message and any running statistics.
   if ($can_print) {
-    &running_stats;
+    &print_running_stats if $opt_verbose;
     print $message if $message;
   }
 
@@ -371,7 +372,7 @@
       }
     }
 
-    &running_stats;
+    &print_running_stats if $opt_verbose;
 
     # Because the amount of data loaded from the source data files can
     # be large, go through each subgroup of source files, load all of
@@ -540,14 +541,6 @@
   }
 }
 
-# Take a string and capatialize only the first character of the
-# string.
-sub capatialize {
-  my $string = shift;
-  substr($string, 0, 1) = uc(substr($string, 0, 1));
-  $string;
-}
-
 # Sort subgroup names depending upon the type of characters in the
 # group's name.
 sub sort_subgroup_names {
@@ -1138,23 +1131,6 @@
   return ($found_new_files, \%new_found_files, \@subgroup_fids);
 }
 
-# Print a message on the statistics of this running process.
-sub running_stats {
-  return unless $opt_verbose;
-
-  my $ps_self = '@PS_SELF@';
-  if ($ps_self) {
-    $ps_self =~ s/PID/$$/g;
-    system($ps_self);
-  }
-
-  my $time_span = time - $start_time;
-  my $minutes   = int($time_span/60);
-  my $seconds   = $time_span - 60*$minutes;
-
-  printf "Current running time is %d:%02d minutes.\n", $minutes, $seconds;
-}
-
 __END__
 
 =pod



More information about the Orca-checkins mailing list