blackadder has asked for the wisdom of the Perl Monks concerning the following question:
#!c:/perl/bin/perl.exe -w use strict; use vars qw /%data %tk/; use Win32; use Tk; use Tk::HistEntry; $data{analyst}=Win32::LoginName(); $data{sysadmin}='c$\program files\sysadmin\log'; $tk{main} = MainWindow->new; $tk{main}->geometry('400x130'); $tk{top_frame}=$tk{main}->Frame->pack(qw/-side top -fill x/); $tk{top_box} = $tk{top_frame}->Label(-text=>"Hosts : ", )->pack(qw/-side left -padx 10 -pady 10/); $tk{top_entry}=$tk{top_frame}->HistEntry (-width=>40, -background =>'white', -textvariable => \ $data{source}, )->pack(qw/-side right -fill both -padx 10 -pady 10 -expand 1/); $tk{middle_frame} = $tk{main}->Frame->pack(qw/-side top -fill x/); $tk{middle_box}=$tk{middle_frame}->Label(-text=>"Path : " )->pack(qw/-side left -padx 10 -pady 10/); $tk{middle_entry}=$tk{middle_frame}->HistEntry (-width=>40, -background =>'white', -textvariable => \ $data{xls}, )->pack(qw/-side right -fill both -padx 10 -pady 10 -expand 1/); $tk{bottom_frame}=$tk{main}->Frame->pack(qw/-side top -fill x/); $tk{go_buttn}=$tk{bottom_frame}->Button ( -text=>'GO!', -borderwidth=>5, -width=>60, -command=>sub{ &check_process, $tk{top_entry}->invoke; $tk{middle_entry}->invoke;}, )->pack(qw/-side bottom -padx 10 -pady 10/); sub check_process { my @DB_info; my @work_file; if ($data{source} ne "") { open (LST, "$data{source}") || &error_display($data{source}); chomp (@work_file=<LST>); close (LST); } else { chomp ( @work_file=<DATA>); seek (DATA ,0 ,0); } for (@work_file) { next if ($_ =~ /^\s*$/); my $data = {}; ($data->{bu}, $data->{group}, $data->{function}, $data->{source_id}, $data->{source_pc}, $data->{target_pc},) = split (/,/,$_); push (@DB_info, $data); print "$_\n"; undef $data; } } sub error_display { my (@input) = @_; Win32::MsgBox("$!\n\n@input\n",MB_ICONSTOP,"$0 : Operation Failed"); } MainLoop; exit 0; __DATA__ IED,AMM,,manjeet,cw036348,SN02RDS03a IED,AMM,,manjeet,cw036348,SN02RDS04a IED,Cash Sales,Specialist European Global Japanese Far East Global & W +hitephone,maxwill,cw036647,SN02BDW05a IED,Cash Sales,US Sales,breugelw,cw035660,SN02BDZ05a IED,Cash Sales,US Sales,breugelw,cw035660,SN02BDZ06a IED,Cash Sales,US Sales,breugelw,cw035660,SN02BDZ07a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: BoSelecta __DATA__ and rewind.
by dave_the_m (Monsignor) on Oct 04, 2004 at 13:13 UTC | |
by blackadder (Hermit) on Oct 04, 2004 at 13:29 UTC | |
by Limbic~Region (Chancellor) on Oct 04, 2004 at 13:49 UTC | |
by blackadder (Hermit) on Oct 04, 2004 at 14:28 UTC | |
|
Re: BoSelecta __DATA__ and rewind.
by PodMaster (Abbot) on Oct 04, 2004 at 13:10 UTC | |
by Anonymous Monk on Oct 05, 2004 at 13:17 UTC |