Net-ssh-W32Perl

2006-06-09 Thread John Serink
Hi All:

Got a small problem I can't figure out here. All I want to do is log
into the SSH server, grabe the banner test and exit. The banner text
contains some HW status I'm trying to capture.
Script is below:
use strict;
use warnings;

use Net::SSH::W32Perl;

my $host = '220.255.171.11';
my $user = "";
my $pw = 'sdflkjsld';
my $ssh = new Net::SSH::W32Perl($host, protocol => 2, debug=>1,
interactive=>1);

my @frank =$ssh->login($user, $pw);
print(@frank);
print("\n");

Here is what the console looks like:
F:\perl\practice\ssh>perl ssh1.pl
johnathlonxpm: Reading configuration data "C:\Documents and
Settings\jserink\My Documents"/.ssh/conf
ig
johnathlonxpm: Reading configuration data /etc/ssh_config
johnathlonxpm: Connecting to 220.255.171.11, port 22.
johnathlonxpm: Socket created, turning on blocking...
johnathlonxpm: Remote version string: SSH-2.0-OpenSSH_3.8.1p1
Debian-8.sarge.4

johnathlonxpm: Remote protocol version 2.0, remote software version
OpenSSH_3.8.1p1 Debian-8.sarge.4

johnathlonxpm: Net::SSH::Perl Version 1.30, protocol version 2.0.
johnathlonxpm: No compat match: OpenSSH_3.8.1p1 Debian-8.sarge.4.
johnathlonxpm: Connection established.
johnathlonxpm: Sent key-exchange init (KEXINIT), wait response.
johnathlonxpm: Algorithms, c->s: 3des-cbc hmac-sha1 none
johnathlonxpm: Algorithms, s->c: 3des-cbc hmac-sha1 none
johnathlonxpm: Entering Diffie-Hellman Group 1 key exchange.
johnathlonxpm: Sent DH public key, waiting for reply.
johnathlonxpm: Received host key, type 'ssh-dss'.
The authenticity of host '220.255.171.11' can't be established.
Key fingerprint is we:er:rt:ty:rt:yu:io:s;sjsdj;jsd;fljsdlj.
Are you sure you want to continue connecting (yes/no)? [yes] yes
johnathlonxpm: Permanently added '220.255.171.11' to the list of known
hosts.
mkdir "C:\: Invalid argument at
F:/perl/site/lib/Net/SSH/Perl/Util/Hosts.pm line 51

Any idea how to get around this error? Its trying to make a directory to
store the connection info...I have Admin rights on the machine.

Ideas?

Cheers,
John

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Win32::SerialPort problem

2006-06-01 Thread John Serink
I'm running 5.8.8-817 and it appears to be included in this one.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of David Ressler
> Sent: Thursday, June 01, 2006 9:28 AM
> To: Perl List
> Subject: Win32::SerialPort problem
> 
> 
> I'm trying to use Win32:SerialPort on an XP system. 
> Apparently the standard Windows Perl installation doesn't 
> contain it, so I downloaded and installed it. THAT seems to 
> require Win32:API which I didn't find either. I tried to 
> download it from CPAN but I got an error trying to unpack it, 
> so I copied what appeared to be the correct files from 
> another computer. However, when I try to execute a script 
> that contains "use  Win32::SerialPort;" at line 12 I get the error:
> 
> Can't locate loadable object for module Win32::API in @INC 
> (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at 
> C:/Perl/lib/Win32API/CommPort.pm line 5 Compilation failed in 
> require at C:/Perl/lib/Win32API/CommPort.pm line 5. BEGIN 
> failed--compilation aborted at 
> C:/Perl/lib/Win32API/CommPort.pm line 5. Compilation failed 
> in require at C:/Perl/lib/Win32/SerialPort.pm line 4. BEGIN 
> failed--compilation aborted at 
> C:/Perl/lib/Win32/SerialPort.pm line 4. Compilation failed in 
> require at C:\Inetpub\wwwroot\pos\cgi-bin\ComPortSetup.pl
> line 12.
> BEGIN failed--compilation aborted at 
> C:\Inetpub\wwwroot\pos\cgi-bin\ComPortSetup
> 
> Line 5 of CommPort.pm is "use Win32::API", and the line in 
> Win32\API.pm that seems to be failing is "bootstrap Win32::API;"
> 
> The script works fine on the other computer mentioned above.
> 
> I suspect there may be some error in the sloppy way I tried 
> to install this. Can anyone shed some light or suggest what to do?
> 
> Thanks,
> Dave
> 
> 
> ___
> 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: Network Timeouts

2006-05-12 Thread John Serink
You're only option is to spawn threads and detach them. Have them write
their results to a shared hash or something and define your own
timeout...if you don't see the result from that thread ID in X seconds,
declare it timed out and forget about it. When it actually does timeout
is will error and then die peacefully. Make sure your script is written
NOT to die on not connecting.

Perl does not support tcp connect timeouts in Win32.

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ng, Bill
> Sent: Friday, May 12, 2006 11:27 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Network Timeouts
> 
> 
> Dilemma,
> 
>   I have many scripts that have to hit every machine in 
> my domain .. about 2400.  I can't use Net::Ping to test the 
> alive status of the boxes because our internal DNS system is 
> a real PITA to clean up and using as-is will leave me with 
> bad results.
> 
>   For now, I'm doing a write test:  if (open (WRITETEST,
> ">c:\write.test")) { &doSomething(); } ... but the timeout on 
> such a test, if the machine its trying to reach is not 
> available, is just too long.
> 
>   Anyone have a way of me testing the connectivity to a 
> computer on the network that allows me to either configure 
> the timeout or has one between 1 and 2 seconds?
> 
> Bill in Brooklyn
> 
> ___
> 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: Easy One

2006-05-01 Thread John Serink
REGEX!

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ng, Bill
> Sent: Tuesday, May 02, 2006 3:55 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Easy One
> 
> 
> Real simple,
> 
>   I have a string, "$a" for arguments sake, that contains 
> a single word.  The word will always have exactly 8 
> characters in it, most likely something like "ABCD1234".  I 
> need to split this up into two strings ($b & $c), the first 
> string needs to contain all the characters before the first 
> number in the word ("ABCD" in this example), the second 
> string needs everything after, and including, the first 
> number in the word "1234" in this example.
> 
>   Now, substr() would be a walk in the park, except for 
> the fact that I can't guarantee the first number will always 
> be in the fifth position ... it might come in any position 
> between 3 and 7.  How would YOU go about doing this?  
> Inquiring minds want to know.
> 
> Bill in Brooklyn
> 
> ___
> 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: Non-blocking IO?

2006-04-17 Thread John Serink
Win sockets on Win32?
not really, the only choice you have is IO::Select.
:)
John

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Lyle Kopnicky
Sent: Tuesday, April 18, 2006 12:22 AM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: Non-blocking IO?


Hi folks,

I'm using the HTTP::Daemon module.  Is there any way to do non-blocking 
IO with that?  Thanks.

-- 
Lyle Kopnicky
Software Project Engineer
Veicon Technology, Inc.

___
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


Win32 Perl Threads SLOW memory leak.

2006-04-13 Thread John Serink
Hi All:

The attached script is a performance test model I use for a production
script I have that uses sockets to connect to various targets once per
minute. It used to leak 2 handles per thread per run but that has been
fixed with perl 5.8.8-817. Now that the handles leak is fixed I have
been observing the test script over the last 4 days and she's leaking
memory...quite badly(as is the production code). I have used perfmon to
log the used memory( private bytes) which is growing at a rate of
1688.5t + 20,000,000 where t is time in units of 15 seconds. For
example, for t=240(1 hour) the memory increases 400Kbytes. Over 24
hours, it increases by ~9.6Mbytesand just keeps going up. I'd like
to make my production code a service but can't until I nail down this
memory leak. Handles are stable.

Any ideas?

Cheers,
John
Code is below:
use strict;
use warnings;
use IO::Select;
use Time::HiRes qw(gettimeofday);
use threads; 
use threads::shared;

my $MODBUSPORT=502;
my $UPDATERATE = 30;
my $CONNECTIONTIMEOUT = 10;
my $SOCKREADTIMEOUT = 5;
my $myfile = ">log.log";
my $i=0;
my $responsesIndex = 0;
my $thistime=gettimeofday();
my $starttime=$thistime;
my %responses: shared ;
my %connstatus: shared ;
my %readstatus: shared ;

while(1){
 my %addresses = (  "one  " => 1,
 "two  " => 2,
 "three" => 3,
 "four " => 4,
 "five " => 5,
 "six  " => 6,
 "seven" => 7,
 "eight" => 8,
 "nine " => 9,
 "ten  " => 10,
 "eleven"=> 11,
 "twelve"=> 12,
 "thirteen" => 13,
 "fourteen" => 14,
 "fifteen" => 15,
 "sixteen" => 16,
 "seventeen" => 17,
 "eightteen" => 18,
 "nineteen" => 19,
 "twenty" => 20);
 my %threadIDs ;
 my %conntimeout ;
 my %readtimeout ;

clearscreen();
 $thistime = gettimeofday();
 my @jim = keys(%addresses);
 for($i=0;$inew(\&goconnect, $addresses{$jim[$i]},
$MODBUSPORT);
  $thrconn -> detach();
  $threadIDs{$jim[$i]} = $thrconn->tid();
  if($i==0){
   $responsesIndex = $threadIDs{$jim[$i]};
   print("Responses Index is $responsesIndex\n");
  }
  $connstatus{$threadIDs{$jim[$i]}} =0;
  $readstatus{$threadIDs{$jim[$i]}} =0;
  $conntimeout{$threadIDs{$jim[$i]}} = gettimeofday();
  $readtimeout{$threadIDs{$jim[$i]}} =0;
  $responses{$threadIDs{$jim[$i]}} =0;  
 }
 my $jim = scalar(keys(%connstatus));
 print("the connstatus hash has $jim elements\n");
 while(scalar(keys(%connstatus))>0){
  my @frank=keys(%connstatus);
  for($i=0;$i$CONNECTIONTIMEOUT){
$responses{$frank[$i]}="Connection Timeout";
my $temp = "";
$temp=returnvalue(\%threadIDs,$frank[$i]);
unless($temp){
 $temp="";
}
$temp = $temp." : ".$responses{$frank[$i]}." ".localtime();
print("$temp\n");
delete($connstatus{$frank[$i]});
   } 
  }
  IO::Select->select(undef,undef,undef,0.5);
}

 my $temptime = gettimeofday()-$thistime;
 print("Preparing to wait, $temptime\n");
 my $steve=hashdestroy(\%connstatus);
 $steve = hashdestroy(\%readstatus);
 $steve = hashdestroy(\%readtimeout);
 $steve = hashdestroy(\%conntimeout);
 $steve = hashdestroy(\%threadIDs);

my $runtime = gettimeofday() - $starttime;
 my $runtimehours = int($runtime/3600);
 my $runtimeminutes = int(($runtime/3600 - $runtimehours)*60);
 my $runtimeseconds = int((($runtime/3600 - $runtimehours)*60 -
$runtimeminutes)*60);
 print("Program run time $runtimehours hours $runtimeminutes minutes
$runtimeseconds seconds\n");
 select(STDOUT);
 $|=1;
do {
 my $displaytime = $UPDATERATE - $temptime;
  $displaytime = sprintf("%05.1f", $displaytime);
  print("Time to next query $displaytime seconds\r");
  select(undef,undef,undef,0.1);
  $temptime = gettimeofday()-$thistime;
 } while($temptime < $UPDATERATE);
}

#  subroutine hashdestroy(\%hash) destroys all the remaining elements  #
#  of the hash pointed to by the reference \$hash. It returns the  #
#  number of elements destroyed.   #
#  #

sub hashdestroy
{
 my $jim = shift();
 my @bob=keys(%$jim);
 my $numdel = 0;
 
 foreach my $bill (@bob){
  delete($$jim{$bill});
  $numdel++;
 }
 return $numdel;
}


#  subroutine returnkey(\%hash,$value) returns the corresponding key   #
#  from %hash that matches the $value in that hash.#
#  #

sub returnvalue
{
 

RE: :Select perl question

2006-04-06 Thread John Serink
You can't.
IO::Select with pipes and file handles is only supported on Unix.
IO::Select on Win32 only works with Sockets.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, April 06, 2006 2:10 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: IO::Select perl question
> 
> 
> Hi All!
> I am trying to use pipes in win32
> in my main program (in C) I have:
> 
> FILE *fd = _popen("perl d:/umts/catch_in.pl" , "wb");
> int i=12;
> fwrite((void*)&i,1,4,fd);
> ie=fflush(fd);
> _pclose(fd);
> 
> my perl code (in catch_in.pl) is :
> -
> use strict;
> use warnings;
> use IO::File;
> use IO::Select;
> my $in=new IO::File;
> $in->open("<-")  or die "cant open standart input !"; 
> binmode($in); my $buf; my $read_set = new IO::Select($in); # 
>  I commented next cycle #my $cnt=0; #while (!$cnt) { #my 
> @ar=$read_set->can_read('1'); #$cnt=scalar @ar; #} my 
> $n=read($in,$buf,4); exit;
> -
> This works ok.
> But with uncommented cycle 
> prog catch_in.pl hangs !
> My question is - why can_read 
>  always return empty array
> in spite of fact that there are data ready for read ???
> P.S. I tried can_read() also 
> ___
> 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: ActivePerl 5.8.8.817 released-Win32 Threads Leaking handles

2006-03-29 Thread John Serink
Hello Jan and Fellow Users:

The Win32 threads leaking handles bug is fixed! Yippie!
OUTSTANDING! Well done development team.

Have tested it on my leaking handles script and my production code,
looks good. The number of handles open jumps when the threads are
launched and as the detached threads die, the handles drop right back
down again as they should.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Thursday, March 30, 2006 10:50 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.817 released
> 
> 
> ActiveState has released ActivePerl 5.8.8.817 today.  It 
> fixes a number of serious issues that have been found in the 
> 816 release:
> 
> * Restored binary compatibility to previous releases.
> * Fixed several bugs on Windows related to GUI applications and
>   signal handling.  These bugs were introduced in build 816.
> * Updated threads and threads::shared modules to fix resource leaks
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> Build 817 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Upgraded the core threads and threads::shared modules with 
> threads-1.12 and threads-shared-0.99 from CPAN. This fixes 
> the handle leakage on Windows and allows setting the stack 
> size for new threads. It also fixes both the '!=' comparison 
> operator for thread objects and the crashes while joining 
> threads that go re-introduced in build 816.
> 
> =item *
> 
> Fixed several bugs in the new implementation of alarm() for 
> Windows. They did manifest themselves by signals not being 
> delivered, or by GUI applications randomly hanging.
> 
> =item *
> 
> Restored binary compatiblity for SvPV_nolen() and similar 
> macros. This incompatibility made it impossible to use 
> perlapp for Unix on Tk based applications.
> 
> =item *
> 
> Reintroduce PL_memory_wrap for binary compatiblity.
> 
> =item *
> 
> The C builtin now ignores directories matching the 
> given name when searching @INC.
> 
> =back
> 
> 
> ___
> 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: accurate timing in windows

2006-03-29 Thread John Serink
You need to be counting actual HW clock ticks. Win32::GetTickCount()
will return the HW timer count...believe its incremented every
millisecond. SW timers won't work.

Also, you can't use sleep for anything other than integer seconds. If
you want to sleep for periods smaller than a second, you need to use
either the IO::Select module or the select( undef, undef, undef,
timetosleep) function. Timetosleep can be any value down to 0.001.

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Spencer_Lists
> Sent: Wednesday, March 29, 2006 5:33 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: accurate timing in windows
> 
> 
> Greetings perl-win32-users,
> 
> I have a TK application that sends MIDI messages to various 
> devices. I need to accurately time the occurrence of these 
> events in spite of what windows is doing. It have tried the 
> hires time module as well as the until function and the 
> results are not accurate enough. It has been suggested that 
> the only way to have accurate event timing in windows is to 
> use the multimedia timer. Is there a perl module that 
> accesses this timer or any other way to do so? I just need to 
> repeat the same sequence of events in a loop so I need 
> something that functions like until or sleep. Will a loop 
> running in perl still be subject to timing variations caused 
> by other windows processes even using the multimedia timer? 
> If so, is there any way around this?
> 
> The actual loop has a lot more going on to update graphics 
> etc. but this is basically what I need to do:
> 
> sub repeat_note{
> my $note = shift;
> while(1){
> $midi_obj->play_note($note,0.0,60,(1),0) || print 
> $midi_obj->error() . "\n" and $midi_obj->reset_error();
> sleep ($notedur/1000);
> $midi_obj->note_off($note,0.0,60,(1),1) || print 
> $midi_obj->error() . "\n" and $midi_obj->reset_error();
> $notearray[$note] = 0;
> sleep($offdur/1000);
> }
> }
> 
> 
>  -- Best regards, Spencer_Lists Chase 
> mailto:[EMAIL PROTECTED] 67550 Bell Springs Rd. 
> Garberville, CA 95542  Postal service only. Laytonville, CA 
> 95454  UPS only. [EMAIL PROTECTED] 
> http://www.spencerserolls.com 
> http://www.spencerserolls.com/MidiValve.htm (707) 984-8356
> 
> ___
> 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 book sale at Suntec City (Singapore)

2006-03-26 Thread John Serink
Where at Suntec?

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Monday, March 27, 2006 10:01 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Perl book sale at Suntec City (Singapore)
> 
> 
> Ok, I know this is relevant to a specific few, but it's too 
> good a deal...
> 
> I've just gotten my hands on 5 Perl books, for a total of only SGD 40 
> (about USD 25). Includes: mod_perl (O Reilly), Perls of Wisdom, 
> Template::Toolkit, Perl Algorithms, and Mason.
> 
> For those who are travelling enroute to Singapore, let me 
> know and I'll 
> give you directions. ___
> 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: Implementing or Emulating TSRs in Win32 Console Apps

2006-03-16 Thread John Serink
Hi Veli:

There are several way to do what you want. What not use threads?
You could use IO::Select as well but that only works for sockets on Win32 
unfortunately, in Linux it works with console handles as well.

Threads is the most straight forward but I've had problems with threads 
crashing the 5.8.8-816 perl interpriter so mgith have to use 5.8.7-815.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Veli-Pekka Tätilä
> Sent: Friday, March 17, 2006 12:57 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Implementing or Emulating TSRs in Win32 Console Apps
> 
> 
> Hi,
> Is it possible to do a DOS TSR-program in Perl? In this 
> context I mean an 
> app which runs as long as you've got a DOS session open but 
> which can lurk 
> in the background, accepting commands or processing hotkeys. 
> TSRs were sort 
> of magical in the DOS days as it was a single-tasking OS and 
> I recall many 
> of the assistive technologies I used to use back then ran as 
> terminate and 
> stay resident programs. I'm only familiar with the technology 
> from the user 
> point of view and have no idea how it is implemented 
> technically.  I do know 
> many of the TSR based access aids are no good in XP but that might be 
> because of other low level things than the TSR code it self, 
> I don't know.
> 
> If, however, true TSRs are not possible to implement or might be 
> unsupported, even as C-based extensions, are there any good 
> work-arounds in 
> Win32 console apps? I've got some console app ideas which 
> would require this 
> kind of operation. Basically I'd like to maintain an illusion 
> of the user 
> having run a program, being able to interact with the shell (cmd.exe) 
> normally and control the background program via some special 
> hotkeys or 
> command-line switches to the perl script (/u for unload, /s 
> for status 
> etc...). I'd also like to post stuff asynchronously on screen 
> so that the 
> output would appear right away, rather than, say, after an 
> enter press for 
> submitting the next command. I suppose this is some kind of 
> non-blocking 
> write. The OS is Win XP and I'd prefer modules available via 
> PPM if there 
> are any.
> 
> Lastly, out of curiosity how do these things work in Unix? I 
> haven't used 
> much of it but the first example that came to mind is the app 
> which let's 
> you know of new mail in SunOs.
> 
> Any help appreciated as usual.
> 
> -- 
> With kind regards Veli-Pekka Tätilä 
> ([EMAIL PROTECTED]) Accessibility, game music, 
> synthesizers and programming: http://www.student.oulu.fi/~vtatila/ 
> 
> ___
> 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


FW: ActivePerl 5.8.8.816 released

2006-03-16 Thread John Serink
Hi All:

After installing perl 5.8.8-816 I ran my handles leak program to see if
perl is still leaking handles when using shared arrays and hashes with
threads. Problem is, I don't have an answer on whether it still leaks
handles because the interpreter crashes in the midst of lunching the
threads. It does this with my handlesleak7.pl script and with my
production code, the perl interpreter crashes and I get Dr. Watson come
up asking me to email Mickeysoft.

handlesleak7.pl is attached.

Uninstalling 5.8.8-816 and putting back 5.8.7-815.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler.
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C.
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor>
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
> 
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


handlesleak7.pl
Description: handlesleak7.pl
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing 

RE: ActivePerl 5.8.8.816 released

2006-03-15 Thread John Serink
Hi All:

After installing perl 5.8.8-816 I ran my handles leak program to see if
perl is still leaking handles when using shared arrays and hashes with
threads. Problem is, I don't have an answer on whether it still leaks
handles because the interpreter crashes in the midst of lunching the
threads. It does this with my handlesleak7.pl script and with my
production code, the perl interpreter crashes and I get Dr. Watson come
up asking me to email Mickeysoft.

handlesleak7.pl is attached.

Uninstalling 5.8.8-816 and putting back 5.8.7-815.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816 
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for 
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta 
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now 
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that 
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler. 
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides 
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C 
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is 
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C. 
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar 
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when 
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the 
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory 
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor> 
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
> 
> 
> ___
> Perl-Win32-Users mailing list 
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


handlesleak7.pl
Description: handlesleak7.pl
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: System resources used by Perl script

2006-03-14 Thread John Serink
>From the Active per docs:
Devel::DProf - a Perl code profiler

* NAME
* SYNOPSIS
* DESCRIPTION
* PROFILE FORMAT
* AUTOLOAD
* ENVIRONMENT
* BUGS
* SEE ALSO

NAME

Devel::DProf - a Perl code profiler

SYNOPSIS

perl -d:DProf test.pl

DESCRIPTION

The Devel::DProf package is a Perl code profiler. This will collect
information on the execution time of a Perl script and of the subs in
that script. This information can be used to determine which subroutines
are using the most time and which subroutines are being called most
often. This information can also be used to create an execution graph of
the script, showing subroutine relationships.

To profile a Perl script run the perl interpreter with the -d debugging
switch. The profiler uses the debugging hooks. So to profile script
test.pl the following command should be used:

perl -d:DProf test.pl

When the script terminates (or when the output buffer is filled) the
profiler will dump the profile information to a file called tmon.out. A
tool like dprofpp can be used to interpret the information which is in
that profile. The following command will print the top 15 subroutines
which used the most time:

dprofpp

To print an execution graph of the subroutines in the script use the
following command:

dprofpp -T

Consult dprofpp for other options.

PROFILE FORMAT

The old profile is a text file which looks like this:

#fOrTyTwO
$hz=100;
$XS_VERSION='DProf 19970606';
# All values are given in HZ
$rrun_utime=2; $rrun_stime=0; $rrun_rtime=7
PART2
+ 26 28 566822884 DynaLoader::import
- 26 28 566822884 DynaLoader::import
+ 27 28 566822885 main::bar
- 27 28 566822886 main::bar
+ 27 28 566822886 main::baz
+ 27 28 566822887 main::bar
- 27 28 566822888 main::bar
[]

The first line is the magic number. The second line is the hertz value,
or clock ticks, of the machine where the profile was collected. The
third line is the name and version identifier of the tool which created
the profile. The fourth line is a comment. The fifth line contains three
variables holding the user time, system time, and realtime of the
process while it was being profiled. The sixth line indicates the
beginning of the sub entry/exit profile section.

The columns in PART2 are:

sub entry(+)/exit(-) mark
app's user time at sub entry/exit mark, in ticks
app's system time at sub entry/exit mark, in ticks
app's realtime at sub entry/exit mark, in ticks
fully-qualified sub name, when possible

With newer perls another format is used, which may look like this:

#fOrTyTwO
$hz=1;
$XS_VERSION='DProf 19971213';
# All values are given in HZ
$over_utime=5917; $over_stime=0; $over_rtime=5917;
$over_tests=1;
$rrun_utime=1284; $rrun_stime=0; $rrun_rtime=1284;
$total_marks=6;

PART2
@ 406 0 406
& 2 main bar
+ 2
@ 456 0 456
- 2
@ 1 0 1
& 3 main baz
+ 3
@ 141 0 141
+ 2
@ 141 0 141
- 2
@ 1 0 1
& 4 main foo
+ 4
@ 142 0 142
+ & Devel::DProf::write
@ 5 0 5
- & Devel::DProf::write

(with high value of $ENV{PERL_DPROF_TICKS}).

New $over_* values show the measured overhead of making $over_tests
calls to the profiler These values are used by the profiler to subtract
the overhead from the runtimes.

The lines starting with @ mark time passed from the previous @ line. The
lines starting with & introduce new subroutine id and show the package
and the subroutine name of this id. Lines starting with +, - and * mark
entering and exit of subroutines by ids, and goto &subr.

The old-style +- and --lines are used to mark the overhead related to
writing to profiler-output file.

AUTOLOAD

When Devel::DProf finds a call to an &AUTOLOAD subroutine it looks at
the $AUTOLOAD variable to find the real name of the sub being called.
See Autoloading in the perlsub manpage.

ENVIRONMENT

PERL_DPROF_BUFFER sets size of output buffer in words. Defaults to
2**14.

PERL_DPROF_TICKS sets number of ticks per second on some systems where a
replacement for times() is used. Defaults to the value of HZ macro.

PERL_DPROF_OUT_FILE_NAME sets the name of the output file. If not set,
defaults to tmon.out.

BUGS

Builtin functions cannot be measured by Devel::DProf.

With a newer Perl DProf relies on the fact that the numeric slot of
$DB::sub contains an address of a subroutine. Excessive manipulation of
this variable may overwrite this slot, as in

  $DB::sub = 'current_sub';
  ...
  $addr = $DB::sub + 0;

will set this numeric slot to numeric value of the string current_sub,
i.e., to 0. This will cause a segfault on the exit from this subroutine.
Note that the first assignment above does not change the numeric slot

RE: ActivePerl 5.8.8.816 released

2006-03-13 Thread John Serink
Has the handles leak on Win32 when using shared variables with threads
been fixed?

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Tuesday, March 14, 2006 7:42 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.8.816 released
> 
> 
> I'm happy to announce that we released ActivePerl 5.8.8.816 
> today. The main highlights over 5.8.7.815 are:
> 
> * Based on Perl 5.8.8, plus bug fixes and module updates
> * OS X version runs natively on both PowerPC and Intel Macs
> * 64 Bit beta versions available for Windows, Linux and Solaris
> 
> As usual, you can download it via the main ActivePerl page:
> 
> http://www.ActiveState.com/ActivePerl
> 
> Note that there is a separate link for downloading the 64 bit 
> Beta versions.
> 
> Please send feedback to
> 
> [EMAIL PROTECTED]
> 
> and report bugs at
> 
> http://bugs.ActiveState.com
> 
> I've appended the relevant section of the CHANGES-58.pod file 
> to show some more detail on other changes from the previous release.
> 
> Cheers,
> -Jan
> 
> =head2 Build 816 Thursday, Mar 2, 2006
> 
> Build 816 is based on Perl 5.8.8.
> 
> I
> 
> =over 8
> 
> =item *
> 
> Perl 5.8.8 has been incorporated. See L for 
> a list of changes.
> 
> =item *
> 
> ActivePerl build 816 is now also available as a 64 bit Beta 
> release for Windows and Linux on x86_64 as well as Solaris on 
> Sparc. The 64 bit Windows Beta does not include PerlScript, 
> PerlEx, Perl for ISAPI or PerlEz.
> 
> =item *
> 
> The ActivePerl Community License has been clarified. It now 
> explicitly allows you to redistribute certain parts of 
> ActivePerl as part of applications generated by wrapping 
> tools such as by PAR, PerlApp and Perl2Exe. Please refer to 
> the license text for actual terms and conditions.
> 
> =item *
> 
> ActivePerl for Mac OS X is now a Universal binary that 
> support all Macintosh hardware natively.
> 
> =item *
> 
> ActivePerl for Solaris is now built with the vendor compiler. 
> Previous releases were built with the GNU compiler (gcc).
> 
> =item *
> 
> C on Solaris and HP-UX now provides 
> compatibility so that extensions can be built using gcc. This 
> happens automatically if the vendor compiler is not available 
> on the target system.
> 
> =item *
> 
> ActivePerl now ships with a preinitialized C 
> module. This avoids the need to go through the configuration 
> dialog the first the CPAN shell is invoked. The configuration 
> dialog can still be invoked by the C command to 
> the CPAN shell.
> 
> =item *
> 
> Syntax colored documentation and ActiveState::Scineplex is 
> now supported for all the Unix platforms.
> 
> =item *
> 
> Passive transfer mode is now the default for C. 
> This mode is more likely to work with modern firewall setups.
> 
> =item *
> 
> Problem where 'perl -s' wasn't able to parse -foo=bar 
> switches has been corrected.
> 
> =item *
> 
> The stat() builtin would not return the expected result when 
> passed a directory name with trailing slashes on Windows. 
> This problem has been fixed.
> 
> This problem caused the rmtree() function of the 
> C module introduced in build 815 to fail for such 
> directory names on Windows.
> 
> =item *
> 
> The C is now more efficient and it does not rely on
> getprotobyname("tcp") to be functional any more.
> 
> =item *
> 
> A problem where long groups entries could cause memory 
> exhaustion has been fixed.
> 
> =item *
> 
> A problem with the alarm() function on Windows 2003 has been fixed.
> 
> =item *
> 
> The Tk module would sometimes fail to update the C<-cursor> 
> attribute of widgets for 64-bit builds of perl. This problem 
> has now been fixed.
> 
> =item *
> 
> Many bundled modules have been updated to their latest versions:
> 
> Digest-SHA-2.11
> HTML-Tagset-3.10
> HTML-Parser-3.50
> HTML-Tree-3.1901
> IO-String-1.08
> libwww-perl-5.805
> Mac-Errors-1.11
> Win32-OLE-0.1704
> 
> =back
> 
> 
> 
> ___
> 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: old messages?

2006-03-07 Thread John Serink
Yup.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris
> Sent: Wednesday, March 08, 2006 6:55 AM
> To: 'Chris Wagner'; perl-win32-users@listserv.ActiveState.com
> Subject: RE: old messages?
> 
> 
> Did anyone else also just receive a boat load of old messages 
> from the list? I've got about 25 and more coming.  They go 
> back to October.  And the really funny thing about it is 
> they're all from threads I participated in.  I checked out 
> the headers and they're originating from mail.mytravelweb.net 
> and involve somebody [EMAIL PROTECTED]  Here's one of 
> the headers.
> 
> 
> 
> I've been getting them all day.
> 
> - Chris
> 
> 
> ___
> 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: Change network interface parameters via Perl

2006-03-07 Thread John Serink
You could just use netsh.



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Monday, February 28, 2005 7:18 PM
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: RE: Change network interface parameters via Perl
> 
> 
> Assuming you are on NT/Win2K/XP/2003 You could try WMI... 
> This is hacked together from my build system and untested but 
> it should give you the general idea. Some references here: 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/wmisdk/
> wmi/win32_networkadaptersetting.asp
> 
> Paul
> 
> 
> use Win32::OLE
> 
> my $x = 
> Win32::OLE->GetObject("WinMgmts://$ENV{COMPUTERNAME}/root/cimv2");
> my $y = $x->ExecQuery(qq(SELECT * FROM Win32_NetworkAdapter 
> WHERE AdapterType = "Ethernet 802.3"));
> 
> my $NewIP   = "192.168.0.1";
> my $NewMask = "255.255.255.0";
> my $NewGateway  = "192.168.0.254";
> my $NewDNS  = [ ("192.168.0.10","192.168.0.50" ];
> 
>  foreach my $adapter (in $y) {
>   my $settings = 
> $adapter->Associators_(undef,"Win32_NetworkAdapterConfiguration");
>   for my $setting (in $settings) {
>   next unless $setting->{IPEnabled} == 1;
>   # We only get to here if the adapter is 
> ethernet and ip enabled
>   my $IPAddress = $setting->{IPAddress}->[0];
>   my $Mask  = $setting->{IPSubnet}->[0];
>   my $Gateway   = $setting->{DefaultIPGateway}->[0];
>   my $DHCPState = $setting->{DHCPEnabled};
>   my $AdapterIndex = $adapter->{Index};
>   my $AdapterName = $adapter->{Description};
>   
>   print "\t\tOld ip details for adapter $ApapterIndex
> ($AdapterName): IP - $IPAddress DHCP - $DHCPState\n";
>   
>   my $result = $setting->EnableStatic([ $NewIP ], [
> $NewMask ]);
>   print "\t\tSet ip to $NewIP (result $result)\n";
>   
>   my $result = $setting->SetGateways([ $NewGateway ], [ 1
> ]);
>   print "\t\tSet gateway to $NewGateway (result
> $result)\n";
>   
>   my $result = $setting->SetDNSServerSearchOrder($NewDNS);
>   print "Set DNS servers to " . join(",",@$NewDNS) .
> "(result $result)\n";
>   
>   exit;
>   }
> }
> 
> -Original Message-
> 
> *
> Gloucester Research Limited believes the information 
> provided herein is reliable. While every care has been 
> taken to ensure accuracy, the information is furnished 
> to the recipients with no warranty as to the completeness 
> and accuracy of its contents and on condition that any 
> errors or omissions shall not be made the basis for any 
> claim, demand or cause for action.
> *
> 
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marcos Lorenzo de Santiago
> Sent: 28 February 2005 09:59
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: Change network interface parameters via Perl
> 
> I need to change the network interface parameters (ie: IP, 
> Gateway, Mask,
> DHCP...) via Perl, is there any module I could use? and/or 
> documentation on it? I've been trying to use netsh command 
> from Windows XP and parsing its output but I guess there 
> might be another prettier way to do this.
> 
> 
> TIA.
> Regards,
> m4c.
> 
> -- 
> ,-
> -.
> | Mathematics is the only science where one never knows what  
>  |
> | one is talking about nor whether what is said is true.  
>  |
> | -- Russell  
>  |
> |-
> -|
> | Labs. Technician  | 
>  |
> | Department of Telematic Engineering   | Debian 
> GNU/Linux Powered |
> | Universidad Carlos III de Madrid  | 
>  |
> |---|
> .--.  |
> |   |   
> |o_o | |
> |  _|  .''`.
> |:_/ | |
> | |~~  @| Marcos Lorenzo de Santiago| : :' :   // 
>   \ \|
> | |     | E-mail:  [EMAIL PROTECTED]| `. `'   (|  
>| )   |
> | |     | Telephone: (+34) 91-624-9959  |   `-   /'\_ 
>   _/`\   |
> | |_| Web: www.it.uc3m.es/marcos|
> \___)=(___/   |
> |   | 
>  |
> `-
> -'
> 
> 
> ___
> Perl-Win32-Users mailing list 
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.Act

RE: Battery info on a laptop

2006-03-05 Thread John Serink
Use this as a hack template till you get your head around it:
#!perl

# Simple Perl Script to illustrate use of WMI to gather system
information
# and display it in the same format at the Windows Management Console

use Win32::OLE qw(in with);
use Win32::Registry;

# Pick a host that you have the necessary rights to monitor

$host = "johnathlonxpm";

# Gather System Information

$WMI = Win32::OLE->new('WbemScripting.SWbemLocator') ||
 die "Cannot access WMI on local machine: ", Win32::OLE->LastError; 
 
$Services = $WMI->ConnectServer($host) ||
 die "Cannot access WMI on remote machine: ", Win32::OLE->LastError; 

# Gather Computer System Information
 
$sys_set = $Services->InstancesOf("Win32_ComputerSystem");
foreach $sys (in($sys_set)) 
 {  
  $system_name = $sys->{'Caption'};
  $system_type = $sys->{'SystemType'};
  $system_manufacturer = $sys->{'Manufacturer'};
  $system_model= $sys->{'Model'};
 }
 

# Gather Processor Information
$processor_set = $Services->InstancesOf("Win32_Processor");
foreach $proc (in($processor_set)) 
 {
  $proc_description= $proc->{'Caption'};
  $proc_manufacturer   = $proc->{'Manufacturer'};
  $proc_mhz= $proc->{'CurrentClockSpeed'};
 }


# Gather BIOS Information

#$bios_set = $Services->InstancesOf("Win32_BIOS");
#foreach $bios (in($bios_set)) 
# {  
#  $bios_info   = $bios->{'Version'};
# }

# Gather Time Zone Information

$loc_set = $Services->InstancesOf("Win32_TimeZone");
foreach $loc (in($loc_set)) 
 {
  $loc_timezone  = $loc->{'StandardName'};  
 }

# Gather Operating System Information

$os_set = $Services->InstancesOf("Win32_OperatingSystem");
foreach $os (in($os_set)) 
 {
  $os_name = $os->{'Caption'};
  $os_version  = $os->{'Version'};
  $os_manufacturer = $os->{'Manufacturer'};
  $os_build= $os->{'BuildNumber'};
  $os_directory= $os->{'WindowsDirectory'};
  $os_locale   = $os->{'Locale'}; 
  $os_totalmem = $os->{'TotalVisibleMemorySize'};
  $os_freemem  = $os->{'FreePhysicalMemory'};
  $os_totalvirtmem = $os->{'TotalVirtualMemorySize'};
  $os_freevirtmem  = $os->{'FreeVirtualMemory'};
  $os_pagefilesize = $os->{'SizeStoredInPagingFiles'}; 
 }

$tempstuff = $Services->InstancesOf("Win32_BaseBoard");

foreach my $sysvar (in($tempstuff)){
$bbcaption  = $sysvar ->{'Caption'};
$bbconfigoptions= $sysvar ->{'ConfigOptions'};
$dddepth= $sysvar ->{'Depth'};  
$bbheight   = $sysvar ->{'Height'};
$bbwidth= $sysvar ->{'Width'};
$bbweight   = $sysvar ->{'Weight'};
$bbmanufacturer = $sysvar ->{'Manufacturer'};
$bbmodel= $sysvar ->{'Model'};
$bbname = $sysvar ->{'name'};
$bbpartnumber   = $sysvar ->{'PartNumber'};
$bbproduct  = $sysvar ->{'Product'};
$bbrequiredescript  = $sysvar ->{'RequirementsDescription'};
$bbsku  = $sysvar ->{'SKU'};
$bbslotlayout   = $sysvar ->{'SlotLayout'};
$bbtag  = $sysvae ->{'Tag'};
}

# Now convert the system's Locale to a string
# Use the Rfc1766 Database stored in the Registry as a lookup table

$main::HKEY_LOCAL_MACHINE->Open("SOFTWARE\\Classes\\MIME\\Database\\Rfc1
766",$Rfc1766);
$Rfc1766->GetValues(\%Values);
foreach $key (keys %Values)
 {
  $key = $Values{$key};
  if ($$key[0] eq $os_locale)
   {
($lang, $country) = split(/\;/, $$key[2]);
last;
   } 
 }

print "System Summary Information\n";
print "--\n";
print "OS Name\t\t\t\t$os_name\n";
print "Version\t\t\t\t$os_version Build $os_build\n";
print "OS Manufacturer\t\t\t$os_manufacturer\n";
print "System Name\t\t\t$system_name\n";
print "System Manufacturer\t\t$system_manufacturer\n";
print "System Model\t\t\t$system_model\n";
print "System Type\t\t\t$system_type\n";
print "Processor\t\t\t$proc_description $proc_manufacturer ~$proc_mhz
Mhz\n";
#print "BIOS Version\t\t\t$bios_info\n";
print "Windows Directory\t\t$os_directory\n";
print "Locale\t\t\t\t$country\n";  
print "Time Zone\t\t\t$loc_timezone\n";
print "Total Physical Memory\t\t$os_totalmem KB\n";
print "Available Physical Memory\t$os_freemem KB \n";
print "Total Virtual Memory\t\t$os_totalvirtmem KB\n";
print "Available Virtual Memory\t$os_freevirtmem KB\n";
print "Page File Space\t\t\t$os_pagefilesize KB\n";
print("Caption is $bioscaption\n");
print("Base Board caption is $bbcaption\n");
print("Base Board configuration options @$bbconfigoptions\n");
print("Base Board depth is $bbdepth inches\n");
print("Base Board height is $bbheight inches\n");
print("Base Board width is $bbwidth inches\n");
print("Base Board weight is $bbweight lbs\n");
print("Base Board manufacturer is $bbmanufacturer\n");
print("Base Board model is $bbmodel\n");
print("Base Boa

RE: Battery info on a laptop

2006-03-04 Thread John Serink
Use the appropriate WMI classes with the Win32::OLE module.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of andrew Black
> Sent: Sunday, March 05, 2006 2:10 AM
> To: perl-win32-users
> Subject: Battery info on a laptop
> 
> 
> Hi
> Does anyone know if it is possible to get hold of the battery 
> information on an XP laptop via perl (or any other prog 
> language) Looking for whether on AC power / level of the battery etc
> 
> Andrew
> ___
> 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


threads and consoles

2006-01-16 Thread John Serink
Hi All:

Is there a way for a thread to have its own console separate from the
calling process?

Cheers,
john

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Info on reading COM ports

2006-01-08 Thread John Serink
Win32::Serialport

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Rajesh Vattem
> Sent: Saturday, January 07, 2006 2:54 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Info on reading COM ports
> 
> 
> 
> Hi,
> I am looking for ways to read a COM port (USB and baud rate > 
> 115200). Can some one advise me which is the efficient way to 
> do this. Thanks & Regards, Rajesh.
> 
> 
> 
> **
> The information contained in this email and any attachments
> is likely to be confidential and legally privileged, and is 
> for the intended recipient named above only. Any copying, 
> dissemination, disclosure of or use of this email or its 
> attachments unless authorised by us is prohibited, except 
> that you may forward this email and/or attachments to a third 
> party on a strict "need to know" basis. 
> 
> If you have received this email in error, please notify us 
> immediately by replying to the email or by calling 
> +91-80-26492700. Please then delete this email and any full
> or partial copies of it.
> 
> You as the intended recipient must be aware and accept 
> that emailis not a totally secure communications medium.
> 
> Although we have taken all reasonable steps to make 
> sure this email and any attachments are free from viruses, 
> we do not (to the extent permitted by law) accept any liability 
> whatsoever for any virus infection and/or compromise of 
> security caused by this email and any attachment.
> 
> No contract may be formed or documents served by you 
> on or with us by this email or any attachments unless 
> expressly agreed otherwise by us. 
> 
> Any views expressed in this email or attachments by 
> an individual are not necessarily those of UbiNetics 
> India (Private) Limited.
> 
> **
> 
> ___
> 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: MS SMTP and MS FTP server information

2005-12-31 Thread John Serink
Hi Steven:

Ok cool, I got it going with this:
use Win32::OLE qw (in);
use strict;
use warnings;

my $IIS = Win32::OLE->GetObject("IIS://johnathlonxpm");
my $PathList = $IIS->GetDataPaths("AuthAnonymous",0);


print("$PathList");
print("\n");

my $thislong = scalar(@$PathList);
print("This long is $thislong\n");
for(my $i=0; $i -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Steven Manross
> Sent: Saturday, December 31, 2005 10:46 AM
> To: Paul Sobey; perl-win32-users@listserv.ActiveState.com
> Subject: RE: MS SMTP and MS FTP server information
> 
> 
> Use an ADSI editor like the IIS 6 Metabase Explorer, ADSVW or others..
> 
> The metabase is stored here:
> 
> IIS://SERVERNAME
> 
> >From there you can do all sorts of cool stuff...
> 
> I use it to do some SOX auditing of IIS settings..
> 
> Realtime access and every possible setting is exposed via 
> this interface.
> 
> Perl can access it as well via the same interface.
> 
> Please forgive me if there are typos.
> 
> -
> 
> use Win32::OLE qw (in);
> 
> my $IIS = Win32::OLE->GetObject("IIS://Servername");
> $PathList = IIS->GetDataPaths("AuthAnonymous",0);
> 
> foreach $Path (in $PathList) {
>   if ($Path eq "IIS://" . $strSrv . 
> "/W3SVC/Info/Templates/Secure Web Site/Root" ||
>   $Path eq "IIS://" . $strSrv . "/W3SVC/Info/Templates/Public Web
> Site/Root") {
> #Do nothing..  these are templates
>   } else { 
> $iisnode = Win32::OLE->GetObject($Path);
> if ($iisnode->{AuthAnonymous} == 1) {
>   print $strSrv . " -- AUTHANONYMOUS -- " . $Path."\n";
> }
>   }
> }
>  
> Steven
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Wednesday, December 28, 2005 7:59 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: RE: MS SMTP and MS FTP server information
> 
> > How can I find this stuff with Perl?
> > I need to dump the SMTP and ftp settings, what MS calls properties,
> > from a machine for a report but the setup is done using IIS 
> with GUIs.
> > 
> > Anyone know how to do this? Where to get the information from? I've 
> > scoured the registry and can't find where Gates' hides it.
> 
> Depends on which version of IIS you mean. IIS 6 stores its 
> info in a plain xml file, system32\inetsrv\metabase.xml. You 
> can open this and play with standard tools, although you need 
> to configure IIS to allow edits while running, or shutdown 
> IIS, before making changes. You should find most of what you 
> need in there. Alternatively, you could check out the 
> ADSI/WMI providers:
> 
> http://www.microsoft.com/technet/prodtechnol/WindowsServer2003
> /Library/I
> IS/43a51d34-7c81-413b-9727-ec9a19d0b428.mspx
> 
> IIS 5 is not as easy since the metabase is a proprietry 
> binary format, but there are still command line/COM 
> interfaces to management I think.
> 
> I've never used any of this stuff but it looks promising.
> 
> Cheers,
> Paul
> 
> *
> Gloucester Research Limited believes the information provided 
> herein is reliable. While every care has been taken to ensure 
> accuracy, the information is furnished to the recipients with 
> no warranty as to the completeness and accuracy of its 
> contents and on condition that any errors or omissions shall 
> not be made the basis for any claim, demand or cause for action.
> 
> The information in this email is intended only for the named 
> recipient. If you are not the intended recipient please 
> notify us immediately and do not copy, distribute or take 
> action based on this e-mail.
> 
> Gloucester Research Limited, 5th Floor, Whittington House, 
> 19-30 Alfred Place, London WC1E 7EA
> *
> 
> ___
> 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
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


MS SMTP and MS FTP server information

2005-12-28 Thread John Serink
Hi All:

How can I find this stuff with Perl?
I need to dump the SMTP and ftp settings, what MS calls properties, from
a machine for a report but the setup is done using IIS with GUIs.

Anyone know how to do this? Where to get the information from?
I've scoured the registry and can't find where Gates' hides it.

Cheers,
John

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to quit when Windows shut down?

2005-12-20 Thread John Serink
You'll have to install the resource kit.
You canget the tools at www.microsoft.com


> -Original Message-
> From: Octavian Rasnita [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 20, 2005 4:11 PM
> To: John Serink; Ted Zeng; perl-win32-users@listserv.ActiveState.com
> Subject: Re: How to quit when Windows shut down?
> 
> 
> I couldn't find the shutdown command under Windows 2000 Teddy
> 
> ----- Original Message - 
> From: "John Serink" <[EMAIL PROTECTED]>
> To: "Ted Zeng" <[EMAIL PROTECTED]>; 
> 
> Sent: marti, 20 decembrie 2005 03:31 AM
> Subject: RE: How to quit when Windows shut down?
> 
> 
> C:\>shutdown /?
> Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m 
> \\computername] [-t xx] [-c "comment"] [ -d up:xx:yy]
> 
> No args Display this message (same as -?)
> -i  Display GUI interface, must 
> be the first
> option
> -l  Log off (cannot be used with 
> -m option)
> -s  Shutdown the computer
> -r  Shutdown and restart the computer
> -a  Abort a system shutdown
> -m \\computername   Remote computer to
> shutdown/restart/abort
> -t xx   Set timeout for shutdown to xx seconds
> -c "comment"Shutdown comment (maximum of 127
> characters)
> -f  Forces running applications to close
> without warning
> -d [u][p]:xx:yy The reason code for the shutdown
> u is the user code
> p is a planned shutdown code
> xx is the major reason code 
> (positive integer less than 25
> 6)
> yy is the minor reason code 
> (positive integer less than 65
> 536)
> 
> Use the -f switch.
> 
> John
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] 
> On Behalf 
> > Of Ted Zeng
> > Sent: Tuesday, December 20, 2005 6:53 AM
> > To: perl-win32-users@listserv.ActiveState.com
> > Subject: How to quit when Windows shut down?
> >
> >
> > Hi,
> >
> > I have a perl script that runs in an infinite loop whenever 
> a machine 
> > starts.
> >
> > My problem is, when I shut down the PC, Windows could not Stop the 
> > script. It put the dialog asking if user wants to stop the process.
> >
> > Is there a way in the script to quit automatically when 
> Windows shut 
> > down?
> >
> >
> > Ted zeng
> >
> > ___
> > 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
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to quit when Windows shut down?

2005-12-19 Thread John Serink
C:\>shutdown /?
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t
xx] [-c "comment"] [
-d up:xx:yy]

No args Display this message (same as -?)
-i  Display GUI interface, must be the first
option
-l  Log off (cannot be used with -m option)
-s  Shutdown the computer
-r  Shutdown and restart the computer
-a  Abort a system shutdown
-m \\computername   Remote computer to
shutdown/restart/abort
-t xx   Set timeout for shutdown to xx seconds
-c "comment"Shutdown comment (maximum of 127
characters)
-f  Forces running applications to close
without warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive
integer less than 25
6)
yy is the minor reason code (positive
integer less than 65
536)

Use the -f switch.

John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ted Zeng
> Sent: Tuesday, December 20, 2005 6:53 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: How to quit when Windows shut down?
> 
> 
> Hi,
> 
> I have a perl script that runs in an infinite loop whenever a 
> machine starts.
> 
> My problem is, when I shut down the PC, Windows could not
> Stop the script. It put the dialog asking if user wants to 
> stop the process.
> 
> Is there a way in the script to quit automatically when 
> Windows shut down?
> 
> 
> Ted zeng
> 
> ___
> 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 detect a disconnected socket?

2005-12-19 Thread John Serink
Hi Foo:

Partial reads means partial reads...
If you sending whole lines at one end you;ll probably not get the whole
lines all the time at the other.
You have to be prepared for that.

Cheers,
John

> -Original Message-
> From: Foo Ji-Haw [mailto:[EMAIL PROTECTED] 
> Sent: Monday, December 19, 2005 4:42 PM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: how to detect a disconnected socket?
> 
> 
> John Serink wrote:
> 
> >Ok, if you're using sockets I strongly recommend you ALWAYS using 
> >sysread and syswrite as they baypass standard IO buffereing.
> >
> >Be careful with sysread, it cand and will return partial reads, you 
> >MUST be prepared for that.
> >
> >Unless you want your program to block on sysread, you should use 
> >IO::Select. Now, from Stein's nEtwork Programming with Perl, as File 
> >handle is ready for reading when: 1. There is at least 1 
> byte of data 
> >in the file handle's input buffer, 2. There is an EOF on the file 
> >handle, the next call to sysread will return 0 in this case. With 
> >normal files this occurs at EOF, with sockets this occurs when the 
> >remote peer closes the connection, 3. There is a pending 
> error on the 
> >socket. The next sysread call will return undef and the 
> error will be 
> >in $!.
> >
> >
> >
> >So, what you are interested in is 2 or 3 or both.
> >  
> >
> Cool. Thanks for the tip John. When you mean partial reads, you don't 
> mean to say that any form of data corruption is taking place 
> right? It's 
> just that I will have to be responsible for putting Humpty 
> Dumpty (aka 
> the fragmented data) back together again?
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: how to detect a disconnected socket?

2005-12-18 Thread John Serink
Ok, if you're using sockets I strongly recommend you ALWAYS using
sysread and syswrite as they baypass standard IO buffereing.

Be careful with sysread, it cand and will return partial reads, you MUST
be prepared for that.

Unless you want your program to block on sysread, you should use
IO::Select. Now, from Stein's nEtwork Programming with Perl, as File
handle is ready for reading when:
1. There is at least 1 byte of data in the file handle's input buffer,
2. There is an EOF on the file handle, the next call to sysread will
return 0 in this case. With normal files this occurs at EOF, with
sockets this occurs when the remote peer closes the connection,
3. There is a pending error on the socket. The next sysread call will
return undef and the error will be in $!.



So, what you are interested in is 2 or 3 or both.

Code accordingly.

Cheers,
John 
 


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Monday, December 19, 2005 11:28 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: how to detect a disconnected socket?
> 
> 
> Hi all, I have the same issue (see subject title) as Trever in the 
> mailing list. Unfortunately reading through the mailing list 
> archive it 
> seems that his problem was not resolved. I'm hoping to have 
> better luck 
> with you guys. :)
> 
> Basically, I need to know if my IO::Socket::INET socket connection is 
> disconnected by the remote peer, in which case I will have to 
> close the 
> socket, reuse the thread for the next connection.
> 
> There were some mentions on using IO::Select:
> my $select = IO::Select->new($sock);
> while ($select->can_read)
> {
> ...
> }
> 
>  But it seems that it does not help in detecting the connection state 
> (it keeps returning 1).
> 
> Any ideas/ hints will be appreciated. Thanks. 
> ___
> 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: Inet::Socket::INET's line read fails

2005-12-05 Thread John Serink
Use sysread. You might want to use the IO:Select module to check if the
call will block before calling...
gives you a bit more control.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Tuesday, December 06, 2005 12:30 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Inet::Socket::INET's line read fails
> 
> 
> Hi all,
> 
> Just want to share and ask something about reading from the 
> sockets. Normally my connection to the Other Side receives 
> line inputs. But not 
> all the time the eol character is standard across the various remote 
> connections; sometimes it's just a 0x0D.
> 
> I realise that <$socket> does not always work, even with $/=char(13). 
> The safest way so far seems to be 'doing it yourself' with a loop 
> repeating getchar() calls until you hit the expected EOL 
> character. It 
> works, but I suspect the high hit rate on the function call 
> is not optimal.
> 
> If anyone has a better idea (or my $/=char(13) is just plain wrong), 
> please reply. Thanks. ___
> 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: Executing an external program from a perl scrip.

2005-12-05 Thread John Serink
First:
use "\" not "/".
Second:
You have to escape the "\" with a second "\" when using double quotes.

Your line needs to read:
$sys="C:\\antiword\\antiword.exe -t -w 1 document.doc >
C:\\Inetpub\\wwwroot\\somedir\\document.txt";

That shou'd work.

Alternatively, you could do it this way:
$sys='C:\antiword\antiword.exe -t -w 1 document.doc >
C:\Inetpub\wwwroot\somedir\document.txt";

That should work also.

Cheers,
john
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alejandro Santillan
> Sent: Tuesday, December 06, 2005 3:03 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Executing an external program from a perl scrip.
> 
> 
> Trying to migrate a perl script from linux to windows (IIS), 
> I need to execute a command line from within the perl script. 
> This snippet worked fine in linux (provided the path is 
> correct), but it didn't work in windows:
> 
> $sys="C:/antiword/antiword.exe -t -w 1 document.doc > 
> C:/Inetpub/wwwroot/somedir/document.txt";
> system($sys);
> 
> The snippet works fine if the script is run from the DOS 
> window, or by double clicking, but is makes nothing when it 
> is executed as a CGI. I've double checked that the 
> destination folder has write permissions working fine. Is the 
> "system(...);" sentence not appropriate under the windows 
> envirnonment?
> 
> Thanks,
> Alejandro
> 
> 
> ___
> 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: Detecting memory leaks in perl scripts

2005-11-27 Thread John Serink
perfmon or taskmanager.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sandhu, Suchindra
> Sent: Saturday, November 26, 2005 12:04 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Detecting memory leaks in perl scripts
> 
> 
> Greetings,
> 
> Is there a known tool(preferably free/open source) to 
> identify memory leaks in perl scripts ?
> 
> 
> Thanks,
> 
> --
> .s
> 
> ___
> 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: CPU Usage in Percentages for Each Process?

2005-11-27 Thread John Serink
#! perl

# ==
#   $Author: Jmk $
#   $Date: 19.05.98 7:12 $
#   $Archive: /Jmk/scripts/saa/process.pl $
#   $Revision: 2 $
# ==

# shows the task list like the task manager but of any computer

use Win32::PerfLib;
($server) = @ARGV;
#Win32::PerfLib::GetCounterNames($server, \%counter);
#%r_counter = map { $counter{$_} => $_ } keys %counter;
#$process_obj = $r_counter{Process};
#$process_id = $r_counter{'ID Process'};
#$processor_time = $r_counter{'% Processor Time'};

$process_obj = 230;
$process_id = 784;
$processor_time = 6;
$elapsed = 684;
$memory = 180;
$page_faults = 28;
$virtual_memory = 186;
$priority = 682;
$threads = 680;

$perflib = new Win32::PerfLib($server);
$proc_ref0 = {};
$proc_ref1 = {};
$perflib->GetObjectList($process_obj, $proc_ref0);
sleep 5;
$perflib->GetObjectList($process_obj, $proc_ref1);
$perflib->Close();
$instance_ref0 = $proc_ref0->{Objects}->{$process_obj}->{Instances};
$instance_ref1 = $proc_ref1->{Objects}->{$process_obj}->{Instances};
foreach $p (keys %{$instance_ref0})
{
 $counter_ref0 = $instance_ref0->{$p}->{Counters};
$counter_ref1 = $instance_ref1->{$p}->{Counters};
foreach $i (keys %{$counter_ref0})
{
next if $instance_ref0->{$p}->{Name} eq "_Total";
if($counter_ref0->{$i}->{CounterNameTitleIndex} == $process_id)
{
$process{$counter_ref0->{$i}->{Counter}} =
  $instance_ref0->{$p}->{Name};
$id{$counter_ref0->{$i}->{Counter}} = $p;
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $processor_time)
{
$Numerator0 = $counter_ref0->{$i}->{Counter};
$Denominator0 = $proc_ref0->{PerfTime100nSec};
$Numerator1 = $counter_ref1->{$i}->{Counter};
$Denominator1 = $proc_ref1->{PerfTime100nSec};
$proc_time{$p} = ($Numerator1 - $Numerator0) /
  ($Denominator1 - $Denominator0 ) * 100;
$cputime{$p} = int($counter_ref1->{$i}->{Counter} / 1000);
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $memory)
{
$memory{$p} = int($counter_ref0->{$i}->{Counter} / 1024);
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $page_faults)
{
$page_faults{$p} = $counter_ref1->{$i}->{Counter};
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $virtual_memory)
{
$virtual_memory{$p} = int($counter_ref0->{$i}->{Counter} / 1024);
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $priority)
{
$priority{$p} = $counter_ref0->{$i}->{Counter};
}
elsif($counter_ref0->{$i}->{CounterNameTitleIndex} == $threads)
{
$threads{$p} = $counter_ref0->{$i}->{Counter};
}
}
}
print " PID Process CPU   CPU-Time Memory   PF   Virt.Mem 
Priority Thr\n";
#   0 Idle  93.73   20:51:40   16 K10 K Unknown1
foreach $p (sort { $a <=> $b } keys %process)
{
$id = $id{$p};
$seconds = $cputime{$id};
$hour = int($seconds / 3600);
$seconds -= $hour * 3600;
$minute = int($seconds / 60);
$seconds -= $minute * 60;
if ($priority{$id} > 15)
{
$prio = "Realtime";
}
elsif ($priority{$id} > 10 )
{
$prio = "High";
}
elsif ($priority{$id} > 5 )
{
$prio = "Normal";
}
elsif ($priority{$id} > 0 )
{
$prio = "Low";
}
else
{
$prio = "Unknown";
}
printf("% 4d %-14s%5.2f  % 3d:%02d:%02d % 8d K % 8d % 8d K %8s % 3d\n",
   $p, $process{$p}, $proc_time{$id}, $hour, $minute, $seconds,
   $memory{$id}, $page_faults{$id}, $virtual_memory{$id},
   $prio, $threads{$id});
}


# ==
#   $History: process.pl $
# 
# *  Version 2  *
# User: Jmk  Date: 19.05.98   Time: 7:12
# Updated in $/Jmk/scripts/saa
# some comments added
# ==

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Veli-Pekka Tätilä
> Sent: Sunday, November 27, 2005 7:40 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: CPU Usage in Percentages for Each Process?
> 
> 
> Hi,
> Is there a module or some sample code that will let one find 
> out the CPU 
> usage of a given process in percentages? This figure is 
> highly useful and 
> can be viewed in XP's task manager. However, none of the 
> other tools I've 
> seen, including XP's tasklist and Sysinternal's process 
> tools, let you get 
> at the CPU Usage as such. Many do offer the CPU time, 
> however. I'd like to 
> experiment with changing process priorities in case of serius 
> peaks in CPU

RE: How to send mail from Perl

2005-11-18 Thread John Serink
Title: Message



net::SMTP

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Maxmelbin Neson (RBIN/EDM3)Sent: Friday, November 18, 2005 2:57 
  PMTo: [EMAIL PROTECTED]; 
  perl-win32-users@listserv.ActiveState.comSubject: How to send mail 
  from Perl
  Hello , 
   Perl ver - v5.6.1 
   I need help in the following 
  . 
   I need to send a mail with attachment 
  to user executing the program (if attachment is not possible , atleast 
  contents of that file) . This should work in both Windows and Unix 
.
   My mail server have authentication . 
  
  (I cannot change the Perl version) 
  
  Thanks in Advance for the help .. 
  
  Thanks and Regards 
  Maxmelbin Neson 
  
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: ActivePerl 5.8.7.815 released

2005-11-15 Thread John Serink
Doesn't seem to be, just checked
She's still leaving 2 handles open per thread after the thread has
ended.

Any idea when/if this will get fixed?

Cheers,
John

> -Original Message-
> From: Jan Dubois [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, November 16, 2005 9:30 AM
> To: John Serink; activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: RE: ActivePerl 5.8.7.815 released
> 
> 
> On Tue, 15 Nov 2005, John Serink wrote:
> > Anyone know if the leaking handles on win32 when using 
> shared arrays 
> > with threads is fixed? It wasn't mentioned in the change log.
> 
> There are no changes in that area.
> 
> Cheers,
> -Jan
> 
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: ActivePerl 5.8.7.815 released

2005-11-15 Thread John Serink
Anyone know if the leaking handles on win32 when using shared arrays
with threads is fixed?
It wasn't mentioned in the change log.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jan Dubois
> Sent: Wednesday, November 16, 2005 4:21 AM
> To: activeperl@listserv.ActiveState.com; 
> perl-win32-users@listserv.ActiveState.com
> Subject: ActivePerl 5.8.7.815 released
> 
> 
> ActivePerl 5.8.7 build 815 is now available for download from 
> our website.  It looks like the online docs on ASPN have not 
> been updated yet, so here are the important changes since build 813:
> 
> * Windows version includes PerlEx for IIS.
> 
> * HTML help and TOC are always updated when a module is installed,
>   by PPM, by CPAN shell, or even when installed manually.
> 
> * On Windows and OS X sample code in the HTML docs has syntax 
> highlighting.
> 
> * On Windows ActivePerl will automatically use MinGW to 
> compile modules
>   if Microsoft VC++ is not installed, but MinGW and dmake are.
> 
> * Security vulnerability CAN-2005-0448 has been addressed by replacing
>   the rmtree() function in File::Path.
> 
> * The following modules have been updated:
> 
> Archive-Tar-1.26
> Archive-Zip-1.16
> Compress-Zlib-1.41
> HTML-Parser-3.46
> IO-String-1.07
> libwin32-0.26
> Mac-Apps-Launch-1.92
> Mac-OSA-Simple-1.09
> Time-HiRes-1.76
> Unicode-String-1.09
> 
>   There are several fixes and new features for Windows in the updated
>   libwin32 module; please check the change log.
> 
> Cheers,
> -Jan
> 
> PS: Build 814 was identical to build 813 except for the addition of
> a beta version of PerlEx.
> 
> 
> 
> ___
> 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 from TCP socket using IO::Select

2005-11-07 Thread John Serink
Hi Ross:

You must use sysread with IO select. Do NOT use  as its buffered
IO.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ross Draper
> Sent: Tuesday, November 08, 2005 4:33 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Reading from TCP socket using IO::Select
> 
> 
> Hi all
> 
> I've been doing some work with TCP clients under perl on 
> Win32.  I have come across a curious problem that I could do 
> with some help on.
> 
> Having found a few examples of using IO::Select under win32 
> for TCP servers I have found that after selecting a handle 
> with data to be read from, I use the suggested "$buf = <$s>" 
> to read from the handle but on connections to certain systems 
> it "sticks/blocks".  I frequently get the first couple of 
> lines of output and then it freezes until I send something to 
> force the other end to send more data(Even though I can see 
> all the data I initially wanted was sent in the first packet).  
> 
> It is almost like the reading of the socket has gotten stuck 
> because of a lack of cr/lf on the received data?  An example 
> is using a tcp socket to connect to a router that has a 
> banner login page. I get the whole of the banner, but the 
> User prompt doesn't arrive until I force it to send more data 
> to me which "pushes" through the other data blocked in the 
> socket.  I know this sounds very much like autoflush, but the 
> IO socket manpage tell me this is on by default (and I've 
> tried setting it manually).  If I exchange the "$buf = <$s>" 
> for a while (<$s>) loop reading the data I sometime get all 
> of the data, including password prompts, but then it blocks, 
> making the use of select pretty redundant.
> 
> Could someone try the code below and prove my sanity and 
> maybe offer a solution?  I want to be able to read all the 
> data on the socket handle, but have no idea, what seems to 
> cause it to block when connecting to certain systems.  Maybe 
> some sort of sysread where I count the amount of remaining 
> data would do it, but it must be a simple case of how I am 
> dealing with the incoming data that is causing the problem.
> 
> Many thanks
> 
> Ross
> 
> ---
> 
> use IO::Socket;
> use IO::Select;
> 
> $socket1 = new IO::Socket::INET(
> PeerAddr =>   'myRouter',
> PeerPort =>   '23',
> Proto  => "tcp",
> Reuse  => 1,
> ) or die "Could not create client $!\n";
> 
> 
> my $readable = IO::Select->new; # Create a new 
> IO::Select object
> $readable->add($socket1); 
> while(1) {
> 
>   my (@ready) = $readable->can_read(1);
> 
>   foreach my $s (@ready) {
> 
> # uncomment these lines and comment out the ones below to 
> switch between methods
> # while (<$s>){
> # print $_;
> # }   
> #
>   my $buf = <$s>;   # Try to read a line
> 
>   print "Finished reading\n";
>   if( defined $buf ) {
>   print $buf;
>   }
>   }
> }
> 
> 
> All correspondence, attachments and agreements remain 
> strictly subject to fully executed contract.
> 
> (c) GCap Media plc 2005. All rights remain reserved.
> 
> This e-mail (and any attachments) contains information which 
> may be confidential, subject to intellectual property 
> protection and may be legally privileged and protected from 
> disclosure and unauthorised use. It is intended solely for 
> the use of the individual(s) or entity to whom it is 
> addressed and others specifically authorised to receive it. 
> If you are not the intended recipient of this e-mail or any 
> parts of it please telephone 020 7766 6000 immediately upon receipt.
> 
> No other person is authorised to copy, adapt, forward, 
> disclose, distribute or retain this e-mail in any form 
> without prior specific permission in writing from an 
> authorised representative of GCap Media plc.
> 
> We will not accept liability for any claims arising as a 
> result of the use of the internet to transmit information by 
> or to GCap Media plc.
> 
> 
> ___
> 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: Checking for internet connection

2005-11-01 Thread John Serink
It depends on how you are connected to the internet.

if its dialup, you could do this:
my @bob = `ipconfig/all`;
my $jim="";

foreach $jim @bob {
 if($jim=~m/ppp/i){
  last;
  }
}

if its not dialup, you can do something similar looking for the field
"IP Address" and checking if the stuff after the colon and space is an
appropriate address and not 0.0.0.0 or 169.254.x.x.

Hope this helps.

Cheers,
John 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michael D. Smith
> Sent: Wednesday, November 02, 2005 7:23 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Checking for internet connection
> 
> 
> 
> Is there a right way/best way to check for an internet connection?
> 
> Now I'm using LWP simple to retrieve a webpage, if that 
> fails, just assuming no connection. It's fast when it works. 
> I like fast, but that assumption is 
> not always
> correct and causes the script to fail inelegantly when it 
> isn't. I hate 
> inelegant :)
> 
> 
> Must be a better way. Any thoughts appreciated.
> 
> ms
> 
> ___
> 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: send a IP frame with a non owned IP as source

2005-10-12 Thread John Serink
Title: Message



You'll have to hack Winsock.
You could hack the stack in Linux but Gates doesn't give his source code 
out so.
:)
John

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  MarkusSent: Wednesday, October 12, 2005 3:40 PMTo: 
  perl-win32-users@listserv.ActiveState.comSubject: send a IP frame 
  with a non owned IP as source
  
  Hi 
  experts,
   
  I’m facing the problem that I need 
  to send simulated frames out where the source IP not equal to the own 
  interface IP.
  If I’m forcing another IP then the 
  I get a error.
   
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: how to interact with an endless loop

2005-10-06 Thread John Serink
Check the IO::Select docs...
they work only for socket on Win32, you can't use them from file handles
including STDIN unfortunately.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Su, Yu (Eugene)
> Sent: Friday, October 07, 2005 3:08 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: RE: how to interact with an endless loop
> 
> 
> Hi All,
> 
> I want to write a simple perl script to start an endless loop 
> (for reading data from a periphery device, such as a 
> measurement unit), but I also want to be able to stop it 
> anytime. Right now I use "Ctrl-Alt-Del" to do it. There must 
> be a better way. I has been trying to use open, pipe...not 
> seem to understand how to use them.
> 
> # uncompleted code snippet #
> 
> use strict;
> use warnings;
> use Tk;
> use IO::Handle;
> 
> sub msgbox {
>   my $msg=shift;
>   my $mw = MainWindow->new;
>   $mw->title("Attention!");
>   $mw->Label(-text => $msg,
>   -width => 50,
>   -height => 8,
>   -font => "Arial 24 normal") -> pack;
>   $mw->Button(-text => "OK", -font => "Arial 18 normal", 
> -command => sub {$mw->destroy})->pack;
>   $mw->focusForce;
>   MainLoop;
>   return 1;
> }
> 
> # pop up a message widget and start a endless do loop at the 
> same time. 
> # msgbox("Press OK to stop the program.");
> # start a do loop, until the OK button is pressed
> # do
> # {
> # print "\nreading...";
> # #read_temperature_sensor();
> # sleep(1);
> #
> # }until (OK button is pressed?)
> 
> Any idea how to do it? 
> 
> Thanks for help.
> 
> -Eugene
> ___
> 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: Cross platform issues

2005-10-06 Thread John Serink
However, this works:
use strict;
use warnings;

my $windoze;

BEGIN {
$windoze = 1 if $^O eq 'MWin32';
if ($windoze) {
print "Looks like its Windoze\n";
eval "use Win32::Console";
} else {
print "Looks like its not Windoze\n";
eval "use Term::ANSIScreen";
}
}

# ...

my $console;
if ($windoze) {
no strict;
print "Win32::Console \n";
$console = Win32::Console->new(STD_OUTPUT_HANDLE);
} else {
print "Term::ANSIScreen  \n";
$console = Term::ANSIScreen->new();
}


Don't really like have the 'no strict' in there but it's a work around
unless we can come up with something more elegant.

Cheers,
John

> -Original Message-
> From: John Serink 
> Sent: Thursday, October 06, 2005 10:13 PM
> To: '$Bill Luebkert'
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: RE: Cross platform issues
> 
> 
> Hi Bill:
> 
> Ok, tried your example, here it is on windows:
> use strict;
> use warnings;
> 
> my $windoze;
> 
> BEGIN {
>   $windoze = 1 if $^O eq 'MSWin32';
>   if ($windoze) {
>   print "Looks like its Windoze\n";
>   eval "use Win32::Console";
>   } else {
>   print "Looks like its not Windoze\n";
>   eval "use Term::ANSIScreen";
>   }
> }
> 
> # ...
> 
> my $console;
> if ($windoze) {
>   print "Win32::Console \n";
>   $console = Win32::Console->new(STD_OUTPUT_HANDLE);
> } else {
>   print "Term::ANSIScreen  \n";
>   $console = Term::ANSIScreen->new();
> }
> Here is the output:
> D:\linux>perl eval1.pl
> Looks like its Windoze
> Win32::Console
> 
> Now, I'm a lazy person and don't want to reboot and go into 
> Linux so I change the MSWin32 to MWin32 so that the test 
> fails like this: use strict; use warnings;
> 
> my $windoze;
> 
> BEGIN {
>   $windoze = 1 if $^O eq 'MWin32';
>   if ($windoze) {
>   print "Looks like its Windoze\n";
>   eval "use Win32::Console";
>   } else {
>   print "Looks like its not Windoze\n";
>   eval "use Term::ANSIScreen";
>   }
> }
> 
> # ...
> 
> my $console;
> if ($windoze) {
>   print "Win32::Console \n";
>   $console = Win32::Console->new(STD_OUTPUT_HANDLE);
> } else {
>   print "Term::ANSIScreen  \n";
>   $console = Term::ANSIScreen->new();
> }
> Now when I run it:
> D:\linux>perl eval1.pl
> Looks like its not Windoze
> Bareword "STD_OUTPUT_HANDLE" not allowed while "strict subs" 
> in use at eval1.pl line 22. Execution of eval1.pl aborted due 
> to compilation errors.
> 
> Same problem. See what I mean?
> Any thoughts?
> 
> > -Original Message-
> > From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 06, 2005 6:42 PM
> > To: John Serink
> > Cc: perl-win32-users@listserv.ActiveState.com
> > Subject: Re: Cross platform issues
> > 
> > 
> > John Serink wrote:
> > > Hi All:
> > > 
> > > Ok, I need to use either Win32::Console or Term::ANSIScreen
> > depending
> > > whether I'm on a Linux platform or Windoze box, so I do
> > this: if($^O
> > > eq "MSWin32"){ # Check which OS
> > >   print("Looks like its $^O\n");
> > >   require Win32::Console;
> > > } else {
> > >   require Term::ANSIScreen;
> > > }
> > > Works fine, however, later on the code I need to create a
> > console object
> > > like this:
> > > if($^O eq "MSWin32"){
> > > # Check which OS
> > >   $console = Win32::Console->new(STD_OUTPUT_HANDLE);
> > > } else {
> > >   $console = Term::ANSIScreen->new();
> > > }
> > > 
> > > And that is the fly in the ointment. I get an error about
> > > STD_OUTPUT_HANDLE as it's a constant in the Win32::Console 
> > module but
> > > its not loaded yet on Windows and never loads on Linux, so
> > the error
> > > makes the script abort.
> > > 
> > > D:\linux>perl init25g.pl 192.168.1.27 4002 client 10 13 Bareword
> > > "STD_OUTPUT_HANDLE" not allowed while "strict subs" in use at 
> > > init25g.pl line 73.
> > > 
> > > Executio

RE: Cross platform issues

2005-10-06 Thread John Serink
Hi Bill:

Ok, tried your example, here it is on windows:
use strict;
use warnings;

my $windoze;

BEGIN {
$windoze = 1 if $^O eq 'MSWin32';
if ($windoze) {
print "Looks like its Windoze\n";
eval "use Win32::Console";
} else {
print "Looks like its not Windoze\n";
eval "use Term::ANSIScreen";
}
}

# ...

my $console;
if ($windoze) {
print "Win32::Console \n";
$console = Win32::Console->new(STD_OUTPUT_HANDLE);
} else {
print "Term::ANSIScreen  \n";
$console = Term::ANSIScreen->new();
}
Here is the output:
D:\linux>perl eval1.pl
Looks like its Windoze
Win32::Console

Now, I'm a lazy person and don't want to reboot and go into Linux so I
change the MSWin32 to MWin32 so that the test fails like this:
use strict;
use warnings;

my $windoze;

BEGIN {
$windoze = 1 if $^O eq 'MWin32';
if ($windoze) {
print "Looks like its Windoze\n";
eval "use Win32::Console";
} else {
print "Looks like its not Windoze\n";
eval "use Term::ANSIScreen";
}
}

# ...

my $console;
if ($windoze) {
print "Win32::Console \n";
$console = Win32::Console->new(STD_OUTPUT_HANDLE);
} else {
print "Term::ANSIScreen  \n";
$console = Term::ANSIScreen->new();
}
Now when I run it:
D:\linux>perl eval1.pl
Looks like its not Windoze
Bareword "STD_OUTPUT_HANDLE" not allowed while "strict subs" in use at
eval1.pl line 22.
Execution of eval1.pl aborted due to compilation errors.

Same problem. See what I mean?
Any thoughts?

> -Original Message-
> From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 06, 2005 6:42 PM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: Cross platform issues
> 
> 
> John Serink wrote:
> > Hi All:
> > 
> > Ok, I need to use either Win32::Console or Term::ANSIScreen 
> depending 
> > whether I'm on a Linux platform or Windoze box, so I do 
> this: if($^O 
> > eq "MSWin32"){ # Check which OS
> > print("Looks like its $^O\n");
> > require Win32::Console;
> > } else {
> > require Term::ANSIScreen;
> > }
> > Works fine, however, later on the code I need to create a 
> console object
> > like this:
> > if($^O eq "MSWin32"){
> > # Check which OS
> > $console = Win32::Console->new(STD_OUTPUT_HANDLE);
> > } else {
> > $console = Term::ANSIScreen->new();
> > }
> > 
> > And that is the fly in the ointment. I get an error about 
> > STD_OUTPUT_HANDLE as it's a constant in the Win32::Console 
> module but 
> > its not loaded yet on Windows and never loads on Linux, so 
> the error 
> > makes the script abort.
> > 
> > D:\linux>perl init25g.pl 192.168.1.27 4002 client 10 13 Bareword 
> > "STD_OUTPUT_HANDLE" not allowed while "strict subs" in use at 
> > init25g.pl line 73.
> > 
> > Execution of init25g.pl aborted due to compilation errors.
> > 
> > How do I get around this?
> 
> You could do something like:
> 
> my $windoze;
> 
> BEGIN {
>   $windoze = 1 if $^O eq 'MSWin32';
>   if ($windoze) {
>   print "Looks like its Windoze\n";
>   eval "use Win32::Console";
>   } else {
>   print "Looks like its not Windoze\n";
>   eval "use Term::ANSIScreen";
>   }
> }
> 
> # ...
> 
> my $console;
> if ($windoze) {
>   print "Win32::Console \n";
>   $console = Win32::Console->new(STD_OUTPUT_HANDLE);
> } else {
>   print "Term::ANSIScreen  \n";
>   $console = Term::ANSIScreen->new();
> }
> 
> 
> -- 
>   ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Cross platform issues

2005-10-06 Thread John Serink
Hi All:

Ok, I need to use either Win32::Console or Term::ANSIScreen depending
whether I'm on a Linux platform or Windoze box, so I do this:
if($^O eq "MSWin32"){
# Check which OS
print("Looks like its $^O\n");
require Win32::Console;
} else {
require Term::ANSIScreen;
}
Works fine, however, later on the code I need to create a console object
like this:
if($^O eq "MSWin32"){
# Check which OS
$console = Win32::Console->new(STD_OUTPUT_HANDLE);
} else {
$console = Term::ANSIScreen->new();
}

And that is the fly in the ointment. I get an error about
STD_OUTPUT_HANDLE as it's a constant in the Win32::Console module but
its not loaded yet on Windows and never loads on Linux, so the error
makes the script abort.

D:\linux>perl init25g.pl 192.168.1.27 4002 client 10 13
Bareword "STD_OUTPUT_HANDLE" not allowed while "strict subs" in use at
init25g.pl line 73.

Execution of init25g.pl aborted due to compilation errors.

How do I get around this?

Cheers,
john

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: perl packet manager problem

2005-10-04 Thread John Serink
Title: Message



When I tried it:
F:\perl\practice\VRS>ppm3PPM - Programmer's 
Package Manager version 3.2.Copyright (c) 2001 ActiveState Corp. All Rights 
Reserved.ActiveState is a division of Sophos.
 
Entering interactive shell. Using Term::ReadLine::Perl 
as readline library.
 
Type 'help' to get started.
 
ppm> search Crypt-RandomSearching in Active 
Repositories  1. Crypt-Random [1.25] Cryptographically Secure, True 
Random Number Generator.  2. Crypt-Random [1.25] Cryptographically 
Secure, True Random Number Generator.  3. Crypt-Random [1.13] 
Cryptographically Secure, True Random Number Generator.ppm> install 
Crypt-RandomInstall 'Class-Loader' version 2.03 in 
ActivePerl 5.8.0.806.Downloaded 3672 
bytes.Extracting 6/6: blib/arch/auto/Class/Loader/.existsInstalling 
F:\perl\html\site\lib\Class\Loader.htmlInstalling 
F:\perl\site\lib\Class\Loader.pmInstalling 
F:\perl\site\lib\Class\LoaderTest.pmSuccessfully installed Class-Loader 
version 2.03 in ActivePerl 5.8.0.806.Install 
'Math-Pari' version 2.010603 in ActivePerl 
5.8.0.806.Downloaded 1185100 bytes.Extracting 
15/15: blib/arch/auto/Math/Pari/Pari.libInstalling 
F:\perl\site\lib\auto\Math\Pari\Pari.bsInstalling 
F:\perl\site\lib\auto\Math\Pari\Pari.dllInstalling 
F:\perl\site\lib\auto\Math\Pari\Pari.expInstalling 
F:\perl\site\lib\auto\Math\Pari\Pari.libInstalling 
F:\perl\html\site\lib\Math\libPARI.dumb.htmlInstalling 
F:\perl\html\site\lib\Math\libPARI.htmlInstalling 
F:\perl\html\site\lib\Math\Pari.htmlInstalling 
F:\perl\html\site\lib\Math\PariInit.htmlFiles found in blib\arch: installing 
files in blib\lib into architecture dependent 
library treeInstalling 
F:\perl\site\lib\Math\libPARI.dumb.podInstalling 
F:\perl\site\lib\Math\libPARI.podInstalling 
F:\perl\site\lib\Math\Pari.pmInstalling 
F:\perl\site\lib\Math\PariInit.pmSuccessfully installed Math-Pari version 
2.010603 in ActivePerl 5.8.0.806.Install 
'Crypt-Random' version 1.25 in ActivePerl 
5.8.0.806.Downloaded 6627 bytes.Extracting 
14/14: blib/arch/auto/Crypt/Random/.existsInstalling 
F:\perl\html\site\lib\Crypt\Random.htmlInstalling 
F:\perl\site\lib\Crypt\Random.pmInstalling 
F:\perl\site\lib\Crypt\Random\Generator.pmInstalling 
F:\perl\site\lib\Crypt\Random\Provider\devrandom.pmInstalling 
F:\perl\site\lib\Crypt\Random\Provider\devurandom.pmInstalling 
F:\perl\site\lib\Crypt\Random\Provider\egd.pmInstalling 
F:\perl\site\lib\Crypt\Random\Provider\File.pmInstalling 
F:\perl\site\lib\Crypt\Random\Provider\rand.pmInstalling 
F:\perl\bin\makerandomInstalling F:\perl\bin\makerandom.batSuccessfully 
installed Crypt-Random version 1.25 in ActivePerl 
5.8.0.806.ppm>
 
 
In short, it worked fine.
 
Cheers,
john
 
 

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  MarkusSent: Tuesday, October 04, 2005 2:50 PMTo: 
  perl-win32-users@listserv.ActiveState.comSubject: perl packet 
  manager problem
  
  Hi 
  all,
   
  I’m facing the problem to post 
  install an additional module called “Crypt::Random”.
  If I force an installation with 
  the ppm, then during installation occurs following 
  error:
   
  C:\>ppm install 
  Crypt::Random
  Searching for 'Crypt::Random' 
  returned multiple results. Using 'search' instead...
  Searching in Active 
  Repositories
    1. Crypt-Random [1.25] 
  Cryptographically Secure, True Random Number Generator.
    2. Crypt-Random [1.25] 
  Cryptographically Secure, True Random Number Generator.
   C:\>
   
   
  The search process display the 
  same both entries with identical version numbers.
  How can I resolve this 
  issue?
   
  Best 
  regards,
  Markus
   
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Making cmd.exe an ANSI compliant terminal

2005-10-03 Thread John Serink
Anybody know how to do this?

I want to use Term::ANSIColor on a windoze box, but when I run this:
use strict;
use warnings;
use Term::ANSIColor;


print( color 'bold blue');
print( "This text is bold blue.\n");
print( color 'reset');
print("This text is normal.\n");
print(colored ("Yellow on magenta.\n", 'yellow on_magenta'));
print( "This text is normal.\n");
print( colored ['yellow on_magenta'], "Yellow on magenta.\n");

I get this on cmd.exe:
F:\perl\practice\VRS>perl term1.pl
←[1;34mThis text is bold blue.
←[0mThis text is normal.
←[33;45mYellow on magenta.
←[0mThis text is normal.
←[33;45mYellow on magenta.
←[0m
F:\perl\practice\VRS>
If I enable my telnet service and then telnet into my machine from a cmd.exe 
session, the output displays correctly as the telnet client is ANSI compliant.

Any clues? Is this possible?

Cheers,
John


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Adding values to hashes

2005-09-22 Thread John Serink
Actually, that was the problem.
Cheers,
John

> -Original Message-
> From: Reinhard Pagitsch [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 22, 2005 4:59 PM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: Adding values to hashes
> 
> 
> Hello John,
> Do you have blank lines in the configuration file? This could be the 
> problem.
> 
> 
> John Serink wrote:
> 
> >Hi All:
> >
> >I'm using strict and use warnings in my script and I read in a 
> >configuration file. I think parse it and I want to load some 
> names and 
> >phone numbers into a hash like this: my %ToSend=('party',000);
> >for(my $i=0;$i > if($numberlist == 1){
> > $config[$i]=~m/=/;
> > $ToSend{$`}=$'; # line 35
> > chomp($ToSend{$`}); # Line 36
> > }
> > if($config[$i]=~m/SERVER=/){
> > $host=$';
> > chomp($host);
> > } elsif ($config[$i]=~m/PASSWORD=/){
> > $smspassword=$';
> > chomp($smspassword);
> > } elsif ($config[$i]=~m/NUMBER LIST/){
> > $numberlist=1;
> > }
> >}
> >my @thekeys = keys(%ToSend);
> >print(@thekeys);
> >print("\n");
> >for(my $i=0;$i > print("$thekeys[$i] with cell number:$ToSend{$thekeys[$i]}\n");
> ># line 52
> >}
> >
> >This all works except I get these warnings:
> >Use of uninitialized value in hash element at smstest_13.pl line 35, 
> > line 7. Use of uninitialized value in hash element at 
> >smstest_13.pl line 36,  line 7.
> >Use of uninitialized value in scalar chomp at smstest_13.pl line 36,
> > line 7.
> >LimWan KamelAngparty
> >Use of uninitialized value in concatenation (.) or string at
> >smstest_13.pl line 52, 
> > line 7.
> >
> >Anybody know why I'm getting these warnings? The script all 
> works and 
> >does the stuff I want it to but would like to get rid of the 
> warnings.
> >
> >Cheers,
> >John
> >
> >___
> >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


Adding values to hashes

2005-09-22 Thread John Serink
Hi All:

I'm using strict and use warnings in my script and I read in a
configuration file. I think parse it and I want to load some names and
phone numbers into a hash like this:
my %ToSend=('party',000);
for(my $i=0;$i line 7.
Use of uninitialized value in hash element at smstest_13.pl line 36,
 line 7.
Use of uninitialized value in scalar chomp at smstest_13.pl line 36,
 line 7.
LimWan KamelAngparty
Use of uninitialized value in concatenation (.) or string at
smstest_13.pl line 52, 
 line 7.

Anybody know why I'm getting these warnings? The script all works and
does the stuff I want it to but would like to get rid of the warnings.

Cheers,
John

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Check for running process

2005-09-20 Thread John Serink
Title: Message



my @jim=`tasklist`;
 
now parse jim and find with you're looking for.
ALternatively:
my @jim=`tasklist|find "whatyou'relookingfor"`;
 
Jim will likely contain only one entry now, the thing you're looking 
for.
 
:)
John

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Darrell SnedecorSent: Tuesday, September 20, 2005 9:47 
  PMTo: perl-win32-users@listserv.ActiveState.comSubject: 
  Check for running process
  How do I use Perl 
  to check for the existence of a running program in 
Windows?
   
   
  Best Regards
  Darrell Snedecor
  Director
  Harrisburg Project
  800-635-5274  
  618-253-8504
   
   
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Socket::INET question

2005-08-31 Thread John Serink
Make sure you set the reuse to 1.
You could also try $return_val=$sock->shutdown(AF_INET);
rather than close($sock);

Cheers,
John

> -Original Message-
> From: Peter Eisengrein [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 01, 2005 10:35 AM
> To: John Serink; Peter Eisengrein; 'Perl-Win32-Users Mailing 
> List (E-mail) '
> Subject: RE: :Socket::INET question
> 
> 
> 
> > You need to use the IO:Select module which makes the ports non- 
> > blocking. When you check the port for reading, it will 
> indicate there 
> > is something
> > to read. When you read it using sysread if it returns:
> > 0 = the socket has disconnected.
> > undef = there was an error on the handle, $! has been set 
> to the error
> > code.
> >  
> > So, in short, use the IO:Select module to check the handle 
> BEFORE you 
> > attempt to read so that it won't block. When there is something to 
> > read, if sysread returns 0, the socket is disconnected, 
> close it down 
> > and carry on.
>  
> 
> Perhaps I'm doing something wrong then. I think I am doing 
> this but when I close the connection it still takes a couple 
> minutes for it to flush. Here's where it is happening:
> 
> # 
> 
> if ($bufflen==0) {
>CloseSocket($sock);
> } else {
>my $l=syswrite($param->{'corresponding_sock'},$buff);
>print LOG "$buff" if ($log == 1);
>if ($l != $bufflen) { die "can't write all data\n"; }
> }
> 
> # 
> 
> then in sub CloseSocket I do $sock->close() among other 
> things. Hmmm
> 
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Socket::INET question

2005-08-31 Thread John Serink
Title: Message



You need to use the IO:Select module which makes the ports 
non-blocking.
When you check the port for reading, it will indicate there is something 
to read. When you read it using sysread if it returns:
0 = the socket has disconnected.
undef = there was an error on the handle, $! has been set to the error 
code.
 
So, in short, use the IO:Select module to check the handle BEFORE you 
attempt to read so that it won't block. When there is something to read, if 
sysread returns 0, the socket is disconnected, close it down and carry 
on.
 
Cheers,
john
 

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Peter EisengreinSent: Thursday, September 01, 2005 5:46 
  AMTo: Perl-Win32-Users Mailing List (E-mail)Subject: 
  IO::Socket::INET question
  I have an 
  app using IO::Socket::INET that accepts (and makes) connections. If the 
  connection drops for whatever reason it takes a couple minutes for that tcp 
  port to be flushed and accept a new connection. 
   
  My 
  question: if I add the ReusePort option to the new() method, will this flush 
  the port and allow a connection immediately (or very soon) after the first 
  connection is dropped?
   
   
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: [threads] Forced termination

2005-08-25 Thread John Serink
You sure this works under windows?

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Tom Pollard
> Sent: Friday, August 26, 2005 2:17 AM
> To: ajpeck
> Cc: Perl Win32 mail list
> Subject: Re: [threads] Forced termination
> 
> 
> On Thu, 25 Aug 2005, ajpeck wrote:
> > Is there a way to forcibly terminate a thread after a specified time
> > regardless if the thread is finished executing. 
> 
> The standard eval{}-timeout technique apparently works well 
> for threads. That is, wrap the code that might hang for 5 min 
> in an eval{} block and use an alarm to time it out, e.g.
> 
> eval {
>   local %SIG{ALRM} = { die "TIMEOUT\n"; };
>   alarm 5;
>   <...your code here...>
>   alarm 0;
> }
> giveup() if $@ =~ /^TIMEOUT/;
> 
> ...where giveup() does whatver you need to do to exit from the thread 
> prematurely.  In general, threads and signals are awkward to 
> use together, 
> but this particular idiom has been unproblematic for us in 
> our threaded 
> perl apps.
> 
> TomP
> 
> > I have threads which
> > call certain network functions that have very long hard 
> coded timeouts, 
> > such as 5 mins. A no response of 5 secs is sufficient for 
> me to know 
> > that there is a problem and the nature of it is not needed (device 
> > switched off, network break, etc). These threads only write 
> out a status 
> > result (threads::shared variable) at the very end of the thread 
> > execution, thus terminating the thread early from within the parent 
> > thread and with no result written is good enough for me to 
> know that 
> > there is a problem.
> > 
> > Is there a way to impliment timed thread termination, if so I would
> > appreciate it very much for a very simple example.
> 
> --
> ---
> Tom Pollard   
> [EMAIL PROTECTED]
> Schrodinger, Inc.646-366-9555 x102
> --
> ---
> 
> 
> ___
> 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: [threads] Forced termination

2005-08-25 Thread John Serink
I do this for connecting to ADAM modules which are running MODBUS
servers on port 502.

I use threads as the tcp timeouts in Win32 don't work since I  have to
connect to 27 of these. it takes about about 20 seconds for the thread
to timeout and die if the host I'm trying to connect to isn't
there...and that's fine, works for me.

What are you doing that it takes 5 minutes to timeout?

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ajpeck
> Sent: Thursday, August 25, 2005 3:58 PM
> To: Perl Win32 mail list
> Subject: Re: [threads] Forced termination
> 
> 
> The problem is that I need to reclaim the memory resource of 
> the thread 
> that is not needed no more, so I can start off a new thread. 
> Thus detach 
> is not suitable in this case.
> 
> Alun
> 
> John Serink wrote:
> 
> >Just detach them and forget about them.
> >other than that, I don't think there's a way to terminate them.
> >
> >  
> >
> >>-Original Message-
> >>From: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] On 
> >>Behalf Of ajpeck
> >>Sent: Thursday, August 25, 2005 3:02 PM
> >>To: Perl Win32 mail list
> >>Subject: [threads] Forced termination
> >>
> >>
> >>Is there a way to forcibly terminate a thread after a specified time
> >>regardless if the thread is finished executing. I have 
> threads which 
> >>call certain network functions that have very long hard coded 
> >>timeouts, 
> >>such as 5 mins. A no response of 5 secs is sufficient for 
> me to know 
> >>that there is a problem and the nature of it is not needed (device 
> >>switched off, network break, etc). These threads only write 
> >>out a status 
> >>result (threads::shared variable) at the very end of the thread 
> >>execution, thus terminating the thread early from within the parent 
> >>thread and with no result written is good enough for me to 
> know that 
> >>there is a problem.
> >>
> >>Is there a way to impliment timed thread termination, if so I would
> >>appreciate it very much for a very simple example.
> >>
> >>Thanx
> >>
> >>--
> >>Alun Peck
> >>Section Head: Computers
> >>Department of Mathematical Technology
> >>Faculty of Natural Sciences
> >>Tshwane University of Technology
> >>[EMAIL PROTECTED]
> >>Tel: (012) 318 6389
> >>Fax: (012) 318 6114
> >>
> >>___
> >>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
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: [threads] Forced termination

2005-08-25 Thread John Serink
Just detach them and forget about them.
other than that, I don't think there's a way to terminate them.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of ajpeck
> Sent: Thursday, August 25, 2005 3:02 PM
> To: Perl Win32 mail list
> Subject: [threads] Forced termination
> 
> 
> Is there a way to forcibly terminate a thread after a specified time 
> regardless if the thread is finished executing. I have threads which 
> call certain network functions that have very long hard coded 
> timeouts, 
> such as 5 mins. A no response of 5 secs is sufficient for me to know 
> that there is a problem and the nature of it is not needed (device 
> switched off, network break, etc). These threads only write 
> out a status 
> result (threads::shared variable) at the very end of the thread 
> execution, thus terminating the thread early from within the parent 
> thread and with no result written is good enough for me to know that 
> there is a problem.
> 
> Is there a way to impliment timed thread termination, if so I would 
> appreciate it very much for a very simple example.
> 
> Thanx
> 
> -- 
> Alun Peck
> Section Head: Computers
> Department of Mathematical Technology
> Faculty of Natural Sciences
> Tshwane University of Technology
> [EMAIL PROTECTED]
> Tel: (012) 318 6389
> Fax: (012) 318 6114
> 
> ___
> 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: references - inject sub/params into longterm running thread

2005-07-25 Thread John Serink
If you use shared arrays or hashes, Win32 perl will leak handles if you
use threads.
It will leak 2 handles per thread. If you're only starting say a couple
of threads an hour, no problem. If you're starting hindreds, within a
week or so, you'll run out of resource space for the process and it will
crash.

The leaking handles is a known bug when using threads on Win32.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 26, 2005 11:20 AM
> To: perl-win32-users@listserv.ActiveState.com
> Cc: John Serink
> Subject: RE: references - inject sub/params into longterm 
> running thread
> 
> 
> hi there
> 
> basically...I have instantiated long term running thread/s.
> 
> in the main thread, i want to pass a subroutine (code ref) 
> and its parameters 
> into a threads::shared variable, then execute it in a 
> separate thread running 
> in a while loop.
> 
> I want to do this, because having a group of a couple 
> instantiated long term 
> running threads, before processing starts, would be less 
> expensive, then 
> instantiated many short term threads for each call...which 
> would be expensive 
> and affect performance due to the lag in thread creation.
> 
> calls and subroutine's/parameters will vary, so injecting the 
> code into a 
> running thread is what i would like.
> 
> I hope you all now can understand. Thanks in advance for your help.
> 
> Regards,
> - Jeremy A. 
>  
> 
> Quoting John Serink <[EMAIL PROTECTED]>:
> 
> > Why don't you pass the parameters as references.
> > They work like pointers in C kindof.
> > 
> > Why do you want to reference your subroutine?
> 
> 
> 
> 
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On 
> > > Behalf Of [EMAIL PROTECTED]
> > > Sent: Tuesday, July 26, 2005 2:19 AM
> > > To: $Bill Luebkert
> > > Cc: perl-win32-users@listserv.ActiveState.com
> > > Subject: Re: references 
> > > 
> > > 
> > > hello again,
> > > 
> > > > > hello all,
> > > > > 
> > > > > here is a ref/deref problem
> > > > > 
> > > > > I need to take a socket handle, convert it to a socket
> > > ref, then a
> > > > > scaler
> > > > > string
> > > > > 
> > > > > A bit later in the same script, I need to take that scaler 
> > > > > string
> > > > > and turn
> > > > it
> > > > > back to a socket ref, and deref it back to the socket handle.
> > > > 
> > > > Maybe instead of asking for the way to implement your solution, 
> > > > you
> > > > should describe the complete problem and see if we can come 
> > > up with an
> > > > alternate solution that is a little less convoluted.  :)
> > > 
> > > let me clarify my problem.
> > > 
> > > I have a reference of a subroutine.
> > > 
> > > eg.
> > > 
> > > $sub = "test";
> > > 
> > > ..deref and execute
> > > 
> > > &$sub;
> > > 
> > > ...
> > > 
> > > sub test {
> > > my ($sockethandle,$blah...) = @_;
> > > ..do something
> > > }
> > > 
> > > 
> > > in order to pass the paramenters, i decided to do this :
> > > 
> > > sub main {
> > > 
> > > my $sub = "test|$sockethandle";
> > > ($sub,@_) = split(/\|/,$sub);
> > > 
> > > $⊂
> > > }
> > > 
> > > 
> > > if this is to work correctly, I need to take a socket handle,
> > > convert it to a 
> > > socket ref, then a scaler, so i can pass it as a parameter. 
> > > in order to use the 
> > > socket later, i have to take the scaler, convert it to the 
> > > socket ref, then 
> > > dereference it.
> > > 
> > > Is there an easier way to pass parameters with a subroutine
> > > reference? 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ___
> > > 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: references of sub and params in a threads::shared variable

2005-07-25 Thread John Serink
Yup.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, July 26, 2005 6:10 AM
> To: Siebe Tolsma
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: references of sub and params in a threads::shared variable
> 
> 
> how do i use this hash as a shared variable to be used in 
> threads? eg. with threads::shared
> 
> -Jeremy A
> 
> > Why not make it a hash?
> > 
> > my $sub = { ref => \&test, params => [$sockethandle] }; 
> > $sub->{ref}->(@{$sub->{params}});
> > 
> > sub test {
> > my $socket = shift;
> > # ...
> > }
> > 
> > 
> > > hello again,
> > >
> > > > > hello all,
> > > > >
> > > > > here is a ref/deref problem
> > > > >
> > > > > I need to take a socket handle, convert it to a 
> socket ref, then 
> > > > > a
> > scaler
> > > > > string
> > > > >
> > > > > A bit later in the same script, I need to take that scaler 
> > > > > string and
> > turn
> > > > it
> > > > > back to a socket ref, and deref it back to the socket handle.
> > > >
> > > > Maybe instead of asking for the way to implement your solution, 
> > > > you
> > should
> > > > describe the complete problem and see if we can come up with an
> > alternate
> > > > solution that is a little less convoluted.  :)
> > >
> > > let me clarify my problem.
> > >
> > > I have a reference of a subroutine.
> > >
> > > eg.
> > >
> > > $sub = "test";
> > >
> > > ..deref and execute
> > >
> > > &$sub;
> > >
> > > ...
> > >
> > > sub test {
> > > my ($sockethandle,$blah...) = @_;
> > > ..do something
> > > }
> > > 
> > >
> > > in order to pass the paramenters, i decided to do this :
> > >
> > > sub main {
> > >
> > > my $sub = "test|$sockethandle";
> > > ($sub,@_) = split(/\|/,$sub);
> > >
> > > $⊂
> > > }
> > >
> > >
> > > if this is to work correctly, I need to take a socket handle, 
> > > convert it
> > to a
> > > socket ref, then a scaler, so i can pass it as a 
> parameter. in order 
> > > to
> > use the
> > > socket later, i have to take the scaler, convert it to the socket 
> > > ref,
> > then
> > > dereference it.
> > >
> > > Is there an easier way to pass parameters with a subroutine 
> > > reference?
> > >
> > >
> > >
> > >
> > >
> > >
> > > ___
> > > 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
> > 
> 
> 
> 
> 
> ___
> 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: references

2005-07-25 Thread John Serink
Why don't you pass the parameters as references.
They work like pointers in C kindof.

Why do you want to reference your subroutine?

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, July 26, 2005 2:19 AM
> To: $Bill Luebkert
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: references 
> 
> 
> hello again,
> 
> > > hello all,
> > > 
> > > here is a ref/deref problem
> > > 
> > > I need to take a socket handle, convert it to a socket 
> ref, then a 
> > > scaler
> > > string 
> > > 
> > > A bit later in the same script, I need to take that scaler string 
> > > and turn
> > it
> > > back to a socket ref, and deref it back to the socket handle.
> > 
> > Maybe instead of asking for the way to implement your solution, you 
> > should describe the complete problem and see if we can come 
> up with an 
> > alternate solution that is a little less convoluted.  :)
> 
> let me clarify my problem.
> 
> I have a reference of a subroutine.
> 
> eg.
> 
> $sub = "test";
> 
> ..deref and execute
> 
> &$sub;
> 
> ...
> 
> sub test {
> my ($sockethandle,$blah...) = @_;
> ..do something
> }
> 
> 
> in order to pass the paramenters, i decided to do this : 
> 
> sub main {
> 
> my $sub = "test|$sockethandle";
> ($sub,@_) = split(/\|/,$sub);
> 
> $⊂
> }
> 
> 
> if this is to work correctly, I need to take a socket handle, 
> convert it to a 
> socket ref, then a scaler, so i can pass it as a parameter. 
> in order to use the 
> socket later, i have to take the scaler, convert it to the 
> socket ref, then 
> dereference it.
> 
> Is there an easier way to pass parameters with a subroutine 
> reference? 
> 
> 
> 
> 
> 
> 
> ___
> 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: comparing floating point numbers

2005-07-24 Thread John Serink
Comparing floating points means to ask whether one number falls within a
RANGE of values.

You have to say it like this:
use strict;
use warnings;

my $bob = 630.239;
my $test = 630.24;
my $range1 = 0.001;
my $range2 = 0.1;

no warnings;
if( ($test <= ($bob+$range1) ) && ($test => ($bob - $range1) ) ){
print("$test is equal to $bob within $range1 \n");
}
if( ($test <= ($bob+$range2) ) && ($test => ($bob - $range2) ) ){
print("$test is equal to $bob within $range2\n");
} else {
print("$test is not equal to $bob within $range2\n");
}
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of John Deighan
> Sent: Monday, July 25, 2005 1:09 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: comparing floating point numbers
> 
> 
> Is there a safe way to compare 2 floating point numbers in Perl? I 
> have 2 numbers, one of which was created by accumulating a series of 
> other numbers into it - the other was entered directly. My debugger 
> says that they're both '630.24', and when I print them, they both 
> print as '630.24'. However, the == test fails and the != test 
> succeeds. I can only think of taking their difference and checking if 
> that's less than something like 0.001. Is there a better way?
> 
> ___
> 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: fork() and ithreads in AS Perl 5.8.6

2005-07-12 Thread John Serink
Hello Angus:

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Angus McIntyre
> Sent: Wednesday, July 13, 2005 6:48 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: fork() and ithreads in AS Perl 5.8.6
> 
> 
> I'm writing a Perl program to run on Windows platforms (Win2K and 
> WinXP). whose job is to manage concurrent downloads using libwww-perl 
> (LWP). The basic model is that a manager process checks continuously 
> against a task list (actually a directory containing task files) and 
> launches a sub-process or thread to handle each download. Because the 
> downloads are expected to run concurrently, the manager doesn't wait 
> for the sub-processes to complete.
Not sure if fork will do it for you on Win32...threads on Win32 also
leak handles if you used any sort of shared hasshes or arrays.

> 
> My first attempt used fork() to launch the sub-processes, and each 
> sub-process would then call exit(0) when complete. However, it 
> appears that exit(0) doesn't release the thread handles: the manager 
> would fork 64 sub-processes successfully, and then die with 'resource 
> temporarily unavailable' on the 65th. Note that this wasn't a case of 
> too many concurrent processes: most of the sub-processes would 
> already have exited, so there were never more than about 20 processes 
> active simultaneously.
Interesting! Similar bug to the threads functionality?

> I then rewrote the code using threads instead. Each thread was 
> created with new() and then immediately detached using detach(). The 
> manager doesn't need to get a result back from the thread.
> 
> This performed even worse: after a random number of thread creations 
> - between about 40 and 60 - Perl would simply exit, and Windows would 
> dump an exception log that indicated thread-related problems. Again, 
> the figure of 40-60 refers not to concurrent threads, but to total 
> threads created.
Leaking handles I'm afraid, the bug has been in bugzilla since...I'm not
sure when I put it in there.

> 
> Has anyone had any experience in writing multi-threaded processes on 
> Windows using libwww-perl? Is it possible to do this stably, or is 
> multi-threading in Windows Perl not yet mature enough? Or, 
> alternatively, am I making some fundamental error in the way I'm 
> going about this?
> 
> Thanks in advance for any suggestions,
I use the perl threading on Win32 as I have to contact 27 remote server
modules ( actually MODBUS devices) every minute and since the socket
timeouts in perl do not work on Win32 nor do non-blocking handles, each
attempt to connect has to be in its own detached thread so that if the
target device isn't there, the thread and can timeout(some wort of
windows default, ~20 seconds or so) and die at its leisure... this works
simple enough.
The problem is, I'm populating some shared hashes with the connection
status of each connection attempt and a shared hash to hold the
retrieved datahere is where the problem occurs. For every thread
launched, perl leaves 2 handles open after that thread dies. I think the
max number of handles any app is allowed to have open is 128,000 or so
but to get around this, I use task scheduler to kill my app every 5
hours and 58 minutes and then restart it every 6 hours(its not running
for 2 minutes in other words). I have to do this till the leaking
handles bug gets fixed. Since final results are stored to a file, the
hack work around works for me.

Cheers,
john
> 
> Angus
> ___
> 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: sending mail in both win32 and UNIX

2005-07-10 Thread John Serink
Or, you could simply open the port 25 to the SMTP server and send the
SMTP commands yourself...
Very easy, just read the SMTP RFC.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Chris Wagner
> Sent: Saturday, July 09, 2005 12:32 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Re: sending mail in both win32 and UNIX
> 
> 
> The way to go is Net::SMTP.  It'll work in any environment on 
> any platform. If u don't know the address of the mail server 
> u should be able to lookup ur domain's MX record.  Even if u 
> only have an Exchange server, u can configure it to accept SMTP mail.
> 
> At 03:45 PM 7/8/05 -0400, Drobnis, Mark wrote:
> >It has been recommend that I use SMTP however I am not able 
> to locate a 
> >SMTP server anywhere on our network. I also have an issue 
> with having 
> >to specify a server name because the server name may change. 
> I looking 
> >to make this code as position independent as possible..
> 
> 
> 
> --
> REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
> "...ne cede males"
> 
> 0100
> 
> ___
> 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


perl 5.8.7, Win32 threaded Handles leak bug, bugzilla 35931

2005-06-27 Thread John Serink
Hi All:

With regards to:
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)

Copyright 1987-2005, Larry Wall

Binary build 813 [148120] provided by ActiveState
http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  6 2005 13:36:37

Please not that bugzilla bug 35931, leaking handles when using shared
hashes or arrays in threaded applications on Win32 has NOT been fixed in
this release.

Cheers,
John

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Using Net::SMTP with Authen:SASL

2005-06-27 Thread John Serink
This works:


use strict;
use warnings;
use Net::SMTP;

my $mailhost = "jim.bob.com";
my $mailobj = "";
if($mailobj = Net::SMTP->new($mailhost, Timeout=>10, Debug=>1)){
print("Connected to $mailhost\n");
} else {
print("Could not connect to $mailhost\n");
die;
}


my $username = "[EMAIL PROTECTED]";
my $password = "abcd123";

$mailobj->auth($username,$password);
my $Rx1 = "[EMAIL PROTECTED]@jim.com";
my $Rx2 = "[EMAIL PROTECTED]";
my $from = "[EMAIL PROTECTED]";
print("The recipients are $Rx1 and $Rx2\n");
$mailobj->mail($from);
$mailobj->recipient($Rx1, $Rx2,{SkipBad=>1});

if($mailobj->data()){
$mailobj->datasend("To:$Rx1\r\n");
$mailobj->datasend("cc:$Rx2\r\n");
$mailobj->datasend("Subject: Email from Perl script using
bob.com with authentication\r\n");
$mailobj->datasend("This is a test message...from Perl using
bob.com!\n :)\nJim\n");
print("Data sent successfully \n");
} else {
print("Send failed\n");
}



$mailobj->quit;


#This worked, with subject, to and cc fields.
#make sure the Auth::SASL module in installed.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of David Ressler
> Sent: Monday, June 27, 2005 10:47 PM
> To: Perl List
> Subject: Using Net::SMTP with Authen:SASL
> 
> 
> I've been advised by my web host that I should use 
> authenticated SMTP instead of sendmail; that is, Net::SMTP 
> using Authen::SASL. I'm getting no further guidance, so I've 
> tried variations on the following with no success:
> 
> use lib $SCRIPTS_DIR.'Authen'; #Contains Authen::SASL (not 
> loaded by host) use Net::SMTP; $smtp = 
> Net::SMTP->new('mymailserver.com',Debug=>1);
> $smtp->auth('myaccount','mypassword');
> $smtp->mail('[EMAIL PROTECTED]'); 
> $smtp->to('[EMAIL PROTECTED]');
> $smtp->data();
> $smtp->datasend("To: [EMAIL PROTECTED]");
> $smtp->datasend("From: [EMAIL PROTECTED]");
> $smtp->datasend("Subject: Authenticated test message\n"); 
> $smtp->datasend("\n"); $smtp->datasend("A simple test 
> message\n"); $smtp->dataend(); $smtp->quit; print "Done"; exit;
> 
> Is this a reasonable approach, with perhaps some crucial 
> detail overlooked? Or does using Authen::SASL with Net::SMTP 
> require a different approach?
> 
> 
> ___
> 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: 64 Bit ActivePerl

2005-06-15 Thread John Serink
Hi Paul:

If you'll notice, this is a Win32 group. That is perl, on a Win32
platform, not perl on a Win64 platform. If you want the latter, you'll
likely have to compile from source.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Wednesday, June 15, 2005 7:47 PM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: FW: 64 Bit ActivePerl
> 
> 
> Anybody from ActiveState listening? Is there a better place 
> to send this?
> 
> Cheers,
> Paul
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: 10 June 2005 17:11
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: 64 Bit ActivePerl
> 
> Hi All,
> 
> We've just taken delivery of our first AMD Opteron boxes, and 
> after installing Windows 2003 64 bit, I note that the WSH 
> hooks in ActivePerl don't seem to work with it. Does anybody 
> know if this will be fixed soon, or even if there are plans 
> to release a full 64 bit version of ActivePerl?
> 
> Cheers,
> Paul
> 
> *
> Gloucester Research Limited believes the information 
> provided herein is reliable. While every care has been 
> taken to ensure accuracy, the information is furnished 
> to the recipients with no warranty as to the completeness 
> and accuracy of its contents and on condition that any 
> errors or omissions shall not be made the basis for any 
> claim, demand or cause for action.
> *
> 
> 
> ___
> 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: Net::Telnet

2005-06-02 Thread John Serink
I have heard the MS Telnet server was fixed on XP (and that would seem
then on 2003) but have not tested it. I know Net::Telnet did NOT work on
Win2K pro, I wasted about a week trying to get it to. Worked fine on NT
4.0 though.

Cheers,
John

> -Original Message-
> From: Aaron.Tesch [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 02, 2005 9:22 PM
> To: Thomas, Mark - BLS CTR; John Serink; Rajesh Vattem; 
> perl-win32-users@listserv.ActiveState.com
> Subject: RE: Net::Telnet
> 
> 
> I have had no issues using Net::Telnet on XP Pro that are 
> using the MS Windows telnet server.
> 
> Stating that "it does not work" on Windows 
> server/workstations is not entirely true.  
> 
> Try starting the MS Windows telnet server, and using it.  
> 
> 
> 
> - Aaron
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Thomas, Mark - BLS CTR
> Sent: Thursday, June 02, 2005 7:35 AM
> To: 'John Serink'; Rajesh Vattem; 
> perl-win32-users@listserv.ActiveState.com
> Subject: RE: Net::Telnet
> 
> John wrote:
> > its does not work on these servers:
> > Windows 2000 Pro,
> > Windows XP pro,
> > Windows 2000 server pro,
> > Windows server 2003.
> > 
> > Reason is, the new windows server uses ANSI codes and you 
> CAN'T turn 
> > them off like on a UNIX box. These ANSI codes garble up the 
> responses 
> > to Net::Telnet.
> 
> I'd put it this way: The telnet server in these versions of 
> Windows is broken. It doesn't follow the RFCs. To make telnet 
> work, use an alternate telnet server, e.g. 
> http://kpym.sourceforge.net/
> 
> -- 
> Mark
> 
> ___
> 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: Net::Telnet

2005-06-02 Thread John Serink
Correct.

> -Original Message-
> From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 02, 2005 8:35 PM
> To: John Serink; Rajesh Vattem; 
> perl-win32-users@listserv.ActiveState.com
> Subject: RE: Net::Telnet
> 
> 
> John wrote:
> > its does not work on these servers:
> > Windows 2000 Pro,
> > Windows XP pro,
> > Windows 2000 server pro,
> > Windows server 2003.
> > 
> > Reason is, the new windows server uses ANSI codes and you 
> CAN'T turn 
> > them off like on a UNIX box. These ANSI codes garble up the 
> responses 
> > to Net::Telnet.
> 
> I'd put it this way: The telnet server in these versions of 
> Windows is broken. It doesn't follow the RFCs. To make telnet 
> work, use an alternate telnet server, e.g. 
> http://kpym.sourceforge.net/
> 
> -- 
> Mark
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :Telnet

2005-06-01 Thread John Serink
What kind of "particular" host are telnetting into?
The Net::Telnet module works connecting to the following telnet servers:
WindowsNT 4.0,
Cisco Routers,
Most of the Unix varients.

its does not work on these servers:
Windows 2000 Pro,
Windows XP pro,
Windows 2000 server pro,
Windows server 2003.

Reason is, the new windows server uses ANSI codes and you CAN'T turn
them off like on a UNIX box. These ANSI codes garble up the responses to
Net::Telnet.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Rajesh Vattem
> Sent: Wednesday, June 01, 2005 9:37 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Net::Telnet
> 
> 
> 
> Hi,
>  I am using this module (Net::Telnet) downloaded from CPAN, 
> for a small interactive program in which I telnet to a 
> particular host, login and give some commands (based on the 
> options you get). I am not able to do this. I am able to 
> login but whatever I do after that doesn't seem to happen. 
> Can someone suggest what might be going wrong!!!
> 
> After login, the control console shows
> 
> --- Control Console
> ---
> 
>  1- Device Manager
>  2- Network
>  3- System
>  4- Logout
> 
>  - Main Menu, - Refresh, - Event Log
> >
> 
> Please let me know your inputs.
>   <> 
> Thanks & Regards,
> Rajesh.
> 
> 
> 
> **
> The information contained in this email and any attachments
> is likely to be confidential and legally privileged, and is 
> for the intended recipient named above only. Any copying, 
> dissemination, disclosure of or use of this email or its 
> attachments unless authorised by us is prohibited, except 
> that you may forward this email and/or attachments to a third 
> party on a strict "need to know" basis. 
> 
> If you have received this email in error, please notify us 
> immediately by replying to the email or by calling 
> +91-80-22297030. Please then delete this email and any full
> or partial copies of it.
> 
> You as the intended recipient must be aware and accept 
> that emailis not a totally secure communications medium.
> 
> Although we have taken all reasonable steps to make 
> sure this email and any attachments are free from viruses, 
> we do not (to the extent permitted by law) accept any liability 
> whatsoever for any virus infection and/or compromise of 
> security caused by this email and any attachment.
> 
> No contract may be formed or documents served by you 
> on or with us by this email or any attachments unless 
> expressly agreed otherwise by us. 
> 
> Any views expressed in this email or attachments by 
> an individual are not necessarily those of UbiNetics 
> India (Private) Limited.
> 
> **
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Measure bandwidth

2005-05-24 Thread John Serink
Title: Message



Why not use SNMP from your routers?

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Eric LogesonSent: Tuesday, May 24, 2005 11:28 PMTo: 
  perl-win32-users@listserv.ActiveState.comSubject: Measure 
  bandwidth
  Hello List
   
  I wanted to get some basic bandwidth statistics across a WAN link.  
  The approach I think I am going to take is the following:
  Use a perl scipt to read in a bunch of files, determine the sizes, 
  start a timer (not sure how to do this yet), copy the files across the link 
  (winxp->win2003 server), stop the timer,
  and finally write out the bytes/sec metric to a log file.  I 
  planned on scheduling the perl script to run every hour or so for a 
week.
   
  Are there modules of interest for this project.  Any suggestions on 
  the approach?
   
   
  Thanks
  Eric
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Tk::ExecuteCommand on perl5.8

2005-05-13 Thread John Serink
I think I read that file events don't work with WIn32 Perl/Tk.

:)
JOhn

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sisyphus
> Sent: Friday, May 13, 2005 6:00 PM
> To: Igor Litmanovich; perl-win32-users
> Subject: Re: Tk::ExecuteCommand on perl5.8
> 
> 
> 
> - Original Message - 
> From: "Sisyphus" <[EMAIL PROTECTED]>
> 
> >
> > - Original Message -
> > From: "Igor Litmanovich" <[EMAIL PROTECTED]>
> 
> 
> > >
> > > I'm trying to run a non-blocking command with Tk::ExecuteCommand
> > > on perl5.8 but do not get any output in tk window, although the
> > > command is executed.
> 
> > The problem seems to be associated with the following line 
> of code from
> the
> > execute_command() subroutine:
> >
> > $self->{-pid} = open $h, $self->{-command} . ' 2>&1 |';
> >
> 
> That's a little off the mark ... I subsequently found that 
> _read_stdout()
> never got called with perl 5.8, whereas it did get called 
> with perl 5.6. I
> was able to get _read_stdout() called by changing (in 
> execute_command):
> 
> $self->fileevent($h, 'readable' => [\&_read_stdout, $self]);
> 
> to:
> 
> $self->fileevent($h, 'readable' => [\&_read_stdout($self)]);
> 
> But that still doesn't work properly with Loop.pl and is 
> apparently the
> wrong approach to a solution. You see the ">> 1\n", and the 
> process then
> just hangs. (The "\n" appears as a square box.) Even with a 
> script that
> doesn't loop, the fact that the script has finished doesn't 
> register with
> the Tk app, and the 'Cancel' button keeps flashing.
> 
> On the other hand, that change is unacceptable to perl 5.6 - 
> it produces the
> error "Not a CODE reference ...", and, as far as I can tell, 
> should lead to
> the exact same error with perl 5.8, but for some reason doesn't.
> 
> None of this rings any bells with me regarding changes 
> between 5.6 and 5.8
> on Win32 but apparently something has changed that is 
> relevant to this
> the solution is probably quite simple but it still eludes me. 
> I think my
> main problem is that I don't understand what "$self->fileevent($h,
> 'readable' => [\&_read_stdout, $self]);" actually does (or is 
> supposed to
> do) - and I can't find any examples or documentation that 
> helps. I also
> can't find anything about how to pass argument lists where 
> references to
> subroutines are involved - yet _read_stdout() definitely 
> expects (and gets)
> at least one argument.
> 
> Cheers,
> Rob
> 
> 
> 
> 
> ___
> 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: perl56 to 58...delay on line prints

2005-04-25 Thread John Serink
Turn on autoflushing to STDIO.
Will fix it.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Rogers
> Sent: Sunday, April 24, 2005 6:04 AM
> To: Perl-Win32-Users
> Subject: perl56 to 58...delay on line prints
> 
> 
> I just upgraded to 5.8.  One thing I noticed is that it 
> treats line prints 
> differently.  For example:
> 
> while ($x < 10) {
>  for ($y=1;$y<11;$y++) {
>   print ".";
>   sleep 1;
>  }
>  print "\n"
>  $x++;
> }
> 
> This prints a line of ".." once every 10 seconds.  In 
> 5.6 and prior 
> it would print a "." every second.
> 
> I'm guessing there's an easy way to change this behaviour.  Any hints?
> 
> Thx!
> Paul ---
> 
> 
> ___
> 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: RE: Thread programming en Perl 5.8.4

2005-04-06 Thread John Serink
Your build is multi thread supported, go nuts!

Read the docs that came with active perl, the threading modules are DIFFERENT 
than the old 5.6 ones. The 5.6 modules are still there but have been 
depreciated. There is a good tutorial in the docs.

Cheers,
john

> -Original Message-
> From: Marcos Legido [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 07, 2005 4:17 AM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: RE: Thread programming en Perl 5.8.4
> 
> 
> Hi:
> 
> Ok, the output is:
> 
> This is perl, v5.8.4 built for MSWin32-x86-multi-thread
> (with 3 registered patches, see perl -V for more detail)
> 
> Copyright 1987-2004, Larry Wall
> 
> Binary build 810 provided by ActiveState Corp. 
> http://www.ActiveState.com ActiveState is a division of 
> Sophos. Built Jun  1 2004 11:52:21
> 
> Perl may be copied only under the terms of either the 
> Artistic License or the GNU General Public License, which may 
> be found in the Perl 5 source kit.
> 
> Complete documentation for Perl, including FAQ lists, should 
> be found on this system using `man perl' or `perldoc perl'.  
> If you have access to the Internet, point your browser at 
> http://www.perl.com/, the Perl Home Page.
> 
> Thanks.
> 
> At Thu, 7 Apr 2005 05:29:05 +1200, you wrote:
> >
> >What does te output of "perl -v" say?
> >Here is mine:
> >C:\>perl -v
> >
> >This is perl, v5.8.6 built for MSWin32-x86-multi-thread
> >(with 3 registered patches, see perl -V for more detail)
> >
> >Copyright 1987-2004, Larry Wall
> >
> >Binary build 811 provided by ActiveState Corp. 
> >http://www.ActiveState.com ActiveState is a division of 
> Sophos. Built 
> >Dec 13 2004 09:52:01
> >
> >Perl may be copied only under the terms of either the 
> Artistic License 
> >or the GNU General Public License, which may be found in the Perl 5 
> >source kit.
> >
> >Complete documentation for Perl, including FAQ lists, should 
> be found 
> >on this system using `man perl' or `perldoc perl'.  If you 
> have access 
> >to the Internet, point your browser at http://www.perl.org/, 
> the Perl 
> >Home Page.
> >
> >> -Original Message-
> >> From: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] On 
> >> Behalf Of Marcos Legido
> >> Sent: Thursday, April 07, 2005 1:13 AM
> >> To: perl-win32-users@listserv.ActiveState.com
> >> Subject: Thread programming en Perl 5.8.4
> >> 
> >> 
> >> Hello:
> >> 
> >> I have a great problem... I need to use threads for check a
> >> variable in my application, but I can't run threads nor the 
> >> Thread module in Perl 5.8.4. I have looked for great amount 
> >> of information (including this mailling list), and web pages 
> >> and documentation, of course, but there is no form to make 
> >> work them. I use ActivePerl 5.8.4 MSWin32-x86-multi-thread, 
> >> but if I write a script with this line:
> >> 
> >> $Config{useithreads} or die "Recompile Perl with threads to
> >> run this program.";
> >> 
> >> it fails. This has sense?
> >> 
> >> Thanks in advance. I hope that you prune to help me...
> >> 
> >> - Marcos Legido.
> >>   [EMAIL PROTECTED]
> >>   Programación de software y administración de sistemas.
> >> 
> >> 
> >> ___
> >> Perl-Win32-Users mailing list
> >> Perl-Win32-Users@listserv.ActiveState.com
> >> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >> 
> 
> 
> - Marcos Legido.
>   [EMAIL PROTECTED]
>   Programación de software y administración de sistemas.
> 
> 
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Thread programming en Perl 5.8.4

2005-04-06 Thread John Serink
What does te output of "perl -v" say?
Here is mine:
C:\>perl -v

This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Dec 13 2004 09:52:01

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marcos Legido
> Sent: Thursday, April 07, 2005 1:13 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Thread programming en Perl 5.8.4
> 
> 
> Hello:
> 
> I have a great problem... I need to use threads for check a 
> variable in my application, but I can't run threads nor the 
> Thread module in Perl 5.8.4. I have looked for great amount 
> of information (including this mailling list), and web pages 
> and documentation, of course, but there is no form to make 
> work them. I use ActivePerl 5.8.4 MSWin32-x86-multi-thread, 
> but if I write a script with this line:
> 
> $Config{useithreads} or die "Recompile Perl with threads to 
> run this program.";
> 
> it fails. This has sense?
> 
> Thanks in advance. I hope that you prune to help me...
> 
> - Marcos Legido.
>   [EMAIL PROTECTED]
>   Programación de software y administración de sistemas.
> 
> 
> ___
> 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: Win32:Registry

2005-04-04 Thread John Serink
Move to TieRegistry, Win32:;Registry is no longer supported.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jim Hansen
> Sent: Tuesday, April 05, 2005 3:23 AM
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Win32:Registry
> 
> 
> Is there a way to travere through a registry key
> without have to move to TieRegistry?
> 
> For example:
> 
> HKCU\Software\Activestate\General
> 
> Has several items to list, mostly DWORD values.
> 
> Can I use Win32::Registry to traverse through these
> values?
> 
> Thanks...
> 
> 
> 
> 
>   
> __ 
> Yahoo! Messenger 
> Show us what our next emoticon should look like. Join the fun. 
> http://www.advision.webevents.yahoo.com/emoticontest
> ___
> 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: ithreads

2005-03-31 Thread John Serink
If you're accessing the registry on remote PCs, you're using NetBios
over TCP/IP, commonly referred to Microsoft Networking. I have no idea
what NetBios default timeouts are. For TCP the connection timeout is 20
seconds on a Windoze box, user setable on Linux. You may be able to set
the SMB timeouts but I think it gets a bit complicated with the way SMB
browsing works

If you could timeout the thread, that would be great; however, that is
not yet supported.
Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alan Peck
> Sent: Thursday, March 31, 2005 1:04 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: RE: ithreads
> 
> 
> Thanx for you advise.
> 
> I am accessing the Registry of the remote PCs, and if 
> something goes weird on the client PC the script ends up 
> waiting for the timeout to occur. If there is a way to change 
> the timeout for connecting to the remote PC Registry that 
> would be simply wonderful. 10 secs is plenty enough time to 
> realize something is wrong on a 1 Gbit network.
> 
> I managed to decrease the load a wee bit by running the 
> script from 4 servers instead of 1 and dividing the PC load 
> between the 4 servers according to LAN segments.
> 
> Alun
> 
> >>> "John Serink" <[EMAIL PROTECTED]> 03/30/05 5:24 PM >>>
> Hiyah:
> 
> Ok, the thing you'll NOT want to do is spawn the threads all 
> at once. I'd do them say, in groups of 25 or so which will 
> allow the ones that finish, out of the 25, to complete and 
> die thus freeing up memory for your other 2975. SO, in pseudo 
> code, do this: spawn threads 0-24, do stuff, sleep for 0.01 
> seconds (free up the CPU), Go back to the top until you're done.
> 
> Worst case is that the threads that can't find their server 
> will timeout and die after 20 secondswhich is why on 
> Win32 you need to sue threads for TCP apps, the timeouts for 
> connecting to sockets don't work in perl. The basic trick is, 
> don't spawn the lot in one go, dribble them out.
> 
> Cheers,
> John
> 
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of Alan Peck
> > Sent: Wednesday, March 30, 2005 5:12 PM
> > To: perl-win32-users@listserv.ActiveState.com
> > Subject: ithreads
> > 
> > 
> > In order to resolve a networking problem in a timely manner I
> > required to make use of threads (particular the ithreads 
> > implimentation).
> > 
> > The only problem is that the memory usage rockets as each
> > thread starts it's own perl interpreter. I need roughly 3000 
> > connection threads to be able to obtain the required 
> > information within 2 mins. If I use a single thread the time 
> > can take between 0 mins to 3000 mins to complete, depending 
> > on how many response timeouts one obtains. I have been able 
> > to create 150 thread connections before running out of RAM. 
> > Keeping within the RAM limit, I am able to retrieve the 
> > information from 150 PCs within 2 mins, making use of a real 
> > bad situation setup where at least half will timeout delibrately.
> > 
> > Is there a way to instruct perl to only load one copy of the
> > perl code into RAM and create separate data segments with 
> > their own instruction pointers for each thread?
> > 
> > Thanx
> > --
> > Tshwane University of Technology
> > --
> > This email is sent and received in terms of the
> > Electronic Communications Policy of Tshwane University of 
> > Technology. In line with this policy, this email is private, 
> > priviledged and confidential. The full text of the Electronic 
> > Mail Disclaimer can be seen on the TUT web site at 
> > http://www.tut.ac.za/goto/emaildisclaimer
> > or obtained by phoning (012) 318-5911
> > <<<>>>
> > 
> > ___
> > 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
> 
> 
> ___
> 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: Socket + fork

2005-03-31 Thread John Serink
I don't think signals are suported on Win32 boxes.
Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of David Liouville
> Sent: Thursday, March 31, 2005 12:00 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Socket + fork
> 
> 
> Could anybody tell me wy my server is closed at the #65 query 
> from client ? (I fork the server socket for futur use of many 
> clients) The parent process of the server seems to be closed 
> at the #65 execution of the ping query, but I don't 
> understand wy ... Thanks for help.
> 
> ### Server ###
> 
> use IO::Socket;
> 
> $server = IO::Socket::INET->new(
>   Proto => 'tcp',
>   LocalPort => "9000",
>   Listen=> 10,
>   Reuse => 1
> ) or die "can't setup server";
> 
> while ($client = $server->accept())
> {
>   $SIG{CHLD} = 'IGNORE';
>   my $child = fork;
>   do { close $client; next; } if $child;
>   $client->autoflush(1);
> 
>   while (<$client>)
>   {
>   $IntMatchCmd = 0;
>   chomp();
> 
>   if (m/ping/)
>   {
>   $IntMatchCmd = 1;
>   $client->send("pong\n",'');
>   }
>   else
>   {
>   print "unknown cmd";
>   }
> 
>   close $client;
>   print "close pid : '$child'\n";
>   exit;
>   }
> }
> 
> 
> ## Client ##
> use IO::Socket;
> 
> $IntCpt = 1;
> 
> while (1)
> {
>   print "#$IntCpt\n";
>   if ($TO_SERVER = IO::Socket::INET->new(
>   Proto => "tcp",
>   PeerAddr => "127.0.0.1",
>   PeerPort => "9000",
>   Type  => SOCK_STREAM,
>   Reuse => 1
>   ))
>   {
>   $IntCpt++;
>   $TO_SERVER->send("ping\n",'');
> 
>   while (<$TO_SERVER>)
>   {
>   chomp();
>   $StrResponse = $_;
>   print "Response : '$StrResponse'\n";
>   }
>   }
>   else
>   {
>   print "Error\n";
>   }
> } 
> 
> 
> 
>   OlixDavid Liouville
> ADR  : 1bis rue St Louis 35000 Rennes
> GSM : 06 88 70 16 45
> TEL   : 02 99 79 04 78
> FAX  : 02 99 79 78 17
> WEB : http://www.olix.fr 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.4 - Release Date: 27/03/2005
>  
> 
> 
> ___
> 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: ithreads

2005-03-30 Thread John Serink
Hiyah:

Ok, the thing you'll NOT want to do is spawn the threads all at once.
I'd do them say, in groups of 25 or so which will allow the ones that
finish, out of the 25, to complete and die thus freeing up memory for
your other 2975. SO, in pseudo code, do this:
spawn threads 0-24,
do stuff,
sleep for 0.01 seconds (free up the CPU),
Go back to the top until you're done.

Worst case is that the threads that can't find their server will timeout
and die after 20 secondswhich is why on Win32 you need to sue
threads for TCP apps, the timeouts for connecting to sockets don't work
in perl. The basic trick is, don't spawn the lot in one go, dribble them
out.

Cheers,
John


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alan Peck
> Sent: Wednesday, March 30, 2005 5:12 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: ithreads
> 
> 
> In order to resolve a networking problem in a timely manner I 
> required to make use of threads (particular the ithreads 
> implimentation).
> 
> The only problem is that the memory usage rockets as each 
> thread starts it's own perl interpreter. I need roughly 3000 
> connection threads to be able to obtain the required 
> information within 2 mins. If I use a single thread the time 
> can take between 0 mins to 3000 mins to complete, depending 
> on how many response timeouts one obtains. I have been able 
> to create 150 thread connections before running out of RAM. 
> Keeping within the RAM limit, I am able to retrieve the 
> information from 150 PCs within 2 mins, making use of a real 
> bad situation setup where at least half will timeout delibrately.
> 
> Is there a way to instruct perl to only load one copy of the 
> perl code into RAM and create separate data segments with 
> their own instruction pointers for each thread?
> 
> Thanx
> --
> Tshwane University of Technology
> --
> This email is sent and received in terms of the 
> Electronic Communications Policy of Tshwane University of 
> Technology. In line with this policy, this email is private, 
> priviledged and confidential. The full text of the Electronic 
> Mail Disclaimer can be seen on the TUT web site at 
> http://www.tut.ac.za/goto/emaildisclaimer
> or obtained by phoning (012) 318-5911
> <<<>>>
> 
> ___
> 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: Mapping Drive

2005-03-25 Thread John Serink
Why not just use the UNC file name?

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Wong, Danny H.
> Sent: Friday, March 25, 2005 3:44 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Mapping Drive
> Importance: High
> 
> 
> Hi All,
>   I was wondering if anyone know of a perl module that 
> let's me map to a network path. 
> Example: g:\ = \\wongd01\blds
> 
> I could use the "net" command provided by windows, but I want 
> to write pure perl code. No outside commands using system() 
> function. Also, I need the drive to be persistent meaning 
> when my machine restarts the drive "g:\" is still mapped. 
> Please provide example if possible. Thanks!
> 
> Thanks 
> Danny Wong 
> SCM Engineer 
> PowerTV Inc., 
> 
> 
> 
> - - - - - - - Appended by PowerTV, A division of Scientific 
> Atlanta. - - - - - - - 
> This e-mail and any attachments may contain information that 
> is confidential, proprietary, privileged or otherwise 
> protected by law. The information is solely intended for the 
> named addressee (or a person responsible for delivering it to 
> the addressee). If you are not the intended recipient of this 
> message, you are not authorized to read, print, retain, copy 
> or disseminate this message or any part of it. If you have 
> received this e-mail in error, please notify the sender 
> immediately by return e-mail and delete it from your computer.
> 
> ___
> 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 an Access Database

2005-03-23 Thread John Serink
Title: Message



Use the Win32::ODBC module.

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Leigh SharpeSent: Wednesday, March 23, 2005 6:56 
  AMTo: perl-win32-users@listserv.ActiveState.comSubject: 
  Reading an Access Database
  Hi All,
   Does anybody know of a way to read data 
  from an Access database? All I need is read access, as I want to extract some 
  data and present from a Perl script.
  Any Ideas?
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: ppm and proxies

2005-03-23 Thread John Serink
PPM, Proxies and Firewalls

If you use a proxy server or firewall, you might have trouble running
PPM. Here is the solution.

NOTE: If none of the changes in this document work for you, you may
download individual packages from here [ActivePerl 801 and later] or
here [ActivePerl 613 and later] or here [ActivePerl 522 and earlier] and
install them according to the directions in the README file contained
within the ZIP file. If you want, you can also keep a local repository,
with several .ppd files in a permanent repository directory, and their
.tar.gz files in an x86 directory beneath that.

   1.
  Set Environment Vars

Up to three environment variables need to be set.

Under Windows 2000
Right click on "My Computer", click on "Properties" and select the
"Advanced" tab. Click the button marked "Environment Variables" and make
the following changes in the "System Variables" window:

   1. With the "New" button, add the setting HTTP_proxy, with your
proxy name as the value (you must include "http://";), followed by a
colon and the proxy port, if applicable; e.g., "http://proxy:8080/";
   2. If you require a user name and/or password to access your
proxy, use the "New" button to add the settings HTTP_proxy_user and
HTTP_proxy_pass, with your user name and password as the respective
values.

Under Windows NT
Right click on "My Computer", click on "Properties", select the
"Environment" tab. These are your environment settings. Make the
following changes:

   1. Add the setting HTTP_proxy, with your proxy name as the value
(you must include "http://";), followed by a colon and the proxy port, if
applicable; e.g., "http://proxy:8080/";
   2. If you require a user name and/or password to access your
proxy, add the settings HTTP_proxy_user and HTTP_proxy_pass, with your
user name and password as the respective values.

Under Windows 9x
In your AUTOEXEC.BAT file, place the following lines then reboot so
the changes can take effect:

   1. SET HTTP_proxy=http://";,
followed by a colon and the proxy port, if applicable; e.g., SET
HTTP_proxy=http://proxy:8080/
   2. SET HTTP_proxy_user= (if required)
   3. SET HTTP_proxy_pass= (if required)

   2.
  Try using PPM

With your internet connection active, try using PPM again. Try to
install a small package, like File-Slurp. You'll know that it still
fails if you see an error stating that it can't find a ppd file for the
specified package.

   3.
  Further Information and Help

If there were problems with any of the above hints, please see
Troubleshooting for information regarding further help.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Arnold Wiegert
> Sent: Wednesday, March 23, 2005 6:05 AM
> To: Perl-Win32
> Subject: ppm and proxies
> 
> 
> 
> Any one have any details or Howtos on setting up a 'proxy' 
> for use with ppm.
> 
> Me and my Activestate Perl (running under WinME) live behind 
> a Dachstein 
> LEAF/LRP firewall and 'we' have been having troubles setting 
> up some of 
> the packages by downloading the files from ActiveState to a local 
> repository and installing from there.
> 
> I've also had a lot of help in trying to install some troublesome 
> modules manually, but things are still not working as well as 
> they should.
> 
> As a result I would like to investigate using a proxy, but I 
> have next 
> to no clue as to where to find one and/or how to go about 
> getting/setting up/using it.
> 
> My main assumption is that this proxy lives on my firewall and I am 
> asking in the appropriate group for more details.
> 
> Is this a good assumption, and if not, what part is wrong and 
> in which 
> way,  where can I find out more?
> 
> Activestate simply says a proxy is one way to install 
> packages when one 
> is behind a firewall, but I've not found much in the way of 
> details and 
> specifics for setting it up.
> 
> Any help is greatly appreciated.
> 
> TIA,
> Arnold
> 
> 
> ___
> 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: :Telnet and Windows Telnet Server --- any alternatives?

2005-03-17 Thread John Serink
Th old WindowsNT telnet server works fine, the Win2K and XP servers do
not.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jim Guion
> Sent: Friday, March 18, 2005 4:31 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Net::Telnet and Windows Telnet Server --- any alternatives?
> 
> 
> Hi Folks,
> 
> The Net::Telnet doc explains why the Windows Telnet Server 
> will not work with that module (sends ANSI cursor positioning 
> codes, etc. instead of simple ASCII) and mentions that 
> alternative Telnet servers exist, but does not name them.  
> Apparently, many of them do the same thing as the Windows 
> Telnet server unless they allow you to disable 'console mode' 
> according to the Net::Telnet doc.
> 
> So far, all the Telnet servers I have tried exhibit the bad 
> behavior and don't have a way to turn off 'console mode'.
> 
> Does anyone know of a freeware/shareware/open source Telnet 
> server that works with the Net::Telnet module?
> 
> Thanks!
> 
> Jim Guion
> Sr. Quality Assurance Engineer
> Bluesocket, Inc.
> 
> ___
> 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: (no subject)

2005-03-04 Thread John Serink
It doesn't cause any problem
But you 'may' want to wait till your threads are done
You can either detach or join to do so.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sergey Cherniyenko
> Sent: Friday, March 04, 2005 3:36 PM
> To: perl-win32-users
> Subject: (no subject)
> 
> 
> Hello, perl-win32-users,
> 
>   I'm now playing with ithreads in perl 5.8.6 b811. When I terminate
>   main thread I see on stdout warning "A thread exited while 2 threads
>   were running". It described in docs for "use threads" pragma.
>   The question is: Will main thread terminating when other 
> threads exist
>   cause some kinds of memory leaks or it is safe?
> 
>   I found nothing about it in docs
> 
> -- 
> Thanks,
>  Sergey  mailto:[EMAIL PROTECTED]
> 
> 
> ___
> 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: Change network interface parameters via Perl

2005-02-28 Thread John Serink
You could just use netsh.



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Paul Sobey
> Sent: Monday, February 28, 2005 7:18 PM
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: RE: Change network interface parameters via Perl
> 
> 
> Assuming you are on NT/Win2K/XP/2003 You could try WMI... 
> This is hacked together from my build system and untested but 
> it should give you the general idea. Some references here: 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/wmisdk/
> wmi/win32_networkadaptersetting.asp
> 
> Paul
> 
> 
> use Win32::OLE
> 
> my $x = 
> Win32::OLE->GetObject("WinMgmts://$ENV{COMPUTERNAME}/root/cimv2");
> my $y = $x->ExecQuery(qq(SELECT * FROM Win32_NetworkAdapter 
> WHERE AdapterType = "Ethernet 802.3"));
> 
> my $NewIP   = "192.168.0.1";
> my $NewMask = "255.255.255.0";
> my $NewGateway  = "192.168.0.254";
> my $NewDNS  = [ ("192.168.0.10","192.168.0.50" ];
> 
>  foreach my $adapter (in $y) {
>   my $settings = 
> $adapter->Associators_(undef,"Win32_NetworkAdapterConfiguration");
>   for my $setting (in $settings) {
>   next unless $setting->{IPEnabled} == 1;
>   # We only get to here if the adapter is 
> ethernet and ip enabled
>   my $IPAddress = $setting->{IPAddress}->[0];
>   my $Mask  = $setting->{IPSubnet}->[0];
>   my $Gateway   = $setting->{DefaultIPGateway}->[0];
>   my $DHCPState = $setting->{DHCPEnabled};
>   my $AdapterIndex = $adapter->{Index};
>   my $AdapterName = $adapter->{Description};
>   
>   print "\t\tOld ip details for adapter $ApapterIndex
> ($AdapterName): IP - $IPAddress DHCP - $DHCPState\n";
>   
>   my $result = $setting->EnableStatic([ $NewIP ], [
> $NewMask ]);
>   print "\t\tSet ip to $NewIP (result $result)\n";
>   
>   my $result = $setting->SetGateways([ $NewGateway ], [ 1
> ]);
>   print "\t\tSet gateway to $NewGateway (result
> $result)\n";
>   
>   my $result = $setting->SetDNSServerSearchOrder($NewDNS);
>   print "Set DNS servers to " . join(",",@$NewDNS) .
> "(result $result)\n";
>   
>   exit;
>   }
> }
> 
> -Original Message-
> 
> *
> Gloucester Research Limited believes the information 
> provided herein is reliable. While every care has been 
> taken to ensure accuracy, the information is furnished 
> to the recipients with no warranty as to the completeness 
> and accuracy of its contents and on condition that any 
> errors or omissions shall not be made the basis for any 
> claim, demand or cause for action.
> *
> 
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marcos Lorenzo de Santiago
> Sent: 28 February 2005 09:59
> To: Perl-Win32-Admin
> Cc: Perl-Win32-Users
> Subject: Change network interface parameters via Perl
> 
> I need to change the network interface parameters (ie: IP, 
> Gateway, Mask,
> DHCP...) via Perl, is there any module I could use? and/or 
> documentation on it? I've been trying to use netsh command 
> from Windows XP and parsing its output but I guess there 
> might be another prettier way to do this.
> 
> 
> TIA.
> Regards,
> m4c.
> 
> -- 
> ,-
> -.
> | Mathematics is the only science where one never knows what  
>  |
> | one is talking about nor whether what is said is true.  
>  |
> | -- Russell  
>  |
> |-
> -|
> | Labs. Technician  | 
>  |
> | Department of Telematic Engineering   | Debian 
> GNU/Linux Powered |
> | Universidad Carlos III de Madrid  | 
>  |
> |---|
> .--.  |
> |   |   
> |o_o | |
> |  _|  .''`.
> |:_/ | |
> | |~~  @| Marcos Lorenzo de Santiago| : :' :   // 
>   \ \|
> | |     | E-mail:  [EMAIL PROTECTED]| `. `'   (|  
>| )   |
> | |     | Telephone: (+34) 91-624-9959  |   `-   /'\_ 
>   _/`\   |
> | |_| Web: www.it.uc3m.es/marcos|
> \___)=(___/   |
> |   | 
>  |
> `-
> -'
> 
> 
> ___
> Perl-Win32-Users mailing list 
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.Act

RE: How to call a perl code in Windows from Unix

2005-02-28 Thread John Serink
Title: Message



net::telnet

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Maxmelbin Neson (RBIN/EDM3)Sent: Monday, February 28, 2005 4:47 
  PMTo: [EMAIL PROTECTED]; 
  perl-win32-users@listserv.ActiveState.comSubject: How to call a 
  perl code in Windows from Unix
  Hi , 
  Here is the situation … 
  I need to run Script A in Unix , It will generate 
  few parameters that should be passed to Script B . The Script A will call 
  Script B ..
  Script B will be on a Windows Server . Its input 
  parameter is the data passed by Script A … IT SHOULD RUN IN WINDOWS and not in 
  a shell on Unix …
  After Script B completes execution , it should 
  return Success / Failure or any other information back to Script A … 
  
  Is this possible , if so cld u please give me some 
  ideas .. 
  Thanks and Regards Maxmelbin Neson 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Threads + Memory Leak??

2005-02-21 Thread John Serink
Title: Message



1,000,000? No kidding, I always stopped by app in the 100,000 range. I 
didn't think it would survive past 256,000. Your machine must have really be 
crawling along with a million handles open, must have been consuming gobs of 
memory.
 
Hopefully Jena will have time to deal with this one.
 
My work around is to not hold anything in the app's memory, write 
everything to disk and run my app in 6 hour chucks under the watchful eye of 
task scheduler. That way the handles get set back to zero when the app is 
killed, my app gets to ~60,000 handles after 6 hours. You may have to do a tiny 
bit of rewriting to get a work around like that to go.
 
Cheers,
John

  
  -Original Message-From: Paul Sobey 
  [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 9:10 
  PMTo: John Serink; perl-win32-usersSubject: RE: Threads 
  + Memory Leak??
  Blimey, I stopped counting at 
  1,000,000!
   
  Will check that bug report you 
mailed.
   
  Paul
   
  
  
  From: John Serink 
  [mailto:[EMAIL PROTECTED] Sent: 21 February 2005 
  12:03To: Paul Sobey; perl-win32-usersSubject: RE: 
  Threads + Memory Leak??
  
  Its not memory directly that's leaking, its handles which start to 
  consume memory.
  Have a look at the open handles on your app...maybe use perfmon to 
  monitor is and see if its the number of open handles that's doing 
  it.
   
  Cheers,
  John
  

-Original Message-From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
Paul SobeySent: Monday, February 21, 2005 7:51 
PMTo: perl-win32-usersSubject: Threads + Memory 
Leak??
I have a fairly 
large threaded script which maintains a cache of information between threads 
using a shared hash. I'm storing hashrefs in the hash. I've noticed that the 
memory usage of the script gets absolutely huge (over a gig) after about an 
hour of information, despite the fact that I am having the threads prune 
bits of the cache that aren't needed any more.
 
I'd heard that 
there are problems with memory leaks in shared hashes. Can anyone confirm 
that what I am doing should/shouldn't work with ActivePerl 5.8.5 on Win2000? 
I wondered whether storing references was a bad idea and causing garbage 
collection problems, perhaps I should re-write with 
storable?
 
Cheers,
Paul
* 

Gloucester Research Limited 
believes the information 
provided herein is reliable. 
While every care has been 
taken to ensure accuracy, the 
information is furnished 
to the recipients with no 
warranty as to the completeness 
and accuracy of its contents 
and on condition that any 
errors or omissions shall not 
be made the basis for any 
claim, demand or cause for 
action. 
* 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Threads + Memory Leak??

2005-02-21 Thread John Serink
Title: Message



Its not memory directly that's leaking, its handles which start to 
consume memory.
Have a look at the open handles on your app...maybe use perfmon to 
monitor is and see if its the number of open handles that's doing 
it.
 
Cheers,
John

  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of 
  Paul SobeySent: Monday, February 21, 2005 7:51 PMTo: 
  perl-win32-usersSubject: Threads + Memory 
  Leak??
  I have a fairly 
  large threaded script which maintains a cache of information between threads 
  using a shared hash. I'm storing hashrefs in the hash. I've noticed that the 
  memory usage of the script gets absolutely huge (over a gig) after about an 
  hour of information, despite the fact that I am having the threads prune bits 
  of the cache that aren't needed any more.
   
  I'd heard that 
  there are problems with memory leaks in shared hashes. Can anyone confirm that 
  what I am doing should/shouldn't work with ActivePerl 5.8.5 on Win2000? I 
  wondered whether storing references was a bad idea and causing garbage 
  collection problems, perhaps I should re-write with 
  storable?
   
  Cheers,
  Paul
  * 
  
  Gloucester Research Limited 
  believes the information 
  provided herein is reliable. 
  While every care has been 
  taken to ensure accuracy, the 
  information is furnished 
  to the recipients with no 
  warranty as to the completeness 
  and accuracy of its contents and 
  on condition that any 
  errors or omissions shall not be 
  made the basis for any 
  claim, demand or cause for 
  action. 
  * 
  
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: handle leak with shared vars

2005-02-20 Thread John Serink
Hi!

Its known and in bugzilla(http://bugs.activestate.com), 35931. I too
thought it was going to be fixed in 5.8.6 but no luck.
>From Jeff Griffiths regarding this issue:
"For 5.8.6, we left the Win32::* stuff as-is, but I believe Jan wants to
look at fixing bugs for the next round."

Cheers,
John


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Perl Diver
> Sent: Monday, February 21, 2005 7:55 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: handle leak with shared vars
> 
> 
> I noticed a strange phenomenon with threads and shared hashes 
> and arrays.  It appears that every time you add new elements 
> to such a variable, the handle count goes up.  I don't know 
> if this will cause problems, but because of this my processes 
> will end up using anywhere from 5,000-50,000 handles.  I 
> noticed some unstability on Win98, and this may be related, 
> I'm not sure.
> 
> My test platform is Win2000 Server, with ActivePerl 5.8.6 build 811. 
> I was using 5.8.4, but I upgraded today in the hopes that 
> might fix the handle situation, but it's still the same.
> 
> I'm attaching a small test program (75 lines) that 
> illustrates the problem.  Running it with the default 
> settings (128 elements, 1 worker
> thread) produces the following results on my test machine:
> Memory: 4292 KB
> Handles: 5149
> Interestingly, if you increase the number of worker threads 
> beyond 1, there is no extra used handles.  It's only when you 
> increase the number of elements in the shared hash/array that 
> the handle count goes up.  I'd like my program to be able to 
> handle several thousand elements in those vars...
> 
> Is this actually a bug in Perl's thread implementation, or is 
> my code at fault?  If so, what can I do to fix it?  If not, 
> how can I report this bug?
> 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: WINS - "reset"

2005-02-20 Thread John Serink
Sc \\yourserver stop wins
Sc \\yourserver start wins



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Hon Shi
> Sent: Sunday, February 20, 2005 10:42 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: WINS - "reset"
> 
> 
> Anyone have tools/script to "reset" a group of WINS servers. 
> I'm not going to do this again by hand!
> 
> 
> 
> 
>   
> __ 
> Do you Yahoo!? 
> Yahoo! Mail - Find what you need with new enhanced search. 
> http://info.mail.yahoo.com/mail_250
> 
> ___
> 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 use Perl to operate Windows's registry table ( simple script example is really appreciated) ?

2005-02-01 Thread John Serink
Win32::TieRegistry
Read the docs, it installed with the default activestate distribution.

On Tue, 2005-02-01 at 19:07 +0800, honery wrote:
> Hello ,
> 
> Could you please tell me how to use Perl to operate Windows's registry
> table, such as search,add key,modify value etc...
> 
> And I would really appreciate that someone can kindly provide some
> simple sample scripts to make understanding easier.
> 
> 
> Any help will be appreciated.
> Thxs,
> 
> Honery.
> ___
> 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: port number <---> process id, for nt,2000(pro)

2005-01-09 Thread John Serink
Go to www.sysinternals.com
They have a utility that can help you on Win2K.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Monday, January 10, 2005 11:40 AM
> To: perl-win32-users@listserv.ActiveState.com
> Cc: [EMAIL PROTECTED]
> Subject: port number <---> process id, for nt,2000(pro)
> 
> 
> hi all,
> 
> how do i retrieve a port number a process uses from a pid or 
> vice versa.
> 
> This can be done in xp eg.
> $ret = 
> Win32::IPHelper::AllocateAndGetTcpExTableFromStack([EMAIL PROTECTED]
> BLE,$bOrder);
> 
> the above does not work in NT,2000 (pro).
> 
> This is driving me crazyI cant find an api so i can get 
> it working for all windows (eg. nt,2000).
> 
> If Zone Alarm can do this, why can't I? 
> is there a wmi way?
> is there an win32 api way?
> 
> Thanks in advance for any help.
> 
> Jeremy A.
> 
> 
> 
> ___
> 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: getsockopt--Solution on Win32 and Linux

2005-01-08 Thread John Serink
This works on both OSs
my $linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);
if(defined($linger)){
if($^O eq "MSWin32"){
print("Length of linger is ");
print(length($linger)."\n");
my @jim = unpack("SS", $linger);
print("The length of linger unpacked is ".scalar(@jim)."\n");
print("The SO_LINGER return value is $jim[0] and $jim[1]\n");
}else {
print("Length of linger is ");
print(length($linger)."\n");
my @jim = unpack("II", $linger);
print("The length of linger unpacked is ".scalar(@jim)."\n");
print("The SO_LINGER return value is $jim[0] and $jim[1]\n");
}
} else {
print("Return value fo SO_LINGER is undefined\n");
}

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of John Serink
> Sent: Friday, January 07, 2005 2:09 PM
> To: $Bill Luebkert; perl-win32-users@listserv.ActiveState.com
> Subject: RE: getsockopt--Solution on Win32
> 
> 
> Hi Bill:
> 
> Thanx for that! Got Stein's "Network programming With Perl" 
> and he alos have the unit struc in it as does allthe online 
> docs. Just one of those things.
> 
> Also, in Windows SO-LINGER appears to be off, or set to zero 
> by default.
> 
> Will do an OS check before I setup the socket to make the 
> appropriate settings
> 
> Cheers,
> john
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of $Bill Luebkert
> > Sent: Friday, January 07, 2005 1:57 PM
> > To: perl-win32-users@listserv.ActiveState.com
> > Subject: Re: getsockopt--Solution on Win32
> > 
> > 
> > John Serink wrote:
> > 
> > > Ok, from:
> > > 
> > 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winso
> > > ck
> > > /winsock/linger_2.asp
> > > 
> > > You'll note that using Winsock the linger structure is:
> > typedef struct
> > > linger {
> > >   u_short l_onoff;
> > >   u_short l_linger;
> > > } linger;
> > 
> > Too bad the orig post didn't include that.  ;)
> > 
> > > While from:
> > > http://www.rt.com/man/getsockopt.2.html
> > > The linus linger structure is:
> > > struct linger {
> > >   int  l_onoff;   /* Linger active */
> > >   int  l_linger;  /* How long to linger for */
> > > };
> > > As such, a correct way to do this in Win32:
> > > my $setsock =
> > setsockopt($sock,SOL_SOCKET,SO_LINGER,pack("SS",1,120));
> > > if(defined($setsock)){
> > > $linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);
> > > if(defined($linger)){
> > > print("setcockopt was successful to on and 120 
> seconds\n");
> > > print("Linger is $linger\n");
> > > print("Length of linger is ");
> > > print(length($linger)."\n");
> > > my $firstbyte = substr($linger,0,2,"");
> > > print("Length of linger after substr is ");
> > > print(length($linger)."\n");
> > > print("Length of firstbyte after substr is ");
> > > print(length($firstbyte)."\n");
> > > $linger = unpack("S*", $linger);
> > > print("The length of linger unpacked is
> > ".length($linger)."\n");
> > > print("The SO_LINGER secondbyte return value is 
> $linger\n");
> > > $firstbyte = unpack("S*", $firstbyte);
> > > print("The length of firstbyte unpacked is
> > > ".length($firstbyte)."\n");
> > > print("The SO_LINGER firstbyte return value is 
> > $firstbyte\n");
> > > } else {
> > > print("Return value fo SO_LINGER is undefined\n");
> > > }
> > > }
> > 
> > I hadn't looked at the linger structure since he described it
> > as in int and getsockopt returns an int (needless to say it 
> > has two fields encoded into the int apparently).
> > 
> > A little simpler snippet and it includes the creation of
> > socket and pre-check (for Win32 only - you could add a check) :
> > 
> > use strict;
> > use IO::Socket;
> > 
> > my $S = IO::Socket::INET->new(LocalPort => , Lis

RE: getsockopt--Solution on Win32

2005-01-06 Thread John Serink
Hi Bill:

Thanx for that! Got Stein's "Network programming With Perl" and he alos
have the unit struc in it as does allthe online docs. Just one of those
things.

Also, in Windows SO-LINGER appears to be off, or set to zero by default.

Will do an OS check before I setup the socket to make the appropriate
settings

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of $Bill Luebkert
> Sent: Friday, January 07, 2005 1:57 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Re: getsockopt--Solution on Win32
> 
> 
> John Serink wrote:
> 
> > Ok, from: 
> > 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winso
> > ck
> > /winsock/linger_2.asp
> > 
> > You'll note that using Winsock the linger structure is: 
> typedef struct 
> > linger {
> >   u_short l_onoff;
> >   u_short l_linger;
> > } linger;
> 
> Too bad the orig post didn't include that.  ;)
> 
> > While from:
> > http://www.rt.com/man/getsockopt.2.html
> > The linus linger structure is:
> > struct linger {
> > int  l_onoff;   /* Linger active */
> >   int  l_linger;  /* How long to linger for */
> > };
> > As such, a correct way to do this in Win32:
> > my $setsock = 
> setsockopt($sock,SOL_SOCKET,SO_LINGER,pack("SS",1,120));
> > if(defined($setsock)){
> > $linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);
> > if(defined($linger)){
> > print("setcockopt was successful to on and 120 seconds\n");
> > print("Linger is $linger\n");
> > print("Length of linger is ");
> > print(length($linger)."\n");
> > my $firstbyte = substr($linger,0,2,"");
> > print("Length of linger after substr is ");
> > print(length($linger)."\n");
> > print("Length of firstbyte after substr is ");
> > print(length($firstbyte)."\n");
> > $linger = unpack("S*", $linger);
> > print("The length of linger unpacked is 
> ".length($linger)."\n");
> > print("The SO_LINGER secondbyte return value is $linger\n");
> > $firstbyte = unpack("S*", $firstbyte);
> > print("The length of firstbyte unpacked is 
> > ".length($firstbyte)."\n");
> > print("The SO_LINGER firstbyte return value is 
> $firstbyte\n");
> > } else {
> > print("Return value fo SO_LINGER is undefined\n");
> > }
> > }
> 
> I hadn't looked at the linger structure since he described it 
> as in int and getsockopt returns an int (needless to say it 
> has two fields encoded into the int apparently).
> 
> A little simpler snippet and it includes the creation of 
> socket and pre-check (for Win32 only - you could add a check) :
> 
> use strict;
> use IO::Socket;
> 
> my $S = IO::Socket::INET->new(LocalPort => , Listen => 5, 
> Reuse => 1) or
>   die "new socket: $! ($^E)";
> 
> check_linger ();
> my $ret = setsockopt $S, SOL_SOCKET, SO_LINGER, pack 'SS', 1, 
> 120; die "setsockopt: $! {$^E)" if not $ret; check_linger (); exit;
> 
> sub check_linger {
> 
> my $ret = getsockopt $S, SOL_SOCKET, SO_LINGER;
> die "getsockopt: $! ($^E)\n" if not $ret;
> my ($onoff, $ltime) = unpack 'SS', $ret;
> print "onoff = $onoff\n";
> print "ltime = $ltime\n";
> 
> }
> 
> __END__
> 
> -- 
>   ,-/-  __  _  _ $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 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: getsockopt--Solution on Win32

2005-01-06 Thread John Serink
Ok, from:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock
/winsock/linger_2.asp

You'll note that using Winsock the linger structure is:
typedef struct linger {
  u_short l_onoff;
  u_short l_linger;
} linger;

While from:
http://www.rt.com/man/getsockopt.2.html
The linus linger structure is:
struct linger {
int  l_onoff;   /* Linger active */
  int  l_linger;  /* How long to linger for */
};
As such, a correct way to do this in Win32:
my $setsock = setsockopt($sock,SOL_SOCKET,SO_LINGER,pack("SS",1,120));
if(defined($setsock)){
$linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);
if(defined($linger)){
print("setcockopt was successful to on and 120 seconds\n");
print("Linger is $linger\n");
print("Length of linger is ");
print(length($linger)."\n");
my $firstbyte = substr($linger,0,2,"");
print("Length of linger after substr is ");
print(length($linger)."\n");
print("Length of firstbyte after substr is ");
print(length($firstbyte)."\n");
$linger = unpack("S*", $linger);
print("The length of linger unpacked is ".length($linger)."\n");
print("The SO_LINGER secondbyte return value is $linger\n");
$firstbyte = unpack("S*", $firstbyte);
print("The length of firstbyte unpacked is
".length($firstbyte)."\n");
print("The SO_LINGER firstbyte return value is $firstbyte\n");
} else {
print("Return value fo SO_LINGER is undefined\n");
}
}

Which produces the following output:
setcockopt was successful to on and 120 seconds
Linger is ? x
Length of linger is 4
Length of linger after substr is 2
Length of firstbyte after substr is 2
The length of linger unpacked is 3
The SO_LINGER secondbyte return value is 120
The length of firstbyte unpacked is 1
The SO_LINGER firstbyte return value is 1

Which is correct.

Cheers,
John




> -Original Message-
> From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 06, 2005 6:22 PM
> To: John Serink
> Cc: perl-win32-users@listserv.ActiveState.com
> Subject: Re: getsockopt
> 
> 
> John Serink wrote:
> 
> > Hi All:
> > 
> > Anybody know how to properly unpack this:
> > my $linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);
> > 
> > I've tried every option but I can't make sense of the response. 
> > $linger is 4 bytes long according to length($linger) so it did 
> > return... I just can't figure out how to unpack the response. Have 
> > tried: C,CC,c,cc,I,II,I,ii,V,v,N,N etc...
> 
> Actually it returns an int, so i would be more correct than l.
> 
> -- 
>   ,-/-  __  _  _ $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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


getsockopt

2005-01-06 Thread John Serink
Hi All:

Anybody know how to properly unpack this:
my $linger = getsockopt($sock,SOL_SOCKET,SO_LINGER);

I've tried every option but I can't make sense of the response.
$linger is 4 bytes long according to length($linger) so it did return...
I just can't figure out how to unpack the response.
Have tried:
C,CC,c,cc,I,II,I,ii,V,v,N,N etc...

Cheers,
John

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: :telnet question

2004-12-30 Thread John Serink
Telnet server on Windows NT works fine with Net::Telnet, on Win2K No as
Win2K using ANSI formatting which I've not figured a way to turn off.

Also works fine against a Ciso router.

WinXP never tried.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, December 30, 2004 9:16 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: net::telnet question
> 
> 
> Hi!
> Is there telnet server for windows98
> which works with Net::Telnet ?
> I downloaded some 6 servers
> some of them are not working
> at all,some does't work
> with Net::Telnet
> And 2-nd question:
> how to start fixed program/without params/ on windows98 box 
> from linux box (on a local network) ?
> 
> ___
> 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-Win32-Users Digest, Vol 11, Issue 14

2004-12-28 Thread John Serink
Use strict;
Use warnings;

my @jim=`bob.bat`;

print(@jim);



Will run bob.bat and capture all output to @jim. Note, those are back
ticks, above the tab key not single quotes.

:)
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of CHIDIPI, RAMJEE (SBCSI)
> Sent: Wednesday, December 29, 2004 3:43 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: FW: Perl-Win32-Users Digest, Vol 11, Issue 14
> 
> 
> Folks,
> I need some small help.
> 
> I want to run a perl script that would call a windows BAT  
> file. How can I do that?
> 
> Thanks
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, December 14, 2004 2:05 PM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Perl-Win32-Users Digest, Vol 11, Issue 14
> 
> 
> Send Perl-Win32-Users mailing list submissions to
>   perl-win32-users@listserv.ActiveState.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> or, via email, send a message with subject or body 'help' to
>   [EMAIL PROTECTED]
> 
> You can reach the person managing the list at
>   [EMAIL PROTECTED]
> 
> When replying, please edit your Subject line so it is more 
> specific than "Re: Contents of Perl-Win32-Users digest..."
> 
> 
> Today's Topics:
> 
>1. Re: Process Creation, Redirect Standard Handles ($Bill Luebkert)
>2. dll written in c++ (Zlatko Perenda)
>3. threads::shared (Chris)
>4. AW: threads::shared (Dietmar Fiehn, Dr.)
>5. RegEx help (Jeff Williams)
>6. RE: threads::shared (Paul Sobey)
>7. RE: RegEx help (Joe Discenza)
>8. Re: RegEx help (Pat Kusbel)
>9. Re: RegEx help (Kester Allen)
>   10. RE: RegEx help (Thomas, Mark - BLS CTR)
>   11. RE: dll written in c++ (Adam R. Frielink)
>   12. RE: RegEx help (Charles K. Clarkson)
> 
> 
> --
> 
> Message: 1
> Date: Mon, 13 Dec 2004 13:11:41 -0800
> From: "$Bill Luebkert" <[EMAIL PROTECTED]>
> Subject: Re: Process Creation, Redirect Standard Handles
> To: Paul Sobey <[EMAIL PROTECTED]>
> Cc: Perl-Win32 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
> 
> Paul Sobey wrote:
> 
> > I've fixed it, by experimenting packing the structure myself. I've
> found that changing the Win32::API::Struct definition of 
> lpReserved2 from LPBYTE to DWORD. The child process now gets 
> created perfectly and writes to the handles created.
> > 
> > Can anyone tell me why this should be so? Is it a bug in
> Win32::API::Struct or ::Type?
> 
> It's a bug.  On or about line 155 in Win32::API::Type.pm, you 
> will find
> :
> 
>if($is_pointer and $packing eq 'c') {
> 
> One fix is to change it to :
> 
>if ($is_pointer and lc $packing eq 'c') {
> 
> 
> -- 
>   ,-/-  __  _  _ $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)
> 
> 
> --
> 
> Message: 2
> Date: Tue, 14 Dec 2004 15:48:38 +0100
> From: Zlatko Perenda <[EMAIL PROTECTED]>
> Subject: dll written in c++
> To: "'perl-win32-users@listserv.ActiveState.com'"
>   
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi,
>  
> I have a dll written in c++, and the whole class is exported. 
> Now I am looking for a way to access those functions in a 
> class. I was thinking about writing some helper c function 
> which would dynamically allocate an object of that class and 
> return me a pointer to it, now I would implement another set 
> of helper functions which would use that pointer and call 
> class funcs an return me a result. 
>  
> Now I am looking for another way to do that. Or is this the 
> right way to go.
>  
> And also which module do you propose for using dlls in perl?
>  
> Thank you.
> -- next part --
> An HTML attachment was scrubbed...
> URL: 
> http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/perl-win
> 32-users/a
> ttachments/20041214/c0e41d3f/attachment-0001.htm
> 
> --
> 
> Message: 3
> Date: Tue, 14 Dec 2004 10:23:15 -0500
> From: "Chris" <[EMAIL PROTECTED]>
> Subject: threads::shared
> To: "perl-win32-users" 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
> 
> All,
> 
> I'm attempting to set the value of a shared variable from 
> within a thread and I'm getting a weird error. Can someone 
> tell me what I'm doing wrong here?
> 
> --
> use threads;
> use threads::shared;
> 
> my %final : shared = ();
> 
> 
> $final{'foo'}{'bar'}{'test'} = 1; # this is run inside a thread
> --

New perl build: 5.8.6

2004-12-20 Thread John Serink
Hi All:

Just installed the new perl build, thought it would fix the leaking
Win32 Handles with threads.
It didn't.

Perl is still leaking handles, 2 per thread when using shared hashes or
arrays.

Cheers,
John

John Edward Serink 
Product Applications Engineer, 
Infrastructure Systems 
Trimble Navigation Singapore PTE Ltd. 
80 Marine Parade Road, 
Co. Reg. No. 199204958W
#22-06 Parkway Parade 
Singapore 449269 
Tel 65-6348-2212 
Fax 65-6348-2232 
DID 65-6348-2178 
HP  65-9129-4250 



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Binary Data File Question

2004-12-19 Thread John Serink
Check the perl docs for "pack" and "unpack".

Everything you need is there.

Cheers,
john


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Leroy G. Blimegger Jr.
> Sent: Sunday, December 19, 2004 10:01 PM
> To: [EMAIL PROTECTED]
> Subject: Binary Data File Question
> 
> 
> Hi All,
> 
> First, I should apologize, as the question I'm about to ask 
> for help on isn't directly related to perl (yet!). I have a 
> binary data file with about 800 fields (some integer, some 
> string, some decimal, etc.) I have a map of the binary file, 
> meaning that I know how many bytes each field is and I'm 
> lucky enough to have a copy of the file that was converted to 
> an ASCII text file by another program, so I know the value of 
> each field.
> 
> I have a perl app that already uses the ASCII version of this 
> data file, but I want to skip the conversion program and do 
> the conversion in one of my apps. It takes approximately an 
> hour to convert one of these files from a binary data file to 
> ASCII, and then only a small percentage of the data is used. 
> So I think I can speed up the overall process by converting 
> on the fly.
> 
> I'm still deciding whether to build this functionality into 
> my existing perl app, or into the VB.NET app that controls 
> all of my perl apps. I've done a bit of testing with the file 
> in VB.NET and ran into an issue. So, before I go any further, 
> either in VB.NET or in perl, I need a bit of info.
> 
> Some of the fields in the data file are, as I mentioned, 
> decimal numbers, specifically, 4-byte single precision 
> numbers. However, for these fields, they are stored with 
> Least Significant Byte first. I did a quick test. I know one 
> of the values in a particular 4-byte group should be -12.3. 
> So, I wrote a quick app to store -12.3 as a 4-byte single 
> precision number to a data file. If I look at the data file, 
> I get CD CC 44 C1. If I read the data back out, I get -12.3. 
> But in the data file that I need to use, the 4 bytes are C1 
> 44 CC CD (LSB first). I can read each byte to a variable (b1, 
> b2, b3, b4), and I know I have to do something as b4, b3, b2, 
> b1, but I haven't a clue as to what it is!!
> 
> If any of you can provide a perl solution, or at least some 
> insight into how to convert when a value is stored with the 
> LSB first, I'd really appreciate it!!
> 
> Thanks,
> Lee
> 
> ___
> 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


RE: how to send mail from Win32 Perl using SMTP authentication?

2004-12-19 Thread John Serink
use strict;
use warnings;
use Net::SMTP;

my $mailhost = "mail.bob.com";
my $mailobj = "";
if($mailobj = Net::SMTP->new($mailhost, Timeout=>10, Debug=>1)){
print("Connected to $mailhost\n");
} else {
print("Could not connect to $mailhost\n");
die;
}


my $username = "[EMAIL PROTECTED]";
my $password = "jimmy";

$mailobj->auth($username,$password);
my $Rx1 = "[EMAIL PROTECTED]";
my $Rx2 = "[EMAIL PROTECTED]";
my $from = "[EMAIL PROTECTED]";
print("The recipients are $Rx1 and $Rx2\n");
$mailobj->mail($from);
$mailobj->recipient($Rx1, $Rx2,{SkipBad=>1});

if($mailobj->data()){
$mailobj->datasend("To:$Rx1\r\n");
$mailobj->datasend("cc:$Rx2\r\n");
$mailobj->datasend("Subject: Email from Perl script using
bob.com with authentication\r\n");
$mailobj->datasend("This is a test message\n");
print("Data sent successfully \n");
} else {
print("Send failed\n");
}



$mailobj->quit;


#This worked, with subject, to and cc fields.
#make sure the Auth::SASL module is installed.

You get the idea.

Cheers,
john

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of $Bill Luebkert
> Sent: Sunday, December 19, 2004 11:52 AM
> To: Bennett Haselton
> Cc: [EMAIL PROTECTED]
> Subject: Re: how to send mail from Win32 Perl using SMTP 
> authentication?
> 
> 
> Bennett Haselton wrote:
> 
> > Does anybody have any sample code for sending mail from a 
> Perl script 
> > on
> > Windows, through an SMTP server that requires SMTP authentication?
> > 
> > I have a script where I wrote the logic in fifteen minutes and then 
> > have
> > spent about three hours trying to look up a way for Perl to 
> simply send the 
> > email.  I found the Mail::Mailer module but its 
> documentation page says it 
> > specifically doesn't support SMTP authentication.  I found the 
> > Net::SMTP_auth module searching PPM modules for "SMTP", but 
> the sample code 
> > given in the documentation:
> > 
> > $smtp->auth('CRAM-MD5', 'user', 'password');
> > 
> > only shows how set the authentication method to "CRAM-MD5".  It 
> > doesn't
> > list any other valid values that are accepted for the 
> authentication 
> > method.  It does say that I can use this code:
> > 
> > $smtp = Net::SMTP_auth->new('mail.speakeasy.net');
> > print $smtp->auth_types();
> > 
> > to find out what authentication types are supported by 
> > mail.speakeasy.net;
> > when I do that, the only value returned is "LOGINPLAIN", 
> and if I try this 
> > code:
> > 
> > $smtp->auth('LOGINPLAIN', 'user', 'password');
> > 
> > I get the error:
> > 
> > No SASL mechanism found
> >   at C:/Perl/site/lib/Authen/SASL.pm line 62
> > 
> > which I assume is the generic error meaning the 
> Net::SMTP_auth module
> > doesn't support that authentication type, since it's the 
> same error I get 
> > if I try using a junk authentication type e.g.
> > 
> > $smtp->auth('FOOBAR', 'user', 'password');
> 
> Try using just plain Net::SMTP module - there is an auth 
> method, but not sure if it's dependent on Authen::SASL or not.
> 
> -- 
>   ,-/-  __  _  _ $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


RE: Perl for 64 bit XP

2004-12-16 Thread John Serink
If you're on a Linux box, just compile from source at 64bits.
If you're on a Win32 box running XP 64, and you want 64bit perl, again,
compile from source.

Not sure how stable the Win32 Modules will be on 64 bits.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of jtownsen
> Sent: Friday, December 17, 2004 4:41 AM
> To: [EMAIL PROTECTED]
> Subject: Perl for 64 bit XP
> 
> 
> I need to move some scripts to a 64-bit XP box (beta of XP). 
> Is there a 
> 64-bit Perl available? Or should I be able to run 32-bit Perl 
> on my 64-bit box?
> 
> Any comments or suggestions are welcome.
> 
> ___
> 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


RE: Is there a way to execute Windows/DOS command-line executableremotely from a linux box?

2004-12-09 Thread John Serink
Net::Telnet


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jim MacDiarmid
> Sent: Friday, December 10, 2004 12:17 PM
> To: 'Perl-Win32'
> Subject: Is there a way to execute Windows/DOS command-line 
> executableremotely from a linux box?
> 
> 
> 
> I'm kind of stuck between a rock and a hard place.  I'm 
> working on a website that is being hosted through a 
> third-party hosting company and they are using a Linux 
> environment. The web application I'm working on requires a 
> DOS-command line utility to be executed every 60 seconds and 
> output is captured.  I was wondering if there was a way to 
> run a perl script that would remotely connect to a Windows 
> box and execute the DOS utility then grab the output file 
> that the DOS utility creates?  
> 
> If that won't work, would anyone have any suggestions on a 
> work around?
> 
> Thanks in advance,
> Jim 
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, December 09, 2004 9:33 PM
> To: John Serink
> Cc: [EMAIL PROTECTED]; Perl-Win32
> Subject: RE: get a list of installed programs and path to exe.
> 
> hi all.
> 
> here is a start.
> 
> I want to get values for programs installed.
> eg. "DisplayName","DisplayVersion" etc.
> 
> thanks in advance for any help.
> 
> -Jeremy A.
> -
> #!perl
> 
> 
> use Win32::TieRegistry( Delimiter=>"#", ArrayValues=>0 );  
> $pound= $Registry->Delimiter("/"); $appKey= 
> $Registry->{"LMachine/SOFTWARE/Microsoft/Windows/CurrentVersio
> n/Uninstall/"}
> ;
> 
>  foreach $entry (  keys(%$appKey)  ) {
>   
>   if($entry =~ m/\{/ig)
>   {
>   last;
>   }
>   if($entry !~ m/KB\d+|IE\d+|IE\w+/ig)
>   {
>   print $entry."\n";
>   }
>   
>   }
> 
> -
> 
> Quoting John Serink <[EMAIL PROTECTED]>:
> 
> > Go to the registry and peel it out of there. Win32::TieRegistry is 
> > what you're after.
> > 
> > Have fun,
> > John
> > 
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On 
> > > Behalf Of [EMAIL PROTECTED]
> > > Sent: Friday, December 10, 2004 9:32 AM
> > > To: Perl-Win32
> > > Cc: [EMAIL PROTECTED]
> > > Subject: get a list of installed programs and path to exe.
> > > 
> > > 
> > > Hi there,
> > > 
> > > in windows xp/2000 how do i get a list of all installed
> > > programs and paths to exe?
> > > 
> > > Thanks in advance.
> > > 
> > > -Jeremy A.
> > > 
> > > 
> > > 
> > > ___
> > > 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
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> ___
> 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
> 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: get a list of installed programs and path to exe.

2004-12-09 Thread John Serink
Go to the registry and peel it out of there.
Win32::TieRegistry is what you're after.

Have fun,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Friday, December 10, 2004 9:32 AM
> To: Perl-Win32
> Cc: [EMAIL PROTECTED]
> Subject: get a list of installed programs and path to exe.
> 
> 
> Hi there,
> 
> in windows xp/2000 how do i get a list of all installed 
> programs and paths to exe?
> 
> Thanks in advance.
> 
> -Jeremy A.
> 
> 
> 
> ___
> 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


RE: program probe

2004-12-09 Thread John Serink
@bob = `netstat -a -o`;

Use a regex to sift to the array bob to find the PID of interest.

Cheers,
John

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Friday, December 10, 2004 8:58 AM
> To: Perl-Win32
> Cc: [EMAIL PROTECTED]
> Subject: program probe
> 
> 
> hello there,
> 
> Sorry for the dumb questions.
> 
> Is there any way to probe a program to find if and what 
> (socket) ports it uses, in perl?
> 
> It should be compatible with windows xp service pack 2 (which 
> includes the windows firewall).
> 
> 
> Thanks in advance for all help.
> 
> -Jeremy A.
> 
> 
> 
> ___
> 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


RE: run a process as System account

2004-12-08 Thread John Serink
Win32::AdminMisc

See www.roth.net.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of Marie-eve URVOY
> Sent: Wednesday, December 08, 2004 5:34 PM
> To: Paul Sobey
> Cc: Perl-Win32
> Subject: RE: run a process as System account
> 
> I think I can't use 'at' command because I have to
> wait for the result of my command. And further more
> the command I want to execute has to be executed
> immediatly.
> Is it possible to use LogonAsUser and
> CreateProcessAsUser for System account?
> 
> Marie-Eve
> 
> (sorry for my poor english ... )
> 
>  --- Paul Sobey <[EMAIL PROTECTED]> a écrit :
> > Schedule with an at job? If it runs under the
> > context of the schedule service it'll be the system
> > account. Use /interactive if you need to see the
> > console.
> >
> > Paul
> >
> >
> > -Original Message-
> > From:
> > [EMAIL PROTECTED]
> >
> [mailto:[EMAIL PROTECTED]
> > On Behalf Of Marie-eve URVOY
> > Sent: 08 December 2004 08:51
> > To: [EMAIL PROTECTED]
> > Subject: run a process as System account
> >
> > Hi,
> > I'd like to know if it is possible to run a process
> > from a perl script as System account on Windows XP
> > (without creating a service). My script is lauched
> > by
> > a user with priviledge.
> > I have been searching the web by didn't find any
> > answer.
> > Thanks.
> > Marie-Eve
> >
> >
> >
> >
> >
> >
> > Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace
> > de stockage pour vos mails !
> > Créez votre Yahoo! Mail sur
> > http://fr.mail.yahoo.com/
> >
> > Avec Yahoo! faites un don et soutenez le Téléthon en
> > cliquant sur
> > http://www.telethon.fr/030-Don/10-10_Don.asp
> > ___
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe:
> > http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >
> >
> *
> > Gloucester Research Limited believes the information
> >
> > provided herein is reliable. While every care has
> > been
> > taken to ensure accuracy, the information is
> > furnished
> > to the recipients with no warranty as to the
> > completeness
> > and accuracy of its contents and on condition that
> > any
> > errors or omissions shall not be made the basis for
> > any
> > claim, demand or cause for action.
> >
> *
> >
> >
> 
> 
> 
> 
> 
> 
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos
> mails !
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
> 
> Avec Yahoo! faites un don et soutenez le Téléthon en cliquant sur
> http://www.telethon.fr/030-Don/10-10_Don.asp
> ___
> 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


RE: Blocking ports

2004-12-08 Thread John Serink
Just open a single client server on the ports you don't what anyone to
use

You'll have to do it in a separate thread however and that could start
to consume resources...else it will block waiting for an accept.

Or, you could create server using the IO::Select method and wait for
connects but I think that limits you to max of 255 open servers at once.

Cheers,
John


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:perl-
> [EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, December 08, 2004 3:12 PM
> To: Perl-Win32
> Cc: [EMAIL PROTECTED]
> Subject: Blocking ports
> 
> Hi all,
> 
> I have a network problem.
> 
> how do i block a port(s) programmically in perl, making the port
unusable
> by
> other software, requiring that port, while the perl script is running.
> 
> my platform is windows, so the solution must be windows compatible.
> 
> Thanks in advance for any help.
> 
> -Jeremy A.
> 
> ___
> 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


  1   2   >