[25504] in Perl-Users-Digest
Perl-Users Digest, Issue: 7748 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 7 11:05:50 2005
Date: Mon, 7 Feb 2005 08:05:19 -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, 7 Feb 2005 Volume: 10 Number: 7748
Today's topics:
[OT] Re: Perl - permute? <1usa@llenroc.ude.invalid>
Re: Custom sort empties instead of sorting <groleau+news@freeshell.org>
Re: Custom sort empties instead of sorting <groleau+news@freeshell.org>
Re: Custom sort empties instead of sorting <1usa@llenroc.ude.invalid>
Re: Custom sort empties instead of sorting (Anno Siegel)
Re: Custom sort empties instead of sorting (Anno Siegel)
Re: explain "Larry expects that he'll be certified..." <d@adelphia.net>
greediness problem? (justme)
Re: greediness problem? <josef.moellers@fujitsu-siemens.com>
Re: greediness problem? <rasto@gmx.at>
Re: greediness problem? <vek@station02.ohout.pharmapartners.nl>
Re: greediness problem? <josef.moellers@fujitsu-siemens.com>
Re: greediness problem? <tadmc@augustmail.com>
memory for regex engine <admin@asarian-host.net>
Re: memory for regex engine <1usa@llenroc.ude.invalid>
nntp scan <geen@mail.invalid>
Re: nntp scan <spamtrap@dot-app.org>
Re: nntp scan <geen@mail.invalid>
Re: nntp scan <1usa@llenroc.ude.invalid>
Re: nntp scan <spamtrap@dot-app.org>
Re: Perl - permute? <do-not-use@invalid.net>
Perl Object Oriented Programming <larry_wallet@yahoo.com>
ptk_steal <JiggaHertz@nospam.com>
Re: Regular expression woes <joe@inwap.com>
Re: Regular expression woes <usereplytoinstead@innoline-systemtechnik.de>
Re: Why aren't 'warnings' on by default? <do-not-use@invalid.net>
Re: Why aren't 'warnings' on by default? (Peter Scott)
Re: Why C Is Not My Favourite Programming Language evolnet.regular@gmail.com
Re: Why C Is Not My Favourite Programming Language <Michael.Mair@invalid.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 07 Feb 2005 12:13:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: [OT] Re: Perl - permute?
Message-Id: <Xns95F6498FAE41Aasu1cornelledu@127.0.0.1>
Arndt Jonasson <do-not-use@invalid.net> wrote in
news:yzdacqg4q66.fsf@invalid.net:
> Sinan (what does the A stand for?)
A = Ali, my first name.
All my life, I was called by middle name. That caused some confusion when
I came to the U.S. where people typically use only their first and last
names. So, I got into the habit of using a first initial so that people
know that Sinan is not my first name. An imperfect solution, but at least
official correspondence sent to 'Ali Unur' does not cause a lot of
questions any more. :)
Sinan.
------------------------------
Date: Mon, 07 Feb 2005 00:10:39 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: Custom sort empties instead of sorting
Message-Id: <36obi3F50t1n4U1@individual.net>
Wes Groleau wrote:
> Anno Siegel wrote:
>> @Keys = ( 'HEAD', grep( $_ ne 'HEAD', grep $_ ne 'TRLR', @Keys),
>> 'TRLR');
>>
>> does what you want more directly, and in linear time.
And indeed, it worked. Still don't understand why the
other didn't, but ....
Thanks!
(By the way, what I _almost_ did was even more inefficient:
Save the HEAD and TRLR from the hash, delete them, print
the head, then all the values, then the trailer, then
reinsert the saved items.)
--
Wes Groleau
"There ain't nothin' in this world that's worth being a snot over."
-- Larry Wall
------------------------------
Date: Mon, 07 Feb 2005 00:16:21 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: Custom sort empties instead of sorting
Message-Id: <36obspF52p2duU1@individual.net>
Abigail wrote:
> Yeah, we won't help you, unless you're a golfer! ;-)
Neither golfer, nor flogger, nor blogger.
Just an invader from Ada-land [1] trying to use
the right tool [2] for the job.
[1] Does the following sound familiar?
"It's Ada, not ADA. How can you program in it
if you can't even spell it?"
[2] For this job, that would be a language with
built-in hashes and sophisticated pattern-matching.
--
Wes Groleau
http://freepages.rootsweb.com/~wgroleau/Wes
------------------------------
Date: Mon, 07 Feb 2005 05:21:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Custom sort empties instead of sorting
Message-Id: <Xns95F63B4C2C5Casu1cornelledu@127.0.0.1>
Wes Groleau <groleau+news@freeshell.org> wrote in news:36obspF52p2duU1
@individual.net:
> Abigail wrote:
>> Yeah, we won't help you, unless you're a golfer! ;-)
>
> Neither golfer, nor flogger, nor blogger.
>
> Just an invader from Ada-land [1] trying to use
> the right tool [2] for the job.
None of which is relevant. It is important that when you post here, you
post code that others can run. That's all.
Sinan
------------------------------
Date: 7 Feb 2005 11:32:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Custom sort empties instead of sorting
Message-Id: <cu7jk4$2ev$1@mamenchi.zrz.TU-Berlin.DE>
Wes Groleau <groleau+news@freeshell.org> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> > Gee, you're sorting an array, so the elements get shuffled about,
> > including undef's. The result is consistent with the data you're
> > giving, as far as I can see.
>
> No,
>
> 1. I said the array after sorting is EMPTY.
Okay, it shouldn't be empty, but you only mentioned "empty" in the
subject.
> Before sorting it had text in at least elements
> [0], [1], and [5] Since it did have one HEAD,
> I expected that to sort to [0]
You didn't mention specific content, only that some elements contain
"text". Yes, "HEAD" should end up in 0. It did for me when present.
> 2. Since the array is the keys of a hash, there
> can be at most _one_ undef, not three.
No. A hash key can *never* be undefined, it is always a string. Also,
you didn't say that 5 was supposed to be the last element in the array.
There could have been any number of undef's beyond that.
With an older Perl, before sort was stable, nothing could be said about
elements 0, 1 and 5 after the sort.
It would have been better if you had specified the array completely.
Anno
------------------------------
Date: 7 Feb 2005 11:37:25 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Custom sort empties instead of sorting
Message-Id: <cu7jtl$2ev$2@mamenchi.zrz.TU-Berlin.DE>
Wes Groleau <groleau+news@freeshell.org> wrote in comp.lang.perl.misc:
> Wes Groleau wrote:
> > Anno Siegel wrote:
> >> @Keys = ( 'HEAD', grep( $_ ne 'HEAD', grep $_ ne 'TRLR', @Keys),
> >> 'TRLR');
> >>
> >> does what you want more directly, and in linear time.
>
> And indeed, it worked. Still don't understand why the
> other didn't, but ....
>
> Thanks!
>
> (By the way, what I _almost_ did was even more inefficient:
> Save the HEAD and TRLR from the hash, delete them, print
> the head, then all the values, then the trailer, then
> reinsert the saved items.)
That's not so bad. It would also perform in linear time.
Anno
------------------------------
Date: Sun, 06 Feb 2005 23:23:06 -0800
From: DJO <d@adelphia.net>
Subject: Re: explain "Larry expects that he'll be certified..."
Message-Id: <BK-dnQYSg4ceiprfRVn-oA@adelphia.com>
Brandon Walsh wrote:
> Hi,
>
> I enjoy the tongue-in-cheek style of Perl documentation, but English
> is not my mother tongue, so i don't get all jokes.
>
> Can someone please explain this quote from perlfaq2: "Larry expects
> that he'll be certified before Perl is."
>
> What does the word "certified" means here?
There's an old expression from the 40's and earlier, "He's
certifiable!", which is short for saying "He is certifiably crazy!".
And in this case, 'certifiable' means that while we may suspect he is
crazy, a professional would probably certify that our suspicions are
correct.
My guess is that the POD you refer to is saying that Larry expects to be
declared (or certified) crazy by someone competant to do so, before Perl
is ever certified.
And in this context, there is a play on words going on. ...applying
"certified" to Larry means he (jokingly or otherwise) thinks he's nuts.
Applying "certified" to Perl is referring to some sort of
certification that holds weight in computerdom. ;)
And now I feel really rediculous for painstakingly explaining all the
humor out of what should be just an off the cuff joke.
------------------------------
Date: 7 Feb 2005 02:28:44 -0800
From: eight02645999@yahoo.com (justme)
Subject: greediness problem?
Message-Id: <c0837966.0502070228.2a08e737@posting.google.com>
hi
i have an initial string such as
$initial = "qqqqqqqq";
a user needs to input another string
$string =<STDIN>;
If this user were to key in exactly 8 q's then it will match and do
something.
But i have a problem when the user key in 5 or 6 q's, it will still
match, which i do not want.
how can i overcome this problem..?
thanks
------------------------------
Date: Mon, 07 Feb 2005 11:40:53 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: greediness problem?
Message-Id: <cu7ggs$a0f$1@nntp.fujitsu-siemens.com>
justme wrote:
> hi
>=20
> i have an initial string such as=20
> $initial =3D "qqqqqqqq";
> a user needs to input another string=20
> $string =3D<STDIN>;
> If this user were to key in exactly 8 q's then it will match and do
> something.
> But i have a problem when the user key in 5 or 6 q's, it will still
> match, which i do not want.
> how can i overcome this problem..?
How did you attempt to solve this in the first case?
the re /q{8}/ would match exactly 8 q's, not 5 nor 6 nor 7, exactly 8,=20
nor does it match 9, 10, 11 or any above that, exactly 8 which is the=20
holy number (thanks to Monty Python),
Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Mon, 07 Feb 2005 11:48:37 +0100
From: Rasto Levrinc <rasto@gmx.at>
Subject: Re: greediness problem?
Message-Id: <42074681$0$11352$3b214f66@tunews.univie.ac.at>
Josef Moellers wrote:
>
> How did you attempt to solve this in the first case?
> the re /q{8}/ would match exactly 8 q's, not 5 nor 6 nor 7, exactly 8,
> nor does it match 9, 10, 11 or any above that, exactly 8 which is the
> holy number (thanks to Monty Python),
>
> Josef
Actually /q{8}/ would match 9, 10, 11 q's.
/^q{8}$/ would work better.
Rasto
--
Rasto Levrinc
http://sourceforge.net/projects/rlocate/
------------------------------
Date: 07 Feb 2005 11:11:05 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: greediness problem?
Message-Id: <slrnd0ej69.10m.vek@station02.ohout.pharmapartners.nl>
On Mon, 07 Feb 2005 11:48:37 +0100,
Rasto Levrinc <rasto@gmx.at> wrote:
> Josef Moellers wrote:
>
>>
>> How did you attempt to solve this in the first case?
>> the re /q{8}/ would match exactly 8 q's, not 5 nor 6 nor 7, exactly 8,
>> nor does it match 9, 10, 11 or any above that, exactly 8 which is the
>> holy number (thanks to Monty Python),
>>
>> Josef
>
> Actually /q{8}/ would match 9, 10, 11 q's.
> /^q{8}$/ would work better.
>
It would match the first 8 of the q's. It does make a difference if the
RE is part of a s/// construction.
A simple string comparison would work just as well, wouldn't it?
Villy
------------------------------
Date: Mon, 07 Feb 2005 12:59:39 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: greediness problem?
Message-Id: <cu7l3s$3u5$1@nntp.fujitsu-siemens.com>
Rasto Levrinc wrote:
> Josef Moellers wrote:
>=20
>>
>> How did you attempt to solve this in the first case?
>> the re /q{8}/ would match exactly 8 q's, not 5 nor 6 nor 7, exactly 8,=
=20
>> nor does it match 9, 10, 11 or any above that, exactly 8 which is the =
>> holy number (thanks to Monty Python),
>>
>> Josef
>=20
>=20
> Actually /q{8}/ would match 9, 10, 11 q's.
> /^q{8}$/ would work better.
Hm ... nitpicking: q{8} matches 8 q's, leaving the remaining q's unmatche=
d.
But ... you're absolutely right: the intended message that q{8} would=20
match _exactly_ 8 q's and fail on 9 or more is wrong.
Thanks,
Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Mon, 7 Feb 2005 07:48:38 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: greediness problem?
Message-Id: <slrnd0esdm.r0g.tadmc@magna.augustmail.com>
justme <eight02645999@yahoo.com> wrote:
> i have an initial string such as
> $initial = "qqqqqqqq";
> a user needs to input another string
> $string =<STDIN>;
> If this user were to key in exactly 8 q's then it will match and do
^^^^^^^^^^^^^
> something.
Perl has an operator for testing string equality, its name is "eq".
> But i have a problem when the user key in 5 or 6 q's, it will still
> match, which i do not want.
Then there must be something wrong with your code.
> how can i overcome this problem..?
By fixing your code.
We cannot help you fix your code because we cannot see your code...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 7 Feb 2005 06:33:13 +0100
From: "Mark" <admin@asarian-host.net>
Subject: memory for regex engine
Message-Id: <qaWdneFChqwUYJvfRVnyhw@giganews.com>
Hello,
Running FreeBSD 4.10, can someone tell me how to increase the memory for
the regex engine on Perl 5.8.5? I have a process with some extremely
complex regex-es, working on some extremely long strings (about 40MB). If
the string size becomes too large, Perl seems to hang (stuck in R =
runnable process).
Apart from the optimizations I could make in the regex-es, still, it
bothers me Perl may hang this way. Is there a way I can increase the
memory for the regex engine? I have 1.5 G of physical memory. Could this
perhaps be related to the OS 'datasize' limit (set to 512 MB here)? Perl
does not throw an error, actually.
I appreciate any suggestions,
- Mark
------------------------------
Date: Mon, 07 Feb 2005 06:40:50 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: memory for regex engine
Message-Id: <Xns95F6112445A76asu1cornelledu@127.0.0.1>
"Mark" <admin@asarian-host.net> wrote in
news:qaWdneFChqwUYJvfRVnyhw@giganews.com:
> Hello,
>
> Running FreeBSD 4.10, can someone tell me how to increase the memory
> for the regex engine on Perl 5.8.5? I have a process with some
> extremely complex regex-es, working on some extremely long strings
> (about 40MB). If the string size becomes too large, Perl seems to hang
> (stuck in R = runnable process).
>
> Apart from the optimizations I could make in the regex-es, still, it
> bothers me Perl may hang this way. Is there a way I can increase the
> memory for the regex engine? I have 1.5 G of physical memory. Could
> this perhaps be related to the OS 'datasize' limit (set to 512 MB
> here)? Perl does not throw an error, actually.
I am not too sure memory is the problem here. It is possible that the time
it takes for the regex to complete might be increasing exponentially in
data size (or maybe becoming infinite). This depends on the actual regex
(and the input). Others who actually know about these things (not me :)
might be able to comment if you actually posted the regex your are using.
Sinan.
------------------------------
Date: Mon, 07 Feb 2005 15:51:33 +0100
From: ruud <geen@mail.invalid>
Subject: nntp scan
Message-Id: <cu7va8$kn1$1@box.nl-netwerken.com>
I'm trying to write a mini stats script.
So the first thing to do is to collect the posters names:
#! /usr/bin/perl -w
use News::Scan;
my $HOME = $ENV{HOME} || '/';
my $scan = new News::Scan Group => 'nieuws.test',
Spool => "$HOME/nieuws",
From => 'nntp',
NNTPServer => 'news.nl-netwerken.com';
if (not defined $scan) {
die "Failed to create News::Group object\n";
}
elsif ($scan->error) {
die "Error: " . $scan->error . "\n";
}
##$scan->collect;
$scan->posters;
if ($scan->error) {
die "Error: " . $scan->error . "\n";
}
my $posters = $scan->posters;
print "$posters\n";
exit;
But when i run the script, it only returns this:
[ruud@localhost ruud]$ ./scan
HASH(0xa145268)
As you can see, no names.
What am i doing wrong here ?
--
Gr. Ruud
news://news.nl-netwerken.com
------------------------------
Date: Mon, 07 Feb 2005 10:07:32 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: nntp scan
Message-Id: <jeCdnVIWFMGrGZrfRVn-rg@adelphia.com>
ruud wrote:
> my $posters = $scan->posters;
> print "$posters\n";
>
> exit;
>
> But when i run the script, it only returns this:
> [ruud@localhost ruud]$ ./scan
> HASH(0xa145268)
>
> As you can see, no names.
> What am i doing wrong here ?
The very first line of the documentation for the posters() method states
that it returns a hash reference. As the output shows, that's what you got.
Why do you think something's wrong?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Mon, 07 Feb 2005 16:14:09 +0100
From: ruud <geen@mail.invalid>
Subject: Re: nntp scan
Message-Id: <cu80kj$kn1$3@box.nl-netwerken.com>
Sherm Pendley wrote:
>> HASH(0xa145268)
>>
>> As you can see, no names.
>> What am i doing wrong here ?
>
> The very first line of the documentation for the posters() method states
> that it returns a hash reference. As the output shows, that's what you
> got. Why do you think something's wrong?
Hmm, i was expecting real human readeble names.
Back to the drawingboard :-)
--
Gr. Ruud
news://news.nl-netwerken.com
------------------------------
Date: 7 Feb 2005 15:37:59 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: nntp scan
Message-Id: <Xns95F66C2ACF76Aasu1cornelledu@132.236.56.8>
ruud <geen@mail.invalid> wrote in
news:cu80kj$kn1$3@box.nl-netwerken.com:
> Sherm Pendley wrote:
>
>>> HASH(0xa145268)
>>>
>>> As you can see, no names.
>>> What am i doing wrong here ?
>>
>> The very first line of the documentation for the posters() method
>> states that it returns a hash reference. As the output shows, that's
>> what you got. Why do you think something's wrong?
>
> Hmm, i was expecting real human readeble names.
> Back to the drawingboard :-)
Do you even know what a hash reference is, or if you don't, did you even
bother to look it up before posting here?
Please do read the posting guidelines posted here regularly. Those
guidelines serve to:
1. Help you diagnose and solve your own problems
2. Failing that, help others help you
Try to see what is in the hash:
use Data::Dumper;
print Dumper $scan->posters;
perldoc -f keys
perldoc -f values
perldoc -f each
perldoc Data::Dumper
Sinan
------------------------------
Date: Mon, 07 Feb 2005 10:41:59 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: nntp scan
Message-Id: <3tWdnfWtDdPaEZrfRVn-1w@adelphia.com>
ruud wrote:
> Hmm, i was expecting real human readeble names.
The docs for the poster() method clearly state that poster() returns a
reference to a hash, whose keys are email addresses and values are
News::Scan::Poster objects.
Why would you expect a method to return something other than what the docs
say it will return???
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 07 Feb 2005 11:31:29 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Perl - permute?
Message-Id: <yzdacqg4q66.fsf@invalid.net>
John Bokma <postmaster@castleamber.com> writes:
> A. Sinan Unur wrote:
>
> > John Bokma <postmaster@castleamber.com> wrote in
> > news:Xns95F5B75BF8DA1castleamber@130.133.1.4:
> >
> >> A. Sinan Unur wrote:
I think that instead of spending time arguing with Sinan (what does
the A stand for?), it would have been more helpful to answer the
original poster, if you think there was something missing in the
answers he got.
Besides, showing the existence of CPAN _is_ helping, even if you point
at the wrong module.
------------------------------
Date: 7 Feb 2005 08:00:25 -0800
From: "Larry" <larry_wallet@yahoo.com>
Subject: Perl Object Oriented Programming
Message-Id: <1107792025.365859.270690@f14g2000cwb.googlegroups.com>
I would like to thank the O'Reilly publishing company and their
wonderful Perl authors for providing some of the greatest bathroom
literature ever written. A hot cup of coffee, a croissant, and a good
O'Reilly Perl book really get me going in the morning. I would tell
you my favorite, but they are all so good. Maybe the Cookbook, but it
is a bit bulky to balance on the knees.
------------------------------
Date: Mon, 07 Feb 2005 10:03:47 -0500
From: JiggaHertz <JiggaHertz@nospam.com>
Subject: ptk_steal
Message-Id: <nrLNd.83$cr2.71@llnews.ll.mit.edu>
I'm trying to use the ptk_steal script that I found on the
comp.lang.perl.tk group and I'm getting 2 individual windows instead of
an xterm inside of a tk frame. Here's the output of xwininfo for those
windows:
# xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x1c0000d "WindowToSteal"
Absolute upper-left X: 270
Absolute upper-left Y: 270
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 499
Height: 316
Depth: 8
Visual Class: PseudoColor
Border width: 0
Class: InputOutput
Colormap: 0x34 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +270+270 -831+270 -831-614 +270-614
-geometry 80x24+264+240
# xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x1b80004 "Ptk_steal"
Absolute upper-left X: 16
Absolute upper-left Y: 40
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 96
Height: 21
Depth: 8
Visual Class: PseudoColor
Border width: 0
Class: InputOutput
Colormap: 0x34 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +16+40 -1488+40 -1488-1139 +16-1139
-geometry 96x21+10+10
I've verified that the window id from the xterm "WindowToSteal" is
correct. I included the ptk_steal.pl script as reference. Any help
would be greatly appreciated.
Thanks,
JH
==================================================================
#!/usr/bin/perl
# $Id: ptk_steal.pl,v 1.1 1999/07/01 19:56:31 eserte Exp $
# Author: Slaven Rezic
# Copyright (C) 1999 Slaven Rezic. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
# Mail: ese...@cs.tu-berlin.de
# WWW: http://user.cs.tu-berlin.de/~eserte/#
use Tk;
use X11::Protocol;
$x = X11::Protocol->new();
$top = MainWindow->new;
system("xterm -name WindowToSteal &");
$check = $top->repeat(
50,
sub {
$wid = get_window_by_name("WindowToSteal");
}
);
while ( !defined $wid ) {
$top->waitVariable( \$wid );
}
$check->cancel;
warn sprintf("Window id: %x\n", $wid);
$top->geometry("+10+10");
$top->Label( -text => "A xterm:" )->pack;
if ( $Tk::VERSION >= 800 ) {
$f = $top->Frame( '-container' => 1 )->pack;
}
else {
$f = $top->Frame( -width => 500, -height => 400 )->pack;
}
warn sprintf("Resized main frame\n");
$f->update;
warn sprintf("Updated main frame\n");
$test = $x->ReparentWindow( $wid, oct( $f->id ), 0, 0 );
$x->MapWindow($wid);
warn sprintf("Reparent Window done\n");
warn sprintf("test = $test\n");
sub get_window_by_name {
_get_window_by_name( $x->{'root'}, $_[0] );
}
sub _get_window_by_name {
my ( $root, $searchname ) = @_;
my ( $dummy, $dummy2, @new_kids ) = $x->QueryTree($root);
foreach my $k (@new_kids) {
my $atomnr;
#warn sprintf("%x\n", $k);
foreach my $atom ( $x->ListProperties($k) ) {
if ( $x->GetAtomName($atom) eq "WM_CLASS" ) {
$atomnr = $atom;
last;
}
}
if ( defined $atomnr ) {
my ($classprop) =
$x->GetProperty( $k, $atomnr, "AnyPropertyType", 0, 256, 0
);
my ( $class, $name ) = split( /\0/, $classprop );
if ( $class eq $searchname ) {
return $k;
}
}
my $ret = _get_window_by_name( $k, $searchname );
if ( defined $ret ) {
return $ret;
}
}
undef;
}
MainLoop;
__END__
------------------------------
Date: Sun, 06 Feb 2005 21:24:44 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Regular expression woes
Message-Id: <4KydncPm4rI9ZpvfRVn-qg@comcast.com>
Mark (News) wrote:
> "Why do people insist on doing things the hardest way possible."? Well,
> as I said in an earlier post, I wanted to do the whole thing within a
> regex rather than resorting to the shell.
OK, but that doesn't answer the question. The statement
if (!/^http/i.test(some_string)) { ... }
does not resort to using the shell, and therefore is acceptable,
is it not?
Doing it with a regex + some simple programming is not the same
as resorting to the shell. So, what are your actual requirements?
-Joe
------------------------------
Date: Mon, 7 Feb 2005 11:02:29 +0100
From: "Dietmar Meier" <usereplytoinstead@innoline-systemtechnik.de>
Subject: Re: Regular expression woes
Message-Id: <36osmnF535lbeU1@individual.net>
Grant Wagner wrote:
> Why do people insist on doing things the hardest way possible.
I don't insist on nothing. Mark announced this as a brainteaser,
nobody is actually expected to use this in a real script.
ciao, dhgm
------------------------------
Date: 07 Feb 2005 13:55:41 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <yzd65144jhu.fsf@invalid.net>
Abigail <abigail@abigail.nl> writes:
> Hendrik Maryns (hendrik_maryns@despammed.com) wrote on MMMMCLXXVII
> September MCMXCIII in <URL:news:xaydnaJhoYE2PZvfRVnyhg@scarlet.biz>:
> }} Abigail schreef:
> }} <something very important>
> }}
> }} <-- >
> }} A perl rose: perl -e '@}>-`-,-`-%-'
> }}
> }} This doesn't do anything for me?
>
>
> Do roses ever do something for you? ;-)
They smell nicely, sometimes.
--
perl -le "print 'Just ','another ','Perl ','hacker'^' '^'&\$4),7'"
------------------------------
Date: Mon, 07 Feb 2005 15:26:16 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <sMLNd.313044$6l.216332@pd7tw2no>
In article <slrnd0chjc.g2.abigail@alexandra.abigail.nl>,
Abigail <abigail@abigail.nl> writes:
>Joachim Pense (spam-collector@pense-online.de) wrote on MMMMCLXXVII
>September MCMXCIII in <URL:news:u20nstbq1jo2$.1xmk3cqpwqt24$.dlg@40tude.net>:
>() I do not think a one-letter no-warnings option would really hurt.
>
>Well, it seems that people think a one-letter warnings option does hurt.
>So, by that token, a one-letter no-warning would hurt as well.
It's quite reasonable to suppose that -e would disable implicit
warnings.
--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
------------------------------
Date: 7 Feb 2005 06:55:21 -0800
From: evolnet.regular@gmail.com
Subject: Re: Why C Is Not My Favourite Programming Language
Message-Id: <1107788121.962928.52980@o13g2000cwo.googlegroups.com>
Michael Mair wrote:
> Kenny McCormack wrote:
> > In article <1107768822.687564.184360@f14g2000cwb.googlegroups.com>,
> > <tomstdenis@gmail.com> wrote:
> > When you make this statement, you are ignoring the human factor.
> > For a programmer of middling ability, it is quite likely that their
Perl
> > programs will run as fast or faster than their C programs. (You do
the
> > math...)
>
> Yep. I remember that for some early perl 5 version, perl beat grep...
> don't know whether this still holds.
> Apart from that, when dealing with problems perl and Python have been
> created for, you usually save enough development time for very many
> runs of the program.
> Nearly on-topic: "Linkers and Loaders" lets you, AFAIR, write your
> own linker in perl as an exercise -- even if done very well, it
> definitely cannot beat a good C version for speed.
The initialisation time of a Perl or Python "interpreter" does mean
that, say, a Hello World written in C will run faster. However, for any
kind of enterprise-level applications, the greatly reduced devel time
needed to develop in Perl or Python greatly outweighs the marginal
once-only cost of interpretation and bytecode compilation.
------------------------------
Date: Mon, 07 Feb 2005 16:07:40 +0100
From: Michael Mair <Michael.Mair@invalid.invalid>
Subject: Re: Why C Is Not My Favourite Programming Language
Message-Id: <36pehtF55a2b8U1@individual.net>
evolnet.regular@gmail.com wrote:
> Michael Mair wrote:
>
>>Kenny McCormack wrote:
>>
>>>In article <1107768822.687564.184360@f14g2000cwb.googlegroups.com>,
>>> <tomstdenis@gmail.com> wrote:
>>>When you make this statement, you are ignoring the human factor.
>>>For a programmer of middling ability, it is quite likely that their
>
> Perl
>
>>>programs will run as fast or faster than their C programs. (You do
>
> the
>
>>>math...)
>>
>>Yep. I remember that for some early perl 5 version, perl beat grep...
>>don't know whether this still holds.
>>Apart from that, when dealing with problems perl and Python have been
>>created for, you usually save enough development time for very many
>>runs of the program.
>>Nearly on-topic: "Linkers and Loaders" lets you, AFAIR, write your
>>own linker in perl as an exercise -- even if done very well, it
>>definitely cannot beat a good C version for speed.
>
> The initialisation time of a Perl or Python "interpreter" does mean
> that, say, a Hello World written in C will run faster. However, for any
> kind of enterprise-level applications, the greatly reduced devel time
> needed to develop in Perl or Python greatly outweighs the marginal
> once-only cost of interpretation and bytecode compilation.
So which essentially new thing did you say apart from drawing in
c.l.p.m?
It is bad style at best to crosspost to a new group in middiscussion
and not say so.
@comp.lang.perl.misc: "evolnet.regular@gmail.com" is playing the troll
in c.l.c; please do not react to his posts.
F'up2: c.l.c
Cheers
Michael
--
E-Mail: Mine is a gmx dot de address.
------------------------------
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:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#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 V10 Issue 7748
***************************************