[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GT] SVN Commit r587 - trunk/Scripts



Author: ras
Date: 2008-03-22 06:49:29 +0100 (Sat, 22 Mar 2008)
New Revision: 587

Modified:
   trunk/Scripts/scan.pl
Log:
this change:
   i) adds the missing pieces of code
  ii) tweaks a trailing blank or two; changes empty string
      to '' from ""
 iii) changes the text format separator 
      to ' - ' (space hyphen space)
      from '	 ' (tab space) between code and company name
  iv) renames internal sub local_parse_date_str from parse_date_str
      scan.pl will rely on parse_date_str in gt::tools



Modified: trunk/Scripts/scan.pl
===================================================================
--- trunk/Scripts/scan.pl	2008-03-21 04:14:21 UTC (rev 586)
+++ trunk/Scripts/scan.pl	2008-03-22 05:49:29 UTC (rev 587)
@@ -299,7 +299,7 @@
 #         plus reading all the filenames on command line including stdin
 my @list_systems = ();
 my $systems = {};
-my $buf = "";
+my $buf = '';
 foreach my $line (@desc_systems) {
 
     chomp($line);
@@ -413,8 +413,16 @@
     my $code = $list->get($d);
 
     my $db = create_standard_object("DB::" . GT::Conf::get("DB::module"));
-	my ($q, $calc) = get_timeframe_data($code,$timeframe,$db);
+    my $q = $db->get_prices($code);
+    my $calc = GT::Calculator->new($q);
+    $calc->set_code($code);
 
+    if ($timeframe)
+    {
+	$calc->set_current_timeframe(
+	            GT::DateTime::name_to_timeframe($timeframe));
+    }
+
     my $c = $calc->prices->count;
     my $last = $c - 1;
     my $first = $c - 2 * GT::DateTime::timeframe_ratio($YEAR,
@@ -470,7 +478,7 @@
     }
 
     $db->disconnect;
-    # Close the child 
+    # Close the child
     exit 0;
 }
 
@@ -554,7 +562,7 @@
 	}
 	print "</li>\n";
     } else {
-	print " $code - $name\n";
+	print " $code\t $name\n";
     }
 }
 
@@ -583,7 +591,10 @@
 }
 
 
-sub parse_date_str {
+# 
+# rename this parse_date_str -- the one being used resides in GT/Tools "timeframe
+# 
+sub local_parse_date_str {
   #
   # inputs: date string reference var required
   #         error string reference var (optional)