RE: select function
Title: RE: select function Maybe the difference is that I autoflush the socket? vec( $rin, fileno( SERVER), 1) = 1; while( $run) { if( select( $rout=$rin, undef, undef, $update_interval)) { $sd_iaddr = accept( CLIENT, SERVER); binmode( CLIENT); autoflush CLIENT 1; ... --Larry S. -Original Message- From: Swartwood, Larry H Sent: Friday, March 11, 2005 4:23 PM To: 'Lyle Kopnicky'; perl-win32-users Subject: RE: select function Lyle, This code works for me on Windows: vec( $rin, fileno( $sock_des), 1) = 1; if( not( select( $rout=$rin, undef, undef, $update_interval))) { return( my_die("select: $!")); } The only real difference I see between your code and my code is that I use 'undef' instead of "" in the call to select. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Lyle Kopnicky Sent: Friday, March 11, 2005 3:32 PM To: perl-win32-users Subject: select function The select function isn't behaving the way I expect. I sent some text on a socket, then wanted to wait to see when the response was available, with a timeout. I wrote code like this: my $rin = ""; vec($rin, fileno($socket), 1) = 1; if (select($rin,"","",$MessageTimeout) == 0) { reopen connection... } Even though, without this check, I am getting responses every time, I wanted to put in this check to deal with a timeout situation. This check times out, even though I know there is incoming text available on the socket. However, if I switch it to select("",$rin,"",$MessageTimeout), the test succeeds. In other words, if I wait to be able to write instead of to read. Well, that doesn't mean a lot - it should always be available for writing. Is this just a quirk of Perl on Windows? Or am I doing something wrong? Thanks, Lyle Kopnicky ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: select function
Lyle, This code works for me on Windows: vec( $rin, fileno( $sock_des), 1) = 1; if( not( select( $rout=$rin, undef, undef, $update_interval))) { return( my_die("select: $!")); } The only real difference I see between your code and my code is that I use 'undef' instead of "" in the call to select. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lyle Kopnicky Sent: Friday, March 11, 2005 3:32 PM To: perl-win32-users Subject: select function The select function isn't behaving the way I expect. I sent some text on a socket, then wanted to wait to see when the response was available, with a timeout. I wrote code like this: my $rin = ""; vec($rin, fileno($socket), 1) = 1; if (select($rin,"","",$MessageTimeout) == 0) { reopen connection... } Even though, without this check, I am getting responses every time, I wanted to put in this check to deal with a timeout situation. This check times out, even though I know there is incoming text available on the socket. However, if I switch it to select("",$rin,"",$MessageTimeout), the test succeeds. In other words, if I wait to be able to write instead of to read. Well, that doesn't mean a lot - it should always be available for writing. Is this just a quirk of Perl on Windows? Or am I doing something wrong? Thanks, Lyle Kopnicky ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: perl tk binding question
I'm not sure why but when I change your binding to: $li->bind('' =>\&li); ...it works. This site might explain it: http://www-users.cs.umn.edu/~amundson/perl/perltk/bind.htm I don't have time to read it all right now. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, March 10, 2005 10:09 PM To: perl-win32-users@listserv.ActiveState.com Subject: perl tk binding question i All! In following snippet I have 2 parallel arrays @list and @data and I want on selecting entry in listbox to see corresponding data array element in textbox using UP and DOWN arrows is OK but I have to make 2 mouse clicks to make right selection! MY question - how to modify this scheme to made it work with only one mouse click ? OR may be there other schemes ? and here is the snippet: == use strict; use Tk; require Tk::LabFrame; my $top = new MainWindow; my $bar=$top->LabFrame(-label => 'buttons bar'); $bar->pack; my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); $exi->pack(-side=>'left'); my $fr=$top->LabFrame(); $fr->configure(-height=>'5',-width=>"30"); $fr->pack(-fill=>'none'); my $li=$fr->Scrolled("Listbox"); $li->configure(-height=>'20',-width=>"20"); $li->pack(-side=>'left',-expand=>'no',-fill=>'none'); my $text0=$fr->Text(); $text0->configure(-height=>'10',-width=>"20"); $text0->pack(-side=>'top',-fill=>'none'); $li->bind('<1>' =>\&li); $li->bind('' =>\&li); $li->bind('' =>\&li); my @list=qw/one two three/; my @data=qw/data_one... data_two... data_three.../; $li->delete(0,'end'); my %revers; my $i=0; foreach (@list){$li->insert("end",$_);$revers{$_}=$i++} $li->focus; MainLoop; sub exi{ $top->destroy; } sub li{ my $sel=$li->get('active'); my $t=$data[$revers{$sel}]; $text0->delete('0.0','end'); $text0->insert ('0.0',$t) ; } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: how to add a new item to a xml
I'm beginning to learn XML in Perl also. I found this page very helpful: http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html I gives a quick primer to a handful of XML modules available in Perl. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mohammed Gazal Sent: Thursday, January 20, 2005 6:24 PM To: perl-unix-users@listserv.ActiveState.com Cc: perl-win32-users@listserv.ActiveState.com Subject: how to add a new item to a xml Hello , I have a xml doc like this test test now if i want to insert a new item for ex: second inbetween the first and third item elements which xml modules help in doing this? and do you have any examples? Any help will be appreciated. Thxs, Gazal. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Reading unix realtime logfile from windows
Or, and this is likely the most non-trivial approach, use something like SAMBA (http://at.samba.org/samba/what_is_samba.html) so that you can read the file system of the AIX machine from Windows. --Larry S. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of $Bill Luebkert Sent: Wednesday, November 24, 2004 8:19 AM To: CHIDIPI, RAMJEE (SBCSI) Cc: [EMAIL PROTECTED] Subject: Re: Reading unix realtime logfile from windows CHIDIPI, RAMJEE (SBCSI) wrote: > Hi folks, > I am generating one log file in AIX say (Memory. log) real-time. I want > to connect from windows 2000 to that AIX run a perl script for analysis. > I am wondering if anyone is familiar with this kind of task. If yes, I > would greatly appreciate your help :) Easiest thing would be to connect to a webserver on the AIX machine and use CGI to parse the log file. If you can't use a webserver, you'll need to either have a daemon running and connect with sockets or use rsh to run a command on AIX. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problem w/ Perl 5 to Perl 8 Update
Title: Problem w/ Perl 5 to Perl 8 Update Hello, all. I see some strange differences in behavior when running my Perl Tk script with Perl 5.8. My script uses DKW's ComboEntry widget that contains a list of host PC names. If executed with Perl 5.6, the user is able to enter the name of a host PC that doesn't appear in the list. This capability vanishes if I install Perl 5.8. If I run the script with Perl 5.8, the user can no longer edit the ComboEntry list. Is there some new option in ComboEntry that I need to specify with Perl 5.8.3 in order to regain this functionality? Thank you, Larry Swartwood ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Walking subdirectories and files
Title: Walking subdirectories and files Rob, I use a recursive subroutine to do this (working example below). I modified and trimmed it down a little for clarity. Hope this helps, Larry S. sub scan_dir{ my $dir = shift; # The directory to start scanning in my $entry = ''; # A directory entry be it a file or another directory my $dh = gensym; # An anonymous directory handle opendir( $dh, "$dir") or die("Can't open $dir: $!"); while( defined( $entry = readdir( $dh))) { # Skip the directories . and .. if( $entry =~ m/^\.+/) { next; } if( -d "$dir\\$entry") { # Recursion scan_dir("$dir\\$entry"); next; } # Entry is a file `touch $dir\\$entry`; } closedir( $dh); return 1;} -Original Message-From: Lawrence, Rob [mailto:[EMAIL PROTECTED]]Sent: Monday, March 04, 2002 2:58 PMTo: '[EMAIL PROTECTED]'Subject: Walking subdirectories and files I am trying to write a Perl script that will touch every subdirectory and file. The problem is the directory structure is HUGE so I cannot use arrays to do it. I would end up running out of memory. I have to modify Ownership and permissions on every single file, in that order. Our security descriptors are messed up on this disk and now we are trying use Perl to fix it. Unfortunately Win32::Perms:SetRecurse does not actually modify every single file within the subdirectories, that would have been perfect. Any help is greatly appreciated!! Rob
RE: using a command which includes spaces in the system() functio n
You could also use Win32::GetShortPathName() first. This is untested but I have done used this approach before. Example: $path = Win32::GetShortPathName('C:\Program Files\WinCVS\Examdiff.exe'); system( $path); Larry S. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Binding events to tk::comboentry
Very cool. Thanks a bunch Jack. Larry S. -Original Message- From: Dunnigan,Jack [Edm] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 10:41 AM To: 'Swartwood, Larry H'; Perl-Win32-Users (E-mail) Subject: RE: Binding events to tk::comboentry Use this script to find out: #!/usr/bin/perl -w # # $Source: ptkkeysym $ $Revision: 1.1 $ # use strict; use Tk 'Ev'; my $keysym; my $mw = MainWindow->new; $mw->Label(-text=>"-- Press any key --\n\nKeysym is:\n\n")->pack; $mw->Label(-textvariable=>\$keysym)->pack; $mw->Button(-text=>'Exit', -command=>[$mw => 'destroy']) ->pack(-side=>'bottom'); $mw->geometry('300x200'); $mw->packPropagate(0); sub PrintKeySym { $keysym = $_[1]; } $mw->bind('all','', [\&PrintKeySym, Ev('K')]); MainLoop; __END__ Jack "The views expressed here are mine and do not reflect the official position of my employer or the organization through which the Internet was accessed". -Original Message- From: Swartwood, Larry H [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 11:35 AM To: Perl-Win32-Users (E-mail) Subject: Binding events to tk::comboentry I need to bind the down and up arrow keys to my tk::comboentry. I'm not sure what the text string would be for those keys. Anyone have an example? Thanks, Larry S. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Binding events to tk::comboentry
I need to bind the down and up arrow keys to my tk::comboentry. I'm not sure what the text string would be for those keys. Anyone have an example? Thanks, Larry S. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Perl/Tk Entry widget questions
Upon reading your question a second time, I think I misunderstood. I don't see where Entry() supports a callback function. One way around that is to test $my_var later: if( length( $my_var) > 75) { # Prompt the user to re-enter the value ... } Larry S. -Original Message- From: Swartwood, Larry H Sent: Monday, January 07, 2002 12:05 PM To: 'Adam Frielink'; '[EMAIL PROTECTED]' Subject: RE: Perl/Tk Entry widget questions Oops. Forgot the all important pack(). Should be: $entry->Entry( -textvariable => \$my_var, -width => 75)->pack(); Sorry, Larry S. -----Original Message- From: Swartwood, Larry H Sent: Monday, January 07, 2002 12:03 PM To: 'Adam Frielink'; [EMAIL PROTECTED] Subject: RE: Perl/Tk Entry widget questions $entry->Entry( -textvariable => \$my_var, -width => 75); http://w4.lns.cornell.edu/~pvhp/ptk/doc/ Larry S. -Original Message- From: Adam Frielink [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: Perl/Tk Entry widget questions Greetings, Here is a simple one, does anyone know how to limit the length of a Entry widget in Tk to be no more than 75 characters? Will this require a Validate callback, or is there an option that can be setup when I create the Entry widget? Thanks, Adam Frielink Tyco Plastics ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Perl/Tk Entry widget questions
Oops. Forgot the all important pack(). Should be: $entry->Entry( -textvariable => \$my_var, -width => 75)->pack(); Sorry, Larry S. -Original Message- From: Swartwood, Larry H Sent: Monday, January 07, 2002 12:03 PM To: 'Adam Frielink'; [EMAIL PROTECTED] Subject: RE: Perl/Tk Entry widget questions $entry->Entry( -textvariable => \$my_var, -width => 75); http://w4.lns.cornell.edu/~pvhp/ptk/doc/ Larry S. -Original Message- From: Adam Frielink [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: Perl/Tk Entry widget questions Greetings, Here is a simple one, does anyone know how to limit the length of a Entry widget in Tk to be no more than 75 characters? Will this require a Validate callback, or is there an option that can be setup when I create the Entry widget? Thanks, Adam Frielink Tyco Plastics ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Perl/Tk Entry widget questions
$entry->Entry( -textvariable => \$my_var, -width => 75); http://w4.lns.cornell.edu/~pvhp/ptk/doc/ Larry S. -Original Message- From: Adam Frielink [mailto:[EMAIL PROTECTED]] Sent: Monday, January 07, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: Perl/Tk Entry widget questions Greetings, Here is a simple one, does anyone know how to limit the length of a Entry widget in Tk to be no more than 75 characters? Will this require a Validate callback, or is there an option that can be setup when I create the Entry widget? Thanks, Adam Frielink Tyco Plastics ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users