#!c:\perl\bin\perl.exe =head1 NAME Calc Generic Easy GUI =head1 VERSION 0.03 =head1 SYNOPSIS perl gus_calc_generic_EasyGUI.pl =head1 DESCRIPTION GUI iterface to Perl script C. Makes use of the (non-CPAN) Perl module C to facilitate use of the script against plural input files, generating a report for each. =head1 AUTHOR Gan Uesli Starling > =head1 LICENSE AND COPYRIGHT Copyright (c) 2007 by Gan Uesli Starling. All rights reserved. This program is free software; you can redistribute it and/or modify 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.03 $' =~ m{ \$Revision: \s+ (\S+) }xm; chdir cwd(); my $path_input = 'Psuedo_PPH_Flow_Record_0.csv'; my $path_output = 'Psuedo_PPH_Flow_Record_0_Report.csv'; my $path_script = 'gus_calc_generic.pl'; my $path_log = ; my $mw = Tk::EasyGUI::init("Perl Script AutoGUI - $VERSION", \&append_log); my @tk_ent = ( ['Perl Script', 'po', \$path_script ], ['Open Fm', 'po', \$path_input ], ['Save To', 'ps', \$path_output ], ); my $wgt_1 = column_of_entries( $mw, 'RunPerl Script', \@tk_ent ); my $run_me = sub { submit_entries($wgt_1); system( "$path_script", '--fm', "$path_input", '--to', "$path_output", ); }; # 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__