[31970] in Perl-Users-Digest
Perl-Users Digest, Issue: 3234 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 13 16:09:30 2010
Date: Mon, 13 Dec 2010 13:09:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 13 Dec 2010 Volume: 11 Number: 3234
Today's topics:
Re: perl code to automate launching a program and enter <justin.1011@purestblue.com>
Re: Regex to match a numerical IP range <tzz@lifelogs.com>
Re: Regex to match a numerical IP range sln@netherlands.com
Re: Regex to match a numerical IP range sln@netherlands.com
Using module for different operating systems <proximum@invalid.com>
Re: Using module for different operating systems <jurgenex@hotmail.com>
Re: Using module for different operating systems <hjp-usenet2@hjp.at>
Re: Variable Question Dec. 12, 2010 <edgrsprj@ix.netcom.com>
Re: Variable Question Dec. 12, 2010 <edgrsprj@ix.netcom.com>
Re: Who will win the battle for control of the web? <hjp-usenet2@hjp.at>
Re: Windows Question Dec. 12, 2010 <nospampleasebutthisisvalid3@gmx.net>
Re: Windows Question Dec. 12, 2010 <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Dec 2010 14:44:37 +0000
From: Justin C <justin.1011@purestblue.com>
Subject: Re: perl code to automate launching a program and entering responses
Message-Id: <l3oht7-r9c.ln1@zem.masonsmusic.co.uk>
On 2010-12-11, Bennett Haselton <bennett@peacefire.org> wrote:
> If I have a program called foo that does something like:
>
> Hello world. Should I continue? (y/n)
> [user must type 'y' and hit Enter before continuing]
> Thanks!
>
> then how would I write a perl script that launches foo, waits until it
> sees the line "Hello world. Should I continue? (y/n)", and
> automatically enters the "y" response, all while printing to stdout
> the output that foo is printing and the responses that the perl script
> is entering? Actually, how can I do it without downloading and
> installing any additional perl modules that don't come with the
> standard perl distribution? (Even if there is a specialized class
> that does it more elegantly, can I just do it with normal reads and
> writes?)
>
> I know this must be simple, and I tried to figure it out myself, but I
> couldn't find any phrase to Google for that would give me the answer
> (e.g. "perl automate entering input", etc.)
>
> Is it just two lines of code? I know asking people to write code for
> you is frowned upon, but in this case wouldn't it be faster than
> typing a response in English sentences? :)
Is there a reason you want to do this with perl? If you are on *nix OS
you may find that you have the expect program already.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 13 Dec 2010 10:51:11 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Regex to match a numerical IP range
Message-Id: <87d3p5obuo.fsf@lifelogs.com>
On Sat, 11 Dec 2010 14:26:17 -0800 sln@netherlands.com wrote:
s> Somebody posted recently on perl.beginners this topic
s> (was: "Regex to match a numerical range")
s> The person was trying to match, using a regex, a range of IP's
s> like 127.0.0.[0-255] or something like that.
s> A bunch of posters replied with a textual solution.
s> The group is a list and I don't really have an email or know
s> how it works. I was going to reply with something like below.
s> It heavily uses eval, and has some moderate level regexs'.
s> The principle is that dec number becomes hex in \x{#} utf8 char.
s> Its workings are not at all that obvious and its pretty slow
s> comparitively, not only because of the evals' but because of
s> the runover past bytes, when it becomes utf8 characters in the
s> regexs'.
I think Net::Netmask is much better for this task than any custom
solution. Have you tried it?
Ted
------------------------------
Date: Mon, 13 Dec 2010 12:25:51 -0800
From: sln@netherlands.com
Subject: Re: Regex to match a numerical IP range
Message-Id: <7qvcg651t2lr152naamvq19mt30538ur2j@4ax.com>
On Mon, 13 Dec 2010 10:51:11 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:
>On Sat, 11 Dec 2010 14:26:17 -0800 sln@netherlands.com wrote:
>
>s> Somebody posted recently on perl.beginners this topic
>s> (was: "Regex to match a numerical range")
>s> The person was trying to match, using a regex, a range of IP's
>s> like 127.0.0.[0-255] or something like that.
>s> A bunch of posters replied with a textual solution.
>
>s> The group is a list and I don't really have an email or know
>s> how it works. I was going to reply with something like below.
>s> It heavily uses eval, and has some moderate level regexs'.
>s> The principle is that dec number becomes hex in \x{#} utf8 char.
>
>s> Its workings are not at all that obvious and its pretty slow
>s> comparitively, not only because of the evals' but because of
>s> the runover past bytes, when it becomes utf8 characters in the
>s> regexs'.
>
>I think Net::Netmask is much better for this task than any custom
>solution. Have you tried it?
>
>Ted
Well, I thought it was just a case of knowing the simple ip
address without knowing anything about the CIDR network (block).
So given a simple quad part notation and range, a simple comparison
would be is all thats needed instead of a full blown cisco type thing.
-sln
------------------------------
Date: Mon, 13 Dec 2010 12:53:07 -0800
From: sln@netherlands.com
Subject: Re: Regex to match a numerical IP range
Message-Id: <pb0dg6tg09dd0476ghq4oapm1fpsjepirs@4ax.com>
On Sat, 11 Dec 2010 14:26:17 -0800, sln@netherlands.com wrote:
>However, any check in the range of \x0 - \x255 utf8 characters
>apparently works, where \x0 < \x127 < \x255, so it is deduced
A better solution is to use Net::Netmask and thats what I think.
But, to finish up this thing I wanted to flesh out the range class.
For maximum flexibility, let the template character class include individual
numbers and ranges, for example: [0-5,8,220,225-245], etc ..
And for a little extra speed, added a wildcard '*' so a particular part
doesen't need a range class. It just inserts a m/./ in the regex.
Validation was added on quad and optional port part.
This is all I will be doing on this because its relavence as a tool
is questionalble vs. to add anything else would take refactoring.
I thought it was a neat exercise in utf8, eval, and regular expressions though.
Parsing templates is too much work.
-sln
# Templating-Regex IP Range matching using utf8 chars \x{#}
# -----------------------------------------------------------
use strict;
use warnings;
my $show_UIpRegex = 1;
#### Test cases
print "\n";
my $pattern = makeUIpRegex(
'127. * . [99-110, 180, 182] . *' );
print "Testing Ip range ...\npattern =\n$pattern\n\n";
my ($count, $matched, $nomatch) = (0,0,0);
for my $q2 (20..22, 25) {
for my $q3 (0..255) {
for my $port (13, 193..195, 32700..32800, 3)
{
my $curip = "127 .$q2. $q3 .0 : $port";
if ( makeUIp( $curip ) =~ /$pattern/ ) {
print "Matched! $curip\n";
$matched++;
}
else {
# print "No match! $curip\n";
$nomatch++;
}
$count++;
}
}
}
print <<EOM;
Checked $count
Matched $matched
Not-matched $nomatch
EOM
exit;
#### subs
my ( $rx_IP, $rx_IPRx, $rx_IpRange, $rx_PortRange );
## Constructs a utf8 char string from a decimal notation IP
# ( where input = dec number, becomes hex in \x{#} utf8 char )
# Input -> '#.#.#.# (optional-> : # )'
sub makeUIp
{
my ($ip) = @_;
BEGIN { $rx_IP = qr/
^ \s*
(\d{1,3}) \s* \. \s* # q1 (1-3 digits)
(\d{1,3}) \s* \. \s* # q2 "
(\d{1,3}) \s* \. \s* # q3 "
(\d{1,3}) \s* # q4 "
(?: : \s* (\d{1,5}) \s*)? # optional port num (1-5 digits)
$ /x;
}
if ($ip =~ /$rx_IP/)
{
if ( defined $5 ) {
eval " \$ip = \"\\x{$1}\.\\x{$2}\.\\x{$3}\.\\x{$4} : \\x{$5}\" ";
}
else {
eval " \$ip = \"\\x{$1}\.\\x{$2}\.\\x{$3}\.\\x{$4}\" ";
}
if ($@) { warn $@; return ''; }
return $ip;
}
# not the correct ip form
return '';
}
## Constructs a REGEX utf8 pattern from a decimal notation IP template
# ( where input = dec number, becomes hex in \x{#} utf8 char )
# Input-> '#.#.#.#' - '[range].[range].[range].[range] : [range]'
# '*' can be substituted for any quad/port part # and is equivalent
# to range class [0-#(max_digits)] but is implemented as m/./ in the
# regex as opposed to a [\x{0}-\x{255}] character class
# ( example: 127. *. [range]. 1 : [range] )
# Range can be any combination of #-# or # separated by comma's
# (example: [#-#,#,#-#,#,#, ...] )
# Validation is done on all template parts as far as being between
# 0-255 and 0-65535, however this is not done for the wildcard '*'
# since it has no value to check.
# '*' should speed up the match but will allow ranges of [0-999]
# and/or [0-99999] depending on what part it is being used on.
# If the source string needs to be %100 valid, don't use '*'
# use a range [#-#] or #
sub makeUIpRegex
{
my ($ip) = @_;
my $res = '';
my $msg = 'makeUIpRegex : Invalid %s part \'%s\'';
BEGIN { $rx_IPRx = qr/
^ \s*
(?: (\d{1,3} | \*) | \[\s* ([^\]]+) \s*\] ) \s*\.\s*
(?: (\d{1,3} | \*) | \[\s* ([^\]]+) \s*\] ) \s*\.\s*
(?: (\d{1,3} | \*) | \[\s* ([^\]]+) \s*\] ) \s*\.\s*
(?: (\d{1,3} | \*) | \[\s* ([^\]]+) \s*\] ) \s*
(?:
: \s* (?: (\d{1,5} | \*) | \[\s* ([^\]]+) \s*\] ) \s*
)?
$ /x;
}
if ($ip =~ /$rx_IPRx/)
{
if ( defined $1 ) {
die sprintf( $msg, 'quad 1', $1) if ($1 ne '*' && $1 > 255);
$res .= ($1 eq '*' ? qq(\\.\\\\.) : qq(\\x{$1}\\\\.)) }
else {
$res .= '[';
my $str = parseIpRange( $2 );
die sprintf( $msg, 'quad 1', "\[$2\]") if (!defined $str);
$res .= $str . ']\\\\.';
}
if ( defined $3 ) {
die sprintf( $msg, 'quad 2', $3) if ($3 ne '*' && $3 > 255);
$res .= ($3 eq '*' ? qq(\\.\\\\.) : qq(\\x{$3}\\\\.)) }
else {
$res .= '[';
my $str = parseIpRange( $4 );
die sprintf( $msg, 'quad 2', "\[$4\]") if (!defined $str);
$res .= $str . ']\\\\.';
}
if ( defined $5 ) {
die sprintf( $msg, 'quad 3', $5) if ($5 ne '*' && $5 > 255);
$res .= ($5 eq '*' ? qq(\\.\\\\.) : qq(\\x{$5}\\\\.)) }
else {
$res .= '[';
my $str = parseIpRange( $6 );
die sprintf( $msg, 'quad 3', "\[$6\]") if (!defined $str);
$res .= $str . ']\\\\.';
}
if ( defined $7 ) {
die sprintf( $msg, 'quad 4', $7) if ($7 ne '*' && $7 > 255);
$res .= ($7 eq '*' ? qq(\\.) : qq(\\x{$7})) }
else {
$res .= '[';
my $str = parseIpRange( $8 );
die sprintf( $msg, 'quad 4', "\[$8\]") if (!defined $str);
$res .= $str . ']';
}
if ( defined $9 ) {
die sprintf( $msg, 'quad 1', $9) if ($9 ne '*' && $9 > 65535);
$res .= qq(\\\\ :\\\\ );
$res .= ($9 eq '*' ? qq(\\.) : qq(\\x{$9}));
}
elsif ( defined $10 ) {
$res .= qq(\\\\ :\\\\ [);
my $str = parsePortRange( $10 );
die sprintf( $msg, 'port', "\[$10\]") if (!defined $str);
$res .= $str . ']';
}
if ( $show_UIpRegex ) {
print $res,"\n\n";
}
eval "\$ip = \"$res\" ";
if ($@) { warn $@; return '' }
return qr/$ip/x;
}
# not the correct form
die sprintf( $msg, 'general format', $ip);
return undef;
}
## Range-parses individual IP quad part
#
sub parseIpRange
{
my ($class_string) = @_;
BEGIN { $rx_IpRange = qr/
^ \s* (?: (\d{1,3}) | (\d{1,3})\s* - \s* (\d{1,3}) ) \s*
$ /x;
}
my @rangevals = split /,/, $class_string;
my $res = '';
for my $val ( @rangevals ) {
if ( $val =~ /$rx_IpRange/ ) {
if ( defined $1 ) {
return undef if ($1 > 255); # bad
$res .= qq(\\x{$1})
}
else {
return undef if ($2 > 255 || $3 > 255); # bad
$res .= qq(\\x{$2}-\\x{$3})
}
}
else { return undef } # bad
}
return $res;
}
## Range-parses the IP port
#
sub parsePortRange
{
my ($class_string) = @_;
BEGIN { $rx_PortRange = qr/
^ \s* (?: (\d{1,5}) | (\d{1,5})\s* - \s* (\d{1,5}) ) \s*
$ /x;
}
my @rangevals = split /,/, $class_string;
my $res = '';
for my $val ( @rangevals ) {
if ( $val =~ /$rx_PortRange/ ) {
if ( defined $1 ) {
return undef if ($1 > 65535); # bad
$res .= qq(\\x{$1})
}
else {
return undef if ($2 > 65535 || $3 > 65535); # bad
$res .= qq(\\x{$2}-\\x{$3})
}
}
else { return undef } # bad
}
return $res;
}
__END__
------------------------------
Date: Mon, 13 Dec 2010 16:45:16 +0600
From: Michael <proximum@invalid.com>
Subject: Using module for different operating systems
Message-Id: <ie4tft$ht$1@news.eternal-september.org>
I have a crossplatform script, which requires the utf8 module for Linux
version. Windows version don't need this module (I/O is wrong when it is
present). How to restrict appearing of this module to Lunix version
without deleting this string every time when it's necessary?
"use utf8 if $^O eq 'linux' " does not work.
------------------------------
Date: Mon, 13 Dec 2010 03:28:58 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Using module for different operating systems
Message-Id: <nd0cg65ht1134bfe24j8sr5nlpsaqcrrn6@4ax.com>
Michael <proximum@invalid.com> wrote:
>I have a crossplatform script, which requires the utf8 module for Linux
>version. Windows version don't need this module (I/O is wrong when it is
>present). How to restrict appearing of this module to Lunix version
>without deleting this string every time when it's necessary?
>"use utf8 if $^O eq 'linux' " does not work.
perldoc -f use:
[...]. It is exactly equivalent to
BEGIN { require Module; Module->import( LIST ); }
[...]
In other words: 'use' is executed at compile time, long before the "if"
would ever make a difference.
So don't use use() but instead require() directly to load the module at
runtime.
jue
------------------------------
Date: Mon, 13 Dec 2010 12:27:37 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Using module for different operating systems
Message-Id: <slrnigc0p9.4fb.hjp-usenet2@hrunkner.hjp.at>
On 2010-12-13 10:45, Michael <proximum@invalid.com> wrote:
> I have a crossplatform script, which requires the utf8 module for Linux
> version. Windows version don't need this module (I/O is wrong when it is
> present).
The UTF-8 pragma doesn't affect I/O, it only says that the source code
is encoded in UTF-8. So you are probably barking up the wrong tree here.
If a script using the utf8 pragma behaves differently on Linux and
Windows you probably have converted it from one encoding to another
when you transferred the script from one OS to the other. Make sure that
the script is UTF-8-encoded on both systems.
It is also possible that you made a different mistake (possibly a wrong
encoding on I/O) which doesn't have anything to do with the utf8 macro
directly but which is masked by a (probably erroneous) use of the utf8
macro. This is hard to guess, though, we would need to see a minimal
script which demonstrates the behaviour.
> How to restrict appearing of this module to Lunix version
> without deleting this string every time when it's necessary?
> "use utf8 if $^O eq 'linux' " does not work.
I won't answer that because I think that isn't the problem and I prefer
solving the real problem instead of patching over the symptoms.
hp
------------------------------
Date: Sun, 12 Dec 2010 12:47:21 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Variable Question Dec. 12, 2010
Message-Id: <2vCdnZgokY81hZjQnZ2dnUVZ_uGdnZ2d@earthlink.com>
"Tad McClellan" <tadmc@seesig.invalid> wrote in message
news:slrnig9sqc.g2a.tadmc@tadbox.sbcglobal.net...
> my $startupword = $ARGV[0];
> or
> my $startupword = shift;
Both worked . Thanks.
------------------------------
Date: Sun, 12 Dec 2010 12:48:15 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Variable Question Dec. 12, 2010
Message-Id: <QZadnS-m2d1AhZjQnZ2dnUVZ_v6dnZ2d@earthlink.com>
"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in message
news:slrnig9sao.51j.hjp-usenet2@hrunkner.hjp.at...
> perldoc perlvar
>
> Search for @ARGV
That helped. Thanks.
------------------------------
Date: Mon, 13 Dec 2010 21:00:43 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Who will win the battle for control of the web?
Message-Id: <slrnigcurc.81v.hjp-usenet2@hrunkner.hjp.at>
On 2010-12-09 21:40, ccc31807 <cartercc@gmail.com> wrote:
> I agree with almost everything you say. I think the POV of the article
> was not server side vs. client side, or open vs proprietary, or
> applications vs operating systems, or traditional computers vs
> internet appliances. I think the POV of the article was providing
> users (what has been called) a 'rich internet experience.'
Users see only the client. For them the browser is the internet.
> On Dec 9, 2:22 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
>> That article is exclusively about the client side.
>
> In a sense, but it also considers iOS and Andriod, which are operating
> systems,
They are operating systems for a specific class of client devices. You
may or may not be able to run Perl on them (probably not on iOS, which
is very much a "walled garden"; possibly on Android, which is much more
open, although porting perl to Android might be a challenge; I do have
perl on my phone, BTW, but I admit that I don't quite know what to do
with it).
> and the .NET platform, which allows development of
> applications in the traditional manner.
Yes, but the focus was on Silverlight. Reusability of components of and
for "native" Windows applications was mentioned as an additional bonus
(an important one, though - the Windows software market is huge).
I do expect HTML5/JavaScript to break into the "native application"
market.
> It also doesn't mention Java, or the Adobe AIR, which I thought a
> little curious.
I'm not much surprised about Java. After the hype of the 1990s, Java
applets have mostly vanished. There are a few niches where it is still
very common (e.g. configuration and remote management interfaces), but
apart from that it is mostly server-side now.
Adobe AIR "enables ... to build web applications that run as standalone
client applications without the constraints of a browser". As such it
probably wasn't on the topic of the article which concentrated on web
clients (with the somewhat curious exception of iOS/Android apps, but
those share some characteristics of web apps, especially the easy
access).
>> And Perl (on the server side) plays nicely with HTML5 (on the client
>> side), so the answer for Perl programmers is to learn JavaScript (if
>> they don't know it already) and write hybrid Perl/JavaScript
>> applications.
>
> Where does this leave Perl for the iPhone, iPad, etc.?
In the cloud. You run your Perl programs in the cloud (well, for most
services a single server will be enough, but it might even be cheaper to
rent 0.02 CPUs) and provide a web interface or an App as the UI.
> I read another article in the last couple of days that speculated that
> the era of the 'personal computer' was over. I think that rather than
> consolidating, the technologies are fragmenting. After all, we still
> have mainframes, and people still write COBOL, along with Objective-C,
> and all the Android apps.
Yes. And that's one reason why I'm not particularly worried about the
future of Perl. It won't ever be the one language that binds them all
(it never was, all the talk about the "glue of the internet"
notwithstanding), but neither will it vanish. The very fragmentation and
heterogeneity of the landscape will provide places where it is the best
solution. And if you are only talking to the rest of your environment
via TCP anyway, the language has little impact on compatibility (I'm
writing my part of a major application in Perl, my colleague is writing
his in Java. Somebody else is writing a component in C# ...)
>> Nobody would write a browser plugin or an operating system in Perl. Perl
>> isn't a systems programming language. Although I think Flash would hang
>> my browser less frequently if it was written in Perl :-).
>
> Perl brings things to the table that other languages lack.
True. And other languages have features which Perl lacks. It depends on
the problem (and the programmer) which language is best suited for the
task. Perl is well suited for an awfully wide range and I admit I've
become lazy and implemented almost everything in Perl in recent years.
> Specifically, I think Flash is over used and over abused.
I see Flash almost exclusively used for movies (because it's the only
movie player that 99% of the clients have installed) and for advertisements
(including annoying "intros" for websites). Sometimes for games. Very
rarely for whole websites where HTML/JavaScript would have been more
appropriate. But I can't think of a single example which I would call an
application.
> People who know Flash think in can do anything and everything, and I
> know some owners/stakeholders who insist on using Flash for
> everything. Considering all the different kinds of jobs, I believe
> that Perl has a lot more capability than Flash, but Flash gets a lot
> more press.
That's because Flash is flashy (pun intended). Perl does its job quietly
on the server side and you don't see it. Can you tell that
http://www.delicious.com/ or http://www.lacunaexpanse.com/ are written
in Perl? Can you tell that http://gmail.com isn't written in Perl?
Unless that stuff crashes and you see an error message, you can't. Also,
Adobe has a PR budget and pays the press to write about their products.
Perl doesn't (neither does PHP or Python or Ruby, BTW).
>> All the stuff the article is about is on the client. If Perl doesn't
>> have a place on the client (I agree with that) then there simply isn't
>> any competition between Perl and these technologies.
>
> Perl doesn't have a place on the client, but the work product of Perl
> surely does.
That's what I'm saying. There isn't any competition between client-side
technologies and Perl. You can combine both.
>> Doesn't make sense since none of the technologies considered in the
>> article include a server or database part.
>
> Part of the Rich Internet Applications consist content, think Amazon,
> eBay, Facebook, even Target, WalMart, and L.L.Bean. You are right,
> except all the eye candy without content is meaningless.
Why "except". Exactly *because* eye candy without content is
meaningless, you still need something on the server side. And that can
be perl (or one of a hundred other languages).
>> What you would do is combine one of the technologies considered in the
>> article (HTML5, most likely) with Perl and a database and build an
>> application framework. Actually, I think quite a few people have already
>> done that - at least always hear the web programmers I know (those that
>> use Perl) about using Catalyst together with this or that Ajax
>> framework.
>
> I hope that the number of those belligerents fighting the battle for
> the control of the web will expand. I would hate to see a monoculture
> of technology in this area.
For the client side I hope that there will be some very few standards
(like HTML5) with lots of different implementations. Currently there are
3 major platforms (IE, Gecko, Webkit) and a few minor players (like
Opera). This is better than a few years ago. It probably won't get
better: HTML5 is hugely complex and the days where a small company could
write a browser within a few months are definitely over.
> I also think that the capabilities of Perl can be used to advantage.
We agree absolutely here.
hp
------------------------------
Date: Sun, 12 Dec 2010 21:58:29 +0100
From: Wolf Behrenhoff <nospampleasebutthisisvalid3@gmx.net>
Subject: Re: Windows Question Dec. 12, 2010
Message-Id: <4d053775$0$6986$9b4e6d93@newsspool4.arcor-online.net>
On 12.12.2010 15:43, E.D.G. wrote:
> Windows and ActiveState Perl are being used.
>
> When a Perl program is running, what code can be used to determine if a
> Windows program is also running such as Notepad?
For example, you could use Win32::FindWindow.
Wolf
------------------------------
Date: Sun, 12 Dec 2010 14:54:08 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Windows Question Dec. 12, 2010
Message-Id: <h1kag6hfkcves57iftgccmccn21bg6kqit@4ax.com>
Wolf Behrenhoff <nospampleasebutthisisvalid3@gmx.net> wrote:
>On 12.12.2010 15:43, E.D.G. wrote:
>> Windows and ActiveState Perl are being used.
>>
>> When a Perl program is running, what code can be used to determine if a
>> Windows program is also running such as Notepad?
>
>For example, you could use Win32::FindWindow.
Not really. FindWindow will return information about windows. But there
may be programs with multiple windows as well as programs with no window
at all.
A far more reliable way is to check the process table. Applicable
modules are readily available on CPAN.
jue
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 3234
***************************************