[31540] in Perl-Users-Digest
Perl-Users Digest, Issue: 2799 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 1 18:09:26 2010
Date: Mon, 1 Feb 2010 15:09:08 -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, 1 Feb 2010 Volume: 11 Number: 2799
Today's topics:
libxml <fgnowfg@gmail.com>
Re: libxml <fgnowfg@gmail.com>
Re: libxml <dmw@coder.cl>
Re: libxml <fgnowfg@gmail.com>
Re: libxml <tadmc@seesig.invalid>
Re: libxml <fgnowfg@gmail.com>
Re: libxml <tadmc@seesig.invalid>
Perl regexp to match any Chinese characters. <hongyi.zhao@gmail.com>
Re: Perl regexp to match any Chinese characters. <hjp-usenet2@hjp.at>
Re: Perl regexp to match any Chinese characters. sln@netherlands.com
SSL read timeout <spamtotrash@toomuchfiction.com>
Re: steps <smallpond@juno.com>
Re: steps <robin1@cnsp.com>
Re: steps <robin1@cnsp.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 31 Jan 2010 11:58:01 -0800 (PST)
From: Faith Greenwood <fgnowfg@gmail.com>
Subject: libxml
Message-Id: <c3209a17-5d79-40d2-9885-57f9afcb19c1@15g2000vbg.googlegroups.com>
How do I return multiple nodes in an xpath search using LibXML? I have
the following xml:
<entry>
<set>
<nodeA>A</nodeA>
<book><name>Near Dead</name><date>1992</date></book>
<page>1262</page>
</set>
<set>
<nodeA>A</nodeA>
<book><name>Alive and Well</name><date>1973</date></book>
<page></page>
</set>
<set>
<nodeA>A</nodeA>
<book><name>Still Kicking</name><date>1968</date></book>
<page>1598</page>
</set>
</entry>
Here is my perl:
my $parser=XML::LibXML->new();
my $doc=$parser->parse_file("xml.xml");
my @array;
my $search="//entry/set[nodeA/text()='A']/page/text()";
push(@array,$_->data) for ($doc->findnodes($search));
print "@array\n";
#######
When I print out @array, I get "1262 1598", as expected. The problem
is I don't know the book that 1598 belongs to. Does 1598 belong to
"Still Kicking" or "Alive and Well"? Further, I need to keep track of
the page AND the date AND the author, without mixing any of them up.
If I do 2 diff. searches for the page and dates and push those into 2
separate arrays, obviously I won't be able to use them in the correct
order.
Does anyone have any suggestions?
thx!
------------------------------
Date: Sun, 31 Jan 2010 12:05:07 -0800 (PST)
From: Faith Greenwood <fgnowfg@gmail.com>
Subject: Re: libxml
Message-Id: <bfaf2083-8744-445d-89bc-44e1df8ad4fd@a13g2000vbf.googlegroups.com>
On Jan 31, 2:58=A0pm, Faith Greenwood <fgno...@gmail.com> wrote:
> How do I return multiple nodes in an xpath search using LibXML? I have
> the following xml:
>
> <entry>
> <set>
> <nodeA>A</nodeA>
> <book><name>Near Dead</name><date>1992</date></book>
> <page>1262</page>
> </set>
>
> <set>
> <nodeA>A</nodeA>
> <book><name>Alive and Well</name><date>1973</date></book>
> <page></page>
> </set>
>
> <set>
> <nodeA>A</nodeA>
> <book><name>Still Kicking</name><date>1968</date></book>
> <page>1598</page>
> </set>
> </entry>
>
> Here is my perl:
>
> my $parser=3DXML::LibXML->new();
> my $doc=3D$parser->parse_file("xml.xml");
> my @array;
> my $search=3D"//entry/set[nodeA/text()=3D'A']/page/text()";
> push(@array,$_->data) for ($doc->findnodes($search));
> print "@array\n";
> #######
> When I print out @array, I get "1262 1598", as expected. The problem
> is I don't know the book that 1598 belongs to. Does 1598 belong to
> "Still Kicking" or "Alive and Well"? Further, I need to keep track of
> the page AND the date AND the author, without mixing any of them up.
> If I do 2 diff. searches for the page and dates and push those into 2
> separate arrays, obviously I won't be able to use them in the correct
> order.
>
> Does anyone have any suggestions?
>
> thx!
I should also mention that this is only a small subset of the xml I am
dealing with. There are many page nodes that have the same page number
(different book) and many date notes that have the same date. Simply
searching on "1598" would return many books and wouldn't do me any
good. thanks again!
------------------------------
Date: Sun, 31 Jan 2010 18:18:50 -0300
From: Daniel Molina Wegener <dmw@coder.cl>
Subject: Re: libxml
Message-Id: <1724460.steIRJj7qd@nntp.coder.cl>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA512
On Dom 31 Ene 2010 16:58,
Faith Greenwood wrote:
> How do I return multiple nodes in an xpath search using LibXML? I have
> the following xml:
>
> <entry>
> <set>
> <nodeA>A</nodeA>
> <book><name>Near Dead</name><date>1992</date></book>
> <page>1262</page>
> </set>
>
> <set>
> <nodeA>A</nodeA>
> <book><name>Alive and Well</name><date>1973</date></book>
> <page></page>
> </set>
>
> <set>
> <nodeA>A</nodeA>
> <book><name>Still Kicking</name><date>1968</date></book>
> <page>1598</page>
> </set>
> </entry>
>
>
> Here is my perl:
>
> my $parser=XML::LibXML->new();
> my $doc=$parser->parse_file("xml.xml");
> my @array;
> my $search="//entry/set[nodeA/text()='A']/page/text()";
> push(@array,$_->data) for ($doc->findnodes($search));
> print "@array\n";
> #######
> When I print out @array, I get "1262 1598", as expected. The problem
> is I don't know the book that 1598 belongs to. Does 1598 belong to
> "Still Kicking" or "Alive and Well"? Further, I need to keep track of
> the page AND the date AND the author, without mixing any of them up.
> If I do 2 diff. searches for the page and dates and push those into 2
> separate arrays, obviously I won't be able to use them in the correct
> order.
Possibly the problem is in your XPath expression:
my $search="//entry/set[nodeA/text()='A']/page/text()";
Should be:
my $search="//entry/ancestor::set[nodeA/text()='A']/page/text()";
Or also:
my $search="//entry/set[nodeA/text()='A']/../page/text()";
Should work...
Take a look on http://www.w3.org/TR/xpath/ as reference.
>
> Does anyone have any suggestions?
>
> thx!
Best regards,
- --
| Daniel Molina <dmw [at] coder [dot] cl> |
| IT Consulting & Software Development |
| Phone: +56 2 9790277 | http://coder.cl/ |
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iQIcBAEBCgAGBQJLZfO6AAoJEHxqfq6Y4O5N8H0P/j08wNJMmztPGJm9g1lWVifn
NEwhFeZXpyLQhkF1Bs0fwzr86q413OJFSQ2Pcea3jBzR2Atc6yNk+N4K1Sbx1P8M
Z+0z2XfbbHkmh/2WkSMGNFRbl/clATD3LiX6+0m0mnr8uGRbslqzQlX9/mTGzp2B
bb3QjOuio3uUacLYj2yV3umctJ4SUpIdCGgVJ+d8USXhbHvPd324A58X4KhdWQb6
tmQDeZRBPlkiymNg4ipntj7QN+boj0De9H/0XFKa1fX09+Cwk1HHFTQSq1s5HqTR
y45OQ21a7CdcdqX+W0SW8qKnvMA4VhHIvf3vgYYjwstYVrzeJ85il2BH2Sl3jmew
t3v4UWQYcyZdl73nQHRObzV2RbjLntP99r5xnAQ0OO9iueTNo8tnqn0SDU6qE01S
TGsJeyCctXqIhJgmMAriOiL6mGjkizDg2bEdojLaV1Eoey4zUTDhtsYoFjZW8kun
YFDSKZGtPWAn8AQ8fIskgF7U4vla9MLMHHnrr/EFrIHktGLnJhRuSvcI8TTbI0u+
LlWDIHx/x+BpRB19cgRN9vLJfLZ8cxcv0rvXOoBJ7vQ6pIAV8TaM9r96nQGeWPXF
R86MusIdZ5MHk790NuRV3cM3xBIj5uXIWG40c+nzx91bhewSY0YzAg/qn/U8StM2
5mL+Y3JZsuQaxN3qoTIS
=iXY/
-----END PGP SIGNATURE-----
------------------------------
Date: Sun, 31 Jan 2010 13:50:35 -0800 (PST)
From: Faith Greenwood <fgnowfg@gmail.com>
Subject: Re: libxml
Message-Id: <143c6f18-2682-4638-a7b6-8478ad2472b5@p6g2000vbl.googlegroups.com>
On Jan 31, 4:18=A0pm, Daniel Molina Wegener <d...@coder.cl> wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA512
>
> On Dom 31 Ene 2010 16:58,
>
>
>
>
>
> Faith Greenwood wrote:
> > How do I return multiple nodes in an xpath search using LibXML? I have
> > the following xml:
>
> > <entry>
> > <set>
> > <nodeA>A</nodeA>
> > <book><name>Near Dead</name><date>1992</date></book>
> > <page>1262</page>
> > </set>
>
> > <set>
> > <nodeA>A</nodeA>
> > <book><name>Alive and Well</name><date>1973</date></book>
> > <page></page>
> > </set>
>
> > <set>
> > <nodeA>A</nodeA>
> > <book><name>Still Kicking</name><date>1968</date></book>
> > <page>1598</page>
> > </set>
> > </entry>
>
> > Here is my perl:
>
> > my $parser=3DXML::LibXML->new();
> > my $doc=3D$parser->parse_file("xml.xml");
> > my @array;
> > my $search=3D"//entry/set[nodeA/text()=3D'A']/page/text()";
> > push(@array,$_->data) for ($doc->findnodes($search));
> > print "@array\n";
> > #######
> > When I print out @array, I get "1262 1598", as expected. The problem
> > is I don't know the book that 1598 belongs to. Does 1598 belong to
> > "Still Kicking" or "Alive and Well"? Further, I need to keep track of
> > the page AND the date AND the author, without mixing any of them up.
> > If I do 2 diff. searches for the page and dates and push those into 2
> > separate arrays, obviously I won't be able to use them in the correct
> > order.
>
> =A0 Possibly the problem is in your XPath expression:
>
> my $search=3D"//entry/set[nodeA/text()=3D'A']/page/text()";
>
> =A0 Should be:
>
> my $search=3D"//entry/ancestor::set[nodeA/text()=3D'A']/page/text()";
>
> =A0 Or also:
>
> my $search=3D"//entry/set[nodeA/text()=3D'A']/../page/text()";
>
> =A0 Should work...
>
> =A0 Take a look onhttp://www.w3.org/TR/xpath/as reference.
>
>
>
> > Does anyone have any suggestions?
>
> > thx!
>
> Best regards,
> - --
> | Daniel Molina <dmw [at] coder [dot] cl> |
> | IT Consulting & Software Development =A0 =A0|
> | Phone: +56 2 9790277 |http://coder.cl/|
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iQIcBAEBCgAGBQJLZfO6AAoJEHxqfq6Y4O5N8H0P/j08wNJMmztPGJm9g1lWVifn
> NEwhFeZXpyLQhkF1Bs0fwzr86q413OJFSQ2Pcea3jBzR2Atc6yNk+N4K1Sbx1P8M
> Z+0z2XfbbHkmh/2WkSMGNFRbl/clATD3LiX6+0m0mnr8uGRbslqzQlX9/mTGzp2B
> bb3QjOuio3uUacLYj2yV3umctJ4SUpIdCGgVJ+d8USXhbHvPd324A58X4KhdWQb6
> tmQDeZRBPlkiymNg4ipntj7QN+boj0De9H/0XFKa1fX09+Cwk1HHFTQSq1s5HqTR
> y45OQ21a7CdcdqX+W0SW8qKnvMA4VhHIvf3vgYYjwstYVrzeJ85il2BH2Sl3jmew
> t3v4UWQYcyZdl73nQHRObzV2RbjLntP99r5xnAQ0OO9iueTNo8tnqn0SDU6qE01S
> TGsJeyCctXqIhJgmMAriOiL6mGjkizDg2bEdojLaV1Eoey4zUTDhtsYoFjZW8kun
> YFDSKZGtPWAn8AQ8fIskgF7U4vla9MLMHHnrr/EFrIHktGLnJhRuSvcI8TTbI0u+
> LlWDIHx/x+BpRB19cgRN9vLJfLZ8cxcv0rvXOoBJ7vQ6pIAV8TaM9r96nQGeWPXF
> R86MusIdZ5MHk790NuRV3cM3xBIj5uXIWG40c+nzx91bhewSY0YzAg/qn/U8StM2
> 5mL+Y3JZsuQaxN3qoTIS
> =3DiXY/
> -----END PGP SIGNATURE-----
thx, but my problem isn't with returning simply the page. I need to be
able to return the page, date, and the book in some sort of hash so as
to make sure that the pages and dates returned correspond w/ the right
book.
------------------------------
Date: Sun, 31 Jan 2010 16:26:06 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: libxml
Message-Id: <slrnhmc0lb.h2j.tadmc@tadbox.sbcglobal.net>
Faith Greenwood <fgnowfg@gmail.com> wrote:
> How do I return multiple nodes in an xpath search using LibXML?
I don't know, but I don't think that you need to...
><entry>
><set>
><nodeA>A</nodeA>
><book><name>Near Dead</name><date>1992</date></book>
><page>1262</page>
></set>
> my $search="//entry/set[nodeA/text()='A']/page/text()";
> When I print out @array, I get "1262 1598", as expected. The problem
> is I don't know the book that 1598 belongs to.
Q: At what level DO you know that a <book> is associated with a <page> ?
A: At the <set> level.
> Does 1598 belong to
> "Still Kicking" or "Alive and Well"? Further, I need to keep track of
> the page AND the date AND the author, without mixing any of them up.
Then you want to search for <set> elements rather than for
the text inside of <page> elements.
Once you have a set of <set>s, loop over them to extract
the further information that you need.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
------------------------------
Date: Sun, 31 Jan 2010 15:33:24 -0800 (PST)
From: Faith Greenwood <fgnowfg@gmail.com>
Subject: Re: libxml
Message-Id: <f7f99a22-f749-49e7-8724-1534bd5c837c@u41g2000yqe.googlegroups.com>
On Jan 31, 5:26=A0pm, Tad McClellan <ta...@seesig.invalid> wrote:
> Faith Greenwood <fgno...@gmail.com> wrote:
> > How do I return multiple nodes in an xpath search using LibXML?
>
> I don't know, but I don't think that you need to...
>
> ><entry>
> ><set>
> ><nodeA>A</nodeA>
> ><book><name>Near Dead</name><date>1992</date></book>
> ><page>1262</page>
> ></set>
> > my $search=3D"//entry/set[nodeA/text()=3D'A']/page/text()";
> > When I print out @array, I get "1262 1598", as expected. The problem
> > is I don't know the book that 1598 belongs to.
>
> Q: At what level DO you know that a <book> is associated with a <page> ?
>
> A: At the <set> level.
>
> > Does 1598 belong to
> > "Still Kicking" or "Alive and Well"? Further, I need to keep track of
> > the page AND the date AND the author, without mixing any of them up.
>
> Then you want to search for <set> elements rather than for
> the text inside of <page> elements.
>
> Once you have a set of <set>s, loop over them to extract
> the further information that you need.
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
gotcha. thanks. Is there a way to return the tagname? I want to ensure
I don't get the page and dates mixed up...1975 could be either a page
or a date, for instance.
------------------------------
Date: Sun, 31 Jan 2010 18:28:47 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: libxml
Message-Id: <slrnhmc7rc.hcd.tadmc@tadbox.sbcglobal.net>
Faith Greenwood <fgnowfg@gmail.com> wrote:
> On Jan 31, 5:26 pm, Tad McClellan <ta...@seesig.invalid> wrote:
>> Faith Greenwood <fgno...@gmail.com> wrote:
>> ><entry>
>> ><set>
>> ><nodeA>A</nodeA>
>> ><book><name>Near Dead</name><date>1992</date></book>
>> ><page>1262</page>
>> ></set>
>> > my $search="//entry/set[nodeA/text()='A']/page/text()";
>> Then you want to search for <set> elements rather than for
>> the text inside of <page> elements.
>>
>> Once you have a set of <set>s, loop over them to extract
>> the further information that you need.
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
It is bad manners to quote .sigs.
Have you seen the Posting Guidelines that are posted here frequently?
> gotcha. thanks.
You're welcome.
> Is there a way to return the tagname?
I don't know, but I don't think that you need to...
When you search for <page> inside of a <set>, then you will
have found a "page" value.
When you search for <date> inside of a <set>, then you will
have found a "date" value.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
------------------------------
Date: Mon, 01 Feb 2010 18:07:15 +0800
From: Hongyi Zhao <hongyi.zhao@gmail.com>
Subject: Perl regexp to match any Chinese characters.
Message-Id: <jr9dm59m34kaa1rotsbgcs74hg9h65sf2k@4ax.com>
Hi all,
I want to match any Chinese characters with Perl regexp.
Any hints on this issue?
Thanks in advance.
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
------------------------------
Date: Mon, 1 Feb 2010 11:32:34 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Perl regexp to match any Chinese characters.
Message-Id: <slrnhmdbe2.f1e.hjp-usenet2@hrunkner.hjp.at>
On 2010-02-01 10:07, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> I want to match any Chinese characters with Perl regexp.
> Any hints on this issue?
perldoc perlunicode
Read the section "Unicode Character Properties".
hp
------------------------------
Date: Mon, 01 Feb 2010 12:16:08 -0800
From: sln@netherlands.com
Subject: Re: Perl regexp to match any Chinese characters.
Message-Id: <bjdem5dsjmjavumhvmce0mbni7a19ergn0@4ax.com>
On Mon, 01 Feb 2010 18:07:15 +0800, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>Hi all,
>
>I want to match any Chinese characters with Perl regexp.
>Any hints on this issue?
>
>Thanks in advance.
As opposed to what?
-sln
------------------------------
Date: Mon, 1 Feb 2010 21:47:50 +0000 (UTC)
From: Kevin Collins <spamtotrash@toomuchfiction.com>
Subject: SSL read timeout
Message-Id: <slrnhmej08.294.spamtotrash@vai.unix-guy.com>
Hi,
I have a perl script running to query a SOAP process, but using a basic
Net::HTTPS connection. If the server takes more than 60 econds to respond, the
script fails with the following error:
SSL read timeout: at /opt/CTperl-5.8.4/lib/site_perl/5.8.4/Net/HTTP/Methods.pm
line 226 Net::SSL::die_with_error('Net::HTTPS=GLOB(0x60000000000608a0)', 'SSL
read timeout') called at
/opt/CTperl-5.8.4/lib/site_perl/5.8.4/IA64.ARCHREV_0-LP64/Net/SSL.pm line 218
...
...
My invocation looks like this:
my $connection = Net::HTTPS->new(Host => $Server, timeout => 300) || die $@;
Is there another means to set the SSL timeout? It would appear the 'timeout =>
300' is not affecting the SSL component.
Any help would be appreciated.
Thanks,
Kevin
------------------------------
Date: Sun, 31 Jan 2010 16:55:26 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: steps
Message-Id: <17612dc9-8a3f-4d64-9b40-9965c2ccc4a5@r6g2000yqn.googlegroups.com>
On Jan 29, 8:05=A0pm, Robin <rob...@cnsp.com> wrote:
> What would some of the steps be to design modules for perl that are a
> way people can do gui programming on windows?
> I don't exactly know where to start and would like some human input.
Here is a GUI for some steps:
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $mw =3D MainWindow->new;
my ($num);
sub steps {
my ($ix, $x, $y, $size);
my $c =3D $mw->Canvas(-width=3D>150, -height=3D>150, -background=3D>'Gree=
n')-
>grid();
$size=3D150 / ($num + 1);
$x=3D$y=3D$size/2;
my @segs=3D($x,$y);
for ($ix=3D0; $ix<$num; $ix++) {
$y+=3D$size; push @segs,$x,$y;
$x+=3D$size; push @segs,$x,$y;
}
$c->createLine(@segs, -width=3D>3);
}
$mw->Label(-text=3D>'Number of steps')->grid(
$mw->Entry(-width=3D>6, -textvariable=3D>\$num));
$mw->Button(-text=3D>'Enter', -command=3D>\&steps)->grid(
$mw->Button(-text=3D>'Quit', -command=3D> sub {$mw->destroy}));
$mw->MainLoop;
------------------------------
Date: Sun, 31 Jan 2010 23:02:51 -0800 (PST)
From: Robin <robin1@cnsp.com>
Subject: Re: steps
Message-Id: <b2d96f8a-bbf3-41f3-9333-298883e7d858@r19g2000yqb.googlegroups.com>
smallpond wrote:
> On Jan 29, 8:05=A0pm, Robin <rob...@cnsp.com> wrote:
> > What would some of the steps be to design modules for perl that are a
> > way people can do gui programming on windows?
> > I don't exactly know where to start and would like some human input.
>
> Here is a GUI for some steps:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Tk;
>
> my $mw =3D MainWindow->new;
> my ($num);
>
> sub steps {
> my ($ix, $x, $y, $size);
> my $c =3D $mw->Canvas(-width=3D>150, -height=3D>150, -background=3D>'Gr=
een')-
> >grid();
> $size=3D150 / ($num + 1);
> $x=3D$y=3D$size/2;
> my @segs=3D($x,$y);
> for ($ix=3D0; $ix<$num; $ix++) {
> $y+=3D$size; push @segs,$x,$y;
> $x+=3D$size; push @segs,$x,$y;
> }
> $c->createLine(@segs, -width=3D>3);
> }
>
> $mw->Label(-text=3D>'Number of steps')->grid(
> $mw->Entry(-width=3D>6, -textvariable=3D>\$num));
> $mw->Button(-text=3D>'Enter', -command=3D>\&steps)->grid(
> $mw->Button(-text=3D>'Quit', -command=3D> sub {$mw->destroy}));
>
> $mw->MainLoop;
thanks for the advice.... I really appreciate your post.
I didn't realize it was that simply to create 'em.
-Robin
------------------------------
Date: Sun, 31 Jan 2010 23:03:15 -0800 (PST)
From: Robin <robin1@cnsp.com>
Subject: Re: steps
Message-Id: <2deacca5-8625-431c-884c-f20321cc450c@n33g2000yqb.googlegroups.com>
smallpond wrote:
> On Jan 29, 8:05=A0pm, Robin <rob...@cnsp.com> wrote:
> > What would some of the steps be to design modules for perl that are a
> > way people can do gui programming on windows?
> > I don't exactly know where to start and would like some human input.
>
> Here is a GUI for some steps:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Tk;
>
> my $mw =3D MainWindow->new;
> my ($num);
>
> sub steps {
> my ($ix, $x, $y, $size);
> my $c =3D $mw->Canvas(-width=3D>150, -height=3D>150, -background=3D>'Gr=
een')-
> >grid();
> $size=3D150 / ($num + 1);
> $x=3D$y=3D$size/2;
> my @segs=3D($x,$y);
> for ($ix=3D0; $ix<$num; $ix++) {
> $y+=3D$size; push @segs,$x,$y;
> $x+=3D$size; push @segs,$x,$y;
> }
> $c->createLine(@segs, -width=3D>3);
> }
>
> $mw->Label(-text=3D>'Number of steps')->grid(
> $mw->Entry(-width=3D>6, -textvariable=3D>\$num));
> $mw->Button(-text=3D>'Enter', -command=3D>\&steps)->grid(
> $mw->Button(-text=3D>'Quit', -command=3D> sub {$mw->destroy}));
>
> $mw->MainLoop;
------------------------------
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 2799
***************************************