Re: stop a Windows application from within a Perl script

2006-04-18 Thread Reinhard Pagitsch
Jack D. wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Jablonsky Sent: April 17, 2006 8:00 PM To: perl-win32-users@listserv.ActiveState.com Subject: stop a Windows application from within a Perl script Hi all, I have a very simple script

RE: stop a Windows application from within a Perl script

2006-04-18 Thread LeFevre, Ken
There's also a great command line tool by Mark Russinovich (which is easy to launch from a perl script) called pskill (you can get it at www.sysinternals.com). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jack D. Sent: Monday, April 17, 2006 10:52 PM

Fw: Non-blocking IO?

2006-04-18 Thread D D Allen
I'd look at POE which contains functionality to do lots of things non-blocking including Web server functionality -- see poe.perl.org. Look at the cookbook examples under Web at http://poe.perl.org/?POE_Cookbook And there's a POE mailing list at [EMAIL PROTECTED] For Win32 PPMs, you'll need to

RE: stop a Windows application from within a Perl script

2006-04-18 Thread Daniel Rawson
On XP (and I think on 2000) there are standard command-line tools for this; 'tasklist' will list all the processes, and 'taskkill' will kill a specified one. Both are normally installed in c:\windows\system32 Dan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

RE: Quick Q [-d test with unicode/wide directory names]

2006-04-18 Thread D D Allen
And for what it's worth, I submitted this solution using the Win32 API calls FindFirstFileW, FindNextFileW in late January: http://aspn.activestate.com/ASPN/Mail/Message/2996684 More generally, the built-in directory and file operators don't work with directory and filenames that contain unicode

exhausting file handles in Win32

2006-04-18 Thread cabz
Hello! I am new perl (again). I am performing QA on software developed at my company. My task is to try to exhaust all file handles on the Win32 platform (Win2K and WinXP) and see how our software behaves. With the code below, I am able to open no more than 2045 file handles under a

Re: breaking out of a for/foreach loop...

2006-04-18 Thread dkazatsky
Bruce, You can use a Label and a goto statement. for (@array) { if (condition met) { goto Label; } } LABEL: ... Hope this helps. Dave Kazatsky Senior Middleware Engineer NSE - Solutions Engineering W. (732) 893-4351 C. (973) 865-8106 bruce [EMAIL PROTECTED] bruce [EMAIL

Re: Re: breaking out of a for/foreach loop...

2006-04-18 Thread
Its last what you are looking for. This will break out of the inner-most loop. Optionally, you can put a label at the start of your loop and exit it by name, like: my $foo = 0; OUTER: while (1) { INNER: while (1) { $foo++; if ($foo 1) last INNER; } } The last INNER

Re: exhausting file handles in Win32

2006-04-18 Thread Carlos Barbet
OK, I thought perhaps using the FileHandle module would help, I rewrote the script in the fashion below. And it remains limited to 3197 using the Cygwin shell or 2045 using cmd.exe. I _assume_ the issue is something to do with perl being an interpreted language and an environment variable??

running a perl app

2006-04-18 Thread bruce
hi.. using linux. when i do perl foo.pl everything works ok. when i do ./foo.pl i get errors.. i've set the exe bit chmod 775 foo.pl... any idea as to what's going on... thanks -bruce ___ Perl-Win32-Users mailing list

RE: exhausting file handles in Win32

2006-04-18 Thread Jan Dubois
On Tue, 18 Apr 2006, Carlos Barbet wrote: OK, I thought perhaps using the FileHandle module would help, I rewrote the script in the fashion below. And it remains limited to 3197 using the Cygwin shell or 2045 using cmd.exe. I _assume_ the issue is something to do with perl being an interpreted

Iffor

2006-04-18 Thread Ng, Bill
Syntax issue (I think), I'm trying to do the following: I need to execute a block of instructions for all items in an array except for one. So if my array was: @a=(1,2,3,4,5); And we assume that I don't want to execute the block if the value of $_ is 3 ... Then, in my head, I'm looking for the

Re: exhausting file handles in Win32

2006-04-18 Thread Carlos Barbet
For the record: I am QA person and was asked to see what happens when our client software encounters a resource shortage and cannot get a file handle as it is performing its FIPS self-tests. Because I didn't understand it completely, I brought Timothy Johnson response to the engineering group

RE: running a perl app

2006-04-18 Thread Ng, Bill
First, You're writing to a Win32 (Read: Windows) mailing list. =) Second, You're either missing or misspelling the path to the perl interpreter as your first line in every script. Your first line should always be: - #!/usr/bin/perl (or whatever the path is

Re: running a perl app

2006-04-18 Thread Paikia
On 4/18/06, bruce wrote: hi..using linux. when i do perl foo.pl everything works ok. when i do./foo.pl i get errors.. i've set the exe bit chmod 775 foo.pl...any idea as to what's going on... Have you forgotten to add the shebang #!/usr/bin/perl (without quote - path to your Perl executable) on

RE: exhausting file handles in Win32

2006-04-18 Thread Jan Dubois
On Tue, 18 Apr 2006, Carlos Barbet wrote: Is it fair to say that ActivePerl is preventing the end user from doing something horrible to their system and not a limitation in perl itself? Yes, there is no guarantee that you can use Perl to exhaust any system- wide resource. Just like there is no

Re: running a perl app

2006-04-18 Thread John Shea
Bruce,To determine the correct path for your perl interpretor, use: which perl-- John T SheaThere are 2 kinds of people in the world,those who finish what they start ... On 4/18/06, Ng, Bill [EMAIL PROTECTED] wrote: First,You're writing to a Win32 (Read: Windows) mailing list. =)Second,You're

RE: Iffor

2006-04-18 Thread Arms, Mike
Bill Ng [bill.ng AT citigroup.com] wrote: Syntax issue (I think), I'm trying to do the following: I need to execute a block of instructions for all items in an array except for one. So if my array was: @a=(1,2,3,4,5); And we assume that I don't want to execute the block if the value of

RE: Iffor

2006-04-18 Thread Timothy Johnson
How about this? ### use strict; use warnings; my @a = (1,2,3,4,5); foreach(@a){ unless($_ == 3){ #do something... } } ### -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ng, Bill Sent: Tuesday, April 18,

RE: Iffor

2006-04-18 Thread Timothy Johnson
Okay, I'm a moron. I somehow missed that last line. Disregard... IMHO you probably wouldn't gain any significant performance here even if you succeeded in the syntax you are looking for because you still have to do a check for each iteration of the loop. The only thing else I can think of

RE: Iffor

2006-04-18 Thread Ng, Bill
Thanks anyway Tim, Performance isn't really what I'm going for, just simpler code. For the past 4 years, I've been coding to get the job done, no matter how many lines it takes or how ugly it is to read, as long as it works that's fine. But recently you guys have shown me how to simplify

RE: Iffor

2006-04-18 Thread Jerry Kassebaum
@a = (1,2,3,4,5); for $x (@a) { if($x==3){next;} print $x\n; } ## You wrote: Syntax issue (I think), I'm trying to do the following: I need to execute a block of instructions for all items in an array except for one. So if my array was: @a=(1,2,3,4,5); And we

RE: Iffor

2006-04-18 Thread Suresh Govindachar
Ng, Bill asked on April 18, 2006 12:59 PM So if my array was: @a=(1,2,3,4,5); And we assume that I don't want to execute the block if the value of $_ is 3 ... Then, in my head, I'm looking for the WORKING (key word there) version of this: --- @a =

RE: Iffor

2006-04-18 Thread Ng, Bill
Read the last sentence of my email ... =) Bill Ng -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jerry Kassebaum Sent: Tuesday, April 18, 2006 6:07 PM To: perl-win32-users@listserv.ActiveState.com Subject: RE: Iffor @a = (1,2,3,4,5); for $x (@a) {

RE: Iffor

2006-04-18 Thread Suresh Govindachar
Ng, Bill wrote: Performance isn't really what I'm going for, just simpler code. For the past 4 years, I've been coding to get the job done, no matter how many lines it takes or how ugly it is to read, as long as it works that's fine. But recently you guys have shown

Re: Iffor

2006-04-18 Thread Lyle Kopnicky
Ng, Bill wrote: Performance isn't really what I'm going for, just simpler code. If clear code is what you want, you won't get it using a 'next' as some have suggested. A 'next' syntactically looks like any other line, and is therefore not easily noticed as part of the control flow.

Re: Iffor

2006-04-18 Thread D D Allen
[Soap box warning...] You seem to be suffering from a common perl programming psychosis: the sometimes unbearable urge to write clever perl in the fewest possible number of lines ... that infects us all from time to time... Read Damian Conway's Perl Best Practices. And when you feel the need to

Re: exhausting file handles in Win32

2006-04-18 Thread Billy Conn
I'd try the following: #!/usr/bin/perl -w use strict; use File::Spec; use POSIX qw(tmpnam); use Win32API::File; my $num = shift || 10; my (@tempfiles, @temphandles); #impatience $| = 1; END { map {CloseHandle $_ } @temphandles; #hubris map {unlink $_ } @tempfiles;

Re: running a perl app

2006-04-18 Thread Jerry Kassebaum
To determine the correct path for your perl interpretor, use: which perl -- Please give me a context. C: which perl $x = which perl; c: perl which perl I'm missing something here. ___ Perl-Win32-Users mailing list

Opening an Excel workbook with links to other data sources

2006-04-18 Thread Suresh Govindachar
Hello, When I manually open an Excel file, it bring up a dialog box stating that the workbook contains links to other data sources and asking if the data should be updated. The following perl code brings up a similar dialog box: use Win32::OLE qw(in with); use