=head1 NAME GUI for gus_tek_csv_merge.pl =head1 VERSION Version 0.01 =head1 SYNOPSIS perl gus_csv_merge_EasyGUI.pl =head1 DESCRIPTION Outboard GUI for Perl script gus_tek_csv_merge.pl which is command-line only and available separately. =head1 DEPENDENCIES This script has Perl module dependencies one of which is not yet on CPAN. Download it from here. http://starling.us/tet/gus_perl_modules/index.xml#Tk-EasyGUI =head1 AUTHOR Gan Uesli Starling > =head1 COPYRIGHT Copyright (c) 2007 Gan Uesli Starling.. All rights reserved. This program is free software; you may redistribute and/or edit it under the same terms as Perl itself. =cut use strict; use warnings; use Cwd; use Tk; use Tk::EasyGUI qw(:all); my ($VERSION) = '$Revision: 0.01 $' =~ m{ \$Revision: \s+ (\S+) }xm; chdir cwd(); my $path_csv_1 = 'TEK00000.CSV'; my $chans_1 = '0, 1'; my $path_csv_2 = 'TEK00001.CSV'; my $chans_2 = '1'; my $path_script = 'gus_tek_csv_merge.pl'; my $graph_title = 'Trigger Timing at 10% Duty Cycle'; my $path_log = ; my $mw = Tk::EasyGUI::init("Perl Script AutoGUI - $VERSION", \&append_log); my @tk_ent = ( ['Perl Script', 'po', \$path_script ], ['CSV 1', 'po', \$path_csv_1 ], ['Chans 1', 'i,i', \$chans_1 ], ['CSV 2', 'po', \$path_csv_2 ], ['Chans 2', 'i,i', \$chans_2 ], ['Graph Title', 's', \$graph_title ], ); my $wgt_1 = column_of_entries( $mw, 'RunPerl Script', \@tk_ent ); my $run_me = sub { submit_entries($wgt_1); system( "$path_script", '--csv_1', "$path_csv_1", '--chans_1', "$chans_1", '--csv_2', "$path_csv_2", '--chans_2', "$chans_2", '--title', "$graph_title", ); }; # Designate a labeled row of button widgets. my @tk_btn = ( [ 'Run', $run_me ], [ 'Exit', sub { exit MainLoop }], ); my $wgt_2 = row_of_buttons( $mw, 'Actions', \@tk_btn ); sub submit_entries { my $wgt = shift; entries_accept($wgt); print qq{Log File: $wgt_1->{'to'}->{'Log File'} \n}; # Not a ref. } MainLoop; sub current_DTG { my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $dtg = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec ); return $dtg; } sub append_log { my $txt = shift; my $mesg = current_DTG() . " $txt \n"; my $LOG; if (open $LOG, qq|>>$wgt_1->{'to'}->{'Log File'}| ) { print $LOG $mesg; close $LOG; $wgt_1->{'fm'}->{'Feedback'} = ''; } else { $wgt_1->{'fm'}->{'Feedback'} = qq{Oops! Cannot open log $wgt_1->{'to'}->{'Log File'}: $! }; } } __END__