Index: /trunk/tools/czartool/Burntool.pm
===================================================================
--- /trunk/tools/czartool/Burntool.pm	(revision 29048)
+++ /trunk/tools/czartool/Burntool.pm	(revision 29048)
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -w
+package czartool::Burntool;
+
+use warnings;
+use strict;
+
+use IPC::Cmd 0.36 qw( can_run run );
+
+###########################################################################
+#
+# Constructor
+#
+###########################################################################
+sub new {
+    my $class = shift;
+    my $self = {};
+    $self->{_verbose} = 0;
+
+    # get today's date
+    my ($day, $month, $year) = (localtime)[3,4,5];
+    $self->{_today} = sprintf("%04d-%02d-%02d", $year+1900, $month+1, $day);
+
+    bless $self, $class;
+    return $self;
+}
+
+###########################################################################
+#
+# Get pending and processed for this label
+#
+###########################################################################
+sub getPendingAndProcessed {
+    my ($self, $label, $pending, $processed) = @_;
+
+    ${$pending} = ${$processed} = 0;
+
+    my $target = undef;
+
+    if ($label =~ m/(.*)\.nightlyscience/) {
+
+        $target = $1;
+    }
+    else {return 0;}
+
+
+    if ($self->{_verbose}) {print "Checking $target for $self->{_today}\n";}
+    my $command = "automate_stacks.pl --check_chips --burntool_stats --this_target_only $target --date $self->{_today} ";
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $self->{_verbose});
+
+    if (!$success) {return 0;}
+
+    my $line;
+    foreach $line (@{$stdout_buf}) {
+
+        chomp($line);
+        if($line =~ m/([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)/) {
+            if ($self->{_verbose}) {print "Output =  $1 $2 $3 $4\n";}
+            ${$pending} = ($2 - $3)/60;
+            ${$processed} = $3/60;
+            return 1;
+        }
+    }
+
+    return 0;
+}
+1;
+
+
