Dear monks
Yesterday you help me with my program which I must say, my boss like it, but now I come to you seeking knowledge or a bit more, now my boss wants to display a status of the activity of some banks, in my case I need to go and get a file from a server using IO::Socket and read the file, this file is a plain text file, which it will have something like this:
bank1:Active bank2:Non Active bank3:Active bank4:Active
this data someone perhaps me or somebody else is going to change it as the status of the bank changes, and the program must go every 3 or 5 minutes to check the file and change the value in the entry, and I need the program that I am working on to be able to read the file and fill the 4 Entry's I have right now in the program
#!/usr/bin/perl -W use strict; use warnings; use Tk; use Tk::BrowseEntry; use Cwd; use List::Util qw(shuffle); my $mw = MainWindow->new( -relief => 'raised', -bd => 2, ); $mw->title("Asociacion de Agentes Aduanales de Matamoros --- Validacio +n Automatica"); $mw->geometry("1024x764"); my $upperframe = $mw->Frame()->pack(-fill=>'x' ); my $topframe = $mw->Frame()->pack(-fill=>'x' ); my $mainframe = $mw->Frame()->pack(-expand=>1, -fill=>'both' ); my $bottomFrame = $mw->Frame()->pack(-fill=>'x'); my $exit_b = $topframe->Button(-text=>'Exit', -command=> sub{ exit } )->pack(-side => 'right', -padx=>20 +); my $label_wert1 = $upperframe->Label( -text => 'Banamex :', )->pack(-side => 'left', -expand => 1); my $entry_wert1 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert2 = $upperframe->Label( -text => 'HSBC :', )->pack(-side => 'left', -expand => 1); my $entry_wert2 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert3 = $upperframe->Label( -text => 'Banorte :', )->pack(-side => 'left', -expand => 1); my $entry_wert3 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $label_wert4 = $upperframe->Label( -text => 'Santander :', )->pack(-side => 'left', -expand => 1); my $entry_wert4 = $upperframe->Entry( -width => 20, )->pack(-side => 'left', -expand => 1); my $text1 = $topframe->Label(-text => "Archivos Por enviar")->pack(-si +de => 'left', -expand => 1); my $text2 = $topframe->Label(-text => "Archivos Por Enviados")->pack(- +side => 'left', -expand => 1); my $text3 = $topframe->Label(-text => "Archivos de Respuesta")->pack(- +side => 'left', -expand => 1); my $text4 = $bottomFrame->Label(-text => "Noticias")->pack(-side => 't +op', -expand => 1); my $box1 = Build_Listbox_One($mw); my $box2 = Build_Listbox_Two($mw); my $box3 = Build_Listbox_Three($mw); my ($enviar, $enviados, $respuestas) = Start_Directory_Monitors( $mw, +$box1, $box2, $box3 ); my $box4 = Build_Listbox_Four($mw); Tk::MainLoop(); sub Build_Listbox_One { my $box1 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box1; } sub Build_Listbox_Two { my $box2 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box2; } sub Build_Listbox_Three { my $box3 = $mainframe->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box3; } sub Build_Listbox_Four { my $box4 = $bottomFrame->Scrolled('Listbox', -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); return $box4; } sub Start_Directory_Monitors { my $mw = shift; my $enviar_display = shift; my $enviados_display = shift; my $respuesta_display = shift; my $enviar = $mw->repeat(5000, [ \&list_dir_enviar, $enviar_di +splay ] ); my $env = $mw->repeat(5000, [ \&list_dir_enviados, $enviados_d +isplay ] ); my $res = $mw->repeat(5000, [ \&list_dir_respuesta, $respuesta_ +display ] ); return $enviar, $env, $res; } # monitor enviados sub list_dir_enviar { my $box = shift; $box->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/enviar/*.*"; foreach (@items) { $box->insert('end', $_); } } sub list_dir_enviados { my $box1 = shift; $box1->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/enviados/*.*"; foreach (@items) { $box1->insert('end', $_); } } sub list_dir_respuesta { my $box2 = shift; $box2->delete(0,'end'); # empty listbox my @items = glob "c:/AAAvalida/valida/respuestas/*.*"; foreach (@items) { $box2->insert('end', $_); } }
So basicly I need to add this to the program : I need to conect to the server and read a file using IO::Socket then put the data on the Entry for all 4 banks.
Can someone help me ?
thank you Perl Monks

In reply to Get data from a file and put it in a Tk Entry by padawan_linuxero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.