[26128] in Perl-Users-Digest
Perl-Users Digest, Issue: 8321 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 14 09:05:35 2005
Date: Sun, 14 Aug 2005 06:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 14 Aug 2005 Volume: 10 Number: 8321
Today's topics:
ANNOUNCE: spodcxx v0.22, a (s)POD Parser and (s)POD to <hdnews@gawab.com>
basic cgi button question <k.p.boomsma@xs4all.nl>
Re: basic cgi button question <flavell@ph.gla.ac.uk>
Re: basic cgi button question <k.p.boomsma@xs4all.nl>
Re: How do I use global variables safely? <djames@thehub.com.au>
kanjidic parser in Perl? <usenet@sljfaq.org>
Re: kanjidic parser in Perl? <davidra@ifi.uio.no>
Re: kanjidic parser in Perl? <usenet@sljfaq.org>
mod_gzip and perl <""alexjaquet\"@[no spam]msn.com">
Re: mod_gzip and perl <flavell@ph.gla.ac.uk>
Re: mod_gzip and perl <""alexjaquet\"@[no spam]msn.com">
Re: OT basic cgi button question <noreply@gunnar.cc>
Re: Perl numerics: EPSILON and equality between floats xhoster@gmail.com
Probs with regex and nesting <gyruss@hushmail.com>
Re: Probs with regex and nesting <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 14 Aug 2005 00:34:59 GMT
From: Hans Oesterholt-Dijkema <hdnews@gawab.com>
Subject: ANNOUNCE: spodcxx v0.22, a (s)POD Parser and (s)POD to HTML converter
Message-Id: <IL6sAB.22yo@zorch.sf-bay.org>
L.S.,
I've released 'spodcxx' version 0.22, which
provides a sPOD 2 HTML converter. SPOD is
a superset of POD, which is widely used as
documentation language for perl modules.
SPOD can also be used to document scheme code and
has support other languages' comments.
This release fixes a small bug in wikiwikiwiki mode.
The CPAN address for spodcxx is
http://search.cpan.org/~oesterhol/spodcxx-0.22
Don't expect any meaningfull POD documentation there.
Documentation can be found at:
http://www.elemental-programming.org/epwiki/spodcxx.html
Best regards,
Hans Oesterholt
------------------------------
Date: Sun, 14 Aug 2005 13:40:54 +0200
From: Kornelis <k.p.boomsma@xs4all.nl>
Subject: basic cgi button question
Message-Id: <42ff2be8$0$11062$e4fe514c@news.xs4all.nl>
I would like to know why sending and retrieving a value with cgi
code like
<button type="submit" name="show" value="y"> show </button>
and
if ($show eq "y") {
print qq| test ie: show eq y.... |;
}
works fine in firefox, mozilla or konqueror, but does nothing at all
in internet explorer.
A test version is at http://www.jiten.nl/cgi-bin/testie.cgi
and its code at http://www.jiten.nl/cgi-bin/testie.txt .
It seems really basic, but I would really appreciate help...
Kornelis
--
* http://promulgate.xs4all.nl
------------------------------
Date: Sun, 14 Aug 2005 13:04:09 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: basic cgi button question
Message-Id: <Pine.LNX.4.62.0508141257420.506@ppepc56.ph.gla.ac.uk>
On Sun, 14 Aug 2005, Kornelis wrote:
> I would like to know why sending and retrieving a value with cgi
> code like
>
> <button type="submit" name="show" value="y"> show </button>
>
> and
>
> if ($show eq "y") {
Well, you haven't showed how you parsed your CGI query parameters into
that variable $show, but I'm going to make certain assumptions...
> works fine in firefox, mozilla or konqueror, but does nothing at all
> in internet explorer.
The usual explanation: MSIE doesn't implement the <button> to
specification. This has nothing to do with Perl, it would be as bad
with any other server-side language.
> It seems really basic, but I would really appreciate help...
In a web context, I'd recommend not using <button>, but use <input
type="submit" ...>, chiefly for accessibility reasons, but
incidentally because it happens to be supported by MesSIE, which I
know that some misguided webnauts use in the belief that it's a web
browser.
In a usenet context, I'd recommend asking web-related questions on a
web-related usenet group. Have you read the posting guidelines for
this Perl group, posted here frequently?
good luck.
------------------------------
Date: Sun, 14 Aug 2005 14:33:38 +0200
From: Kornelis <k.p.boomsma@xs4all.nl>
Subject: Re: basic cgi button question
Message-Id: <42ff37c2$0$11077$e4fe514c@news.xs4all.nl>
Alan J. Flavell wrote:
> On Sun, 14 Aug 2005, Kornelis wrote:
>
>
>>I would like to know why sending and retrieving a value with cgi
>>code like
>>
>> <button type="submit" name="show" value="y"> show </button>
>>
>>and
>>
>> if ($show eq "y") {
>
>
> Well, you haven't showed how you parsed your CGI query parameters into
> that variable $show, but I'm going to make certain assumptions...
>
>
>>works fine in firefox, mozilla or konqueror, but does nothing at all
>>in internet explorer.
>
>
> The usual explanation: MSIE doesn't implement the <button> to
> specification. This has nothing to do with Perl, it would be as bad
> with any other server-side language.
>
>
>>It seems really basic, but I would really appreciate help...
>
>
> In a web context, I'd recommend not using <button>, but use <input
> type="submit" ...>, chiefly for accessibility reasons, but
> incidentally because it happens to be supported by MesSIE, which I
> know that some misguided webnauts use in the belief that it's a web
> browser.
>
> In a usenet context, I'd recommend asking web-related questions on a
> web-related usenet group. Have you read the posting guidelines for
> this Perl group, posted here frequently?
>
> good luck.
thanks for your swift reply.
I settled on posting here, because more cgi related groups that I
could find on my newsserver all had a very low output. I'm sorry,
Kornelis.
--
* http://promulgate.xs4all.nl
------------------------------
Date: Sat, 13 Aug 2005 23:00:03 GMT
From: Damian James <djames@thehub.com.au>
Subject: Re: How do I use global variables safely?
Message-Id: <slrndfssej.344.djames@puli.home>
On Sat, 13 Aug 2005 12:34:34 +0100, Graham said:
> I want to be able to allow a variable to be set in one subroutine, and use
> its value in another subroutine, but I obviously can't do this if I use the
> 'my' or 'local' functions on the variable in each subroutine. You might say
> just dispense with 'my' or 'local' and let the variable be global. Well I
> was doing that and had no problem until I used ActiveState's 'Perl App' to
> create a standalone executable. This doesn't seem to like global variables
> and is virtually telling me I must 'use strict', and I would if I could, but
> I don't know how to transfer a vairiable's value (I never did fully
> understand lexical scope) Any ideas anyone?
You can just declare the variable in a scope that both subs can see:
#!perl
use strict;
use warnings;
my $var;
sub foo { $var = $_[0]; }
sub bar { print "$var\n"; }
foo('test');
bar();
Though other posters have suggested methods involving passing the value
of a variable into and out of functions, and I'd recommend following their
advice.
--Damian
------------------------------
Date: Sun, 14 Aug 2005 16:19:21 +0900
From: Ben Bullock <usenet@sljfaq.org>
Subject: kanjidic parser in Perl?
Message-Id: <ddmr9e$ssi$1@ml.accsnet.ne.jp>
Does anyone know of a parser for Jim Breen's kanjidic written in Perl?
------------------------------
Date: 14 Aug 2005 14:23:54 +0200
From: David Alexander Ranvig <davidra@ifi.uio.no>
Subject: Re: kanjidic parser in Perl?
Message-Id: <xbxhddsbtb9.fsf@kolme.ifi.uio.no>
Ben Bullock <usenet@sljfaq.org> writes:
| Does anyone know of a parser for Jim Breen's kanjidic written in
| Perl?
<URL: http://search.cpan.org> is a nice tool for finding all things
perl. Maybe you can use the module Lingua::JP::Kanjidic by Simon
Cozens?
--
David,
------------------------------
Date: Sun, 14 Aug 2005 21:58:36 +0900
From: Ben Bullock <usenet@sljfaq.org>
Subject: Re: kanjidic parser in Perl?
Message-Id: <ddnf5l$42b$1@ml.accsnet.ne.jp>
David Alexander Ranvig wrote:
> Ben Bullock <usenet@sljfaq.org> writes:
>
> | Does anyone know of a parser for Jim Breen's kanjidic written in
> | Perl?
>
> <URL: http://search.cpan.org> is a nice tool for finding all things
> perl. Maybe you can use the module Lingua::JP::Kanjidic by Simon
> Cozens?
Thanks for the tip. I had a look at it, and it seems to need some work.
Doesn't parse all the fields in the dictionary yet, unfortunately. I'll
try editing it up a bit.
Ben.
------------------------------
Date: Sun, 14 Aug 2005 10:17:42 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: mod_gzip and perl
Message-Id: <42fefe27$0$1161$5402220f@news.sunrise.ch>
Hi,
I just install mod_gzip and want to test it, what kind of change
I have to do ?
Does I need to modify the header I send ?
print "Content-type: text/html\n\n";
Cheers :)
Alexandre Jaquet
------------------------------
Date: Sun, 14 Aug 2005 10:17:02 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: mod_gzip and perl
Message-Id: <Pine.LNX.4.62.0508141010010.506@ppepc56.ph.gla.ac.uk>
On Sun, 14 Aug 2005, Alexandre Jaquet and MISSINGalexjaquet"TERMINATOR wrote:
> Alexandre Jaquet > a écrit :
> > I just install mod_gzip and want to test it, what kind of change
> > I have to do ?
I didn't see any Perl in your original question, either.
I'd recommend that you raise your question on a group where WWW
authoring is on-topic.
> but right now I got trouble when I use Internet Explorer
Internet Explorer deliberately rules itself out as a web-compatible
browser, by several violations of mandatory requirements of the
applicable interworking specifications. With that background, its
misbehaviour comes as no surprise. But it has nothing to do with
Perl.
> FireFox work perfectly any idea ?
It's a www-compatible client agent, which MesSIE is not.
good luck.
------------------------------
Date: Sun, 14 Aug 2005 11:43:40 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: mod_gzip and perl
Message-Id: <42ff124e$0$1157$5402220f@news.sunrise.ch>
Alan J. Flavell a écrit :
> On Sun, 14 Aug 2005, Alexandre Jaquet and MISSINGalexjaquet"TERMINATOR wrote:
>
>
>>Alexandre Jaquet > a écrit :
>>
>>>I just install mod_gzip and want to test it, what kind of change
>>>I have to do ?
>
>
> I didn't see any Perl in your original question, either.
>
> I'd recommend that you raise your question on a group where WWW
> authoring is on-topic.
>
>
>>but right now I got trouble when I use Internet Explorer
>
>
> Internet Explorer deliberately rules itself out as a web-compatible
> browser, by several violations of mandatory requirements of the
> applicable interworking specifications. With that background, its
> misbehaviour comes as no surprise. But it has nothing to do with
> Perl.
>
>
>>FireFox work perfectly any idea ?
>
>
> It's a www-compatible client agent, which MesSIE is not.
>
> good luck.
Well thanks Alan for your explanation :)
------------------------------
Date: Sun, 14 Aug 2005 14:29:08 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: OT basic cgi button question
Message-Id: <3m8roqF14tl3aU1@individual.net>
Kornelis wrote:
> I would like to know why sending and retrieving a value with cgi
> code like
>
> <button type="submit" name="show" value="y"> show </button>
>
> and
>
> if ($show eq "y") {
> print qq| test ie: show eq y.... |;
> }
>
> works fine in firefox, mozilla or konqueror, but does nothing at all
> in internet explorer.
If you try this script in Explorer, you'll notice that it submits
something, but not what you told it:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
my $q = $ENV{QUERY_STRING};
print "<pre>$q</pre>\n" if $q;
print <<FORM;
<form action="test.pl">
<button type="submit" name="show" value="y"> click </button>
</form>
FORM
__END__
But if you want to know _why_, please ask at http://www.microsoft.com/
Until they answer, why don't you just use
<input type="hidden" name="show" value="y">
<input type="submit" value=" show ">
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 13 Aug 2005 22:05:55 GMT
From: xhoster@gmail.com
Subject: Re: Perl numerics: EPSILON and equality between floats
Message-Id: <20050813180555.936$AP@newsreader.com>
bill <please_post@nomail.edu> wrote:
> In <20050811160034.410$ru@newsreader.com> xhoster@gmail.com writes:
>
> >bill <please_post@nomail.edu> wrote:
> >> I just recently came across this snippet:
> >>
> >> my $EPSILON = 1;
> >> $EPSILON /= 2 while 0.5 + $EPSILON/2 > 0.5;
> >>
> >> where $EPSILON was later used, e.g., to compare floats for equality:
> >>
> >> sub float_equal {
> >> my ($x, $y) = @_;
> >> return !($x||$y) || ($x+$y) && abs(($x-$y)/($x+$y)) < $EPSILON;
> >> }
> >>
> >> (The above is the gist of what I recall, not verbatim production
> >> code, but I think I got it right.)
> >>
> >> I'm not very knowledgeable about numerics, so I was wondering
> >> whether this was the best way to compare floats for equality.
>
> >The best way to compare floats for equality is highly dependent on
> >why you want to compare floats for equality.
>
> That's interesting. I can't think of any examples in which method
> X would be better than method Y for some purposes but worse for
> others.
You mean in general, or just in this context?
> Can you give an example?
If you are running an optimization, or an interation-until-convergence,
where the score function loses all physical significance after 3 digits but
you converge out to 28 digits, merely because your machine supports that
precision, you are likely to waste hours or decades of computer time for no
purpose.
>
> In recent times, I've needed to compare floats in unit tests
> (expected vs. obtained). I typically use an approach similar to
> the one I described in my OP (i.e. declare two floats as "equal"
> if the difference between them is below some tolerance), except
> that I just pull the tolerance out of thin air (I usually go for
> 2**-20, instead of having a halfway defensible procedure for
> determining it.
The defensible tolerance level is the one that makes sense given the
physical interpretation of the floats. Otherwise your algorithm
which gives a perfectly good answer will be deemed wrong simply because
your machine precision is high enough to detect a meaningless difference.
Or an algorithm that gives a fatally wrong answer (on a particular machine)
will be deemed right merely because your machine precision is too low to
realize it is wrong.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sun, 14 Aug 2005 22:34:34 +1000
From: "Gyruss" <gyruss@hushmail.com>
Subject: Probs with regex and nesting
Message-Id: <42ff3a45@dnews.tpgi.com.au>
Hi,
I'm having trouble modifying the regular expression /^\{.*\}$/ so that a
string with nested curly braces is deemed unmatched. E.g
{recognizing syntax} - matched
{recognizing syntax {foo} bar} - unmatched.
{recognizing syntax {foo{ foo bar}} {bar}} - unmatched.
Can this be done?
Cheers!
use warnings;
use strict;
while (<>) {
chomp;
if (/^\{.*\}$/) {
print "Matched: |$`<$&>$'|\n";
} else {
print "No match.\n";
}
}
------------------------------
Date: Sun, 14 Aug 2005 14:42:43 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Probs with regex and nesting
Message-Id: <3m8si9F15u4kdU1@individual.net>
Gyruss wrote:
> I'm having trouble modifying the regular expression /^\{.*\}$/ so that a
> string with nested curly braces is deemed unmatched. E.g
>
> {recognizing syntax} - matched
> {recognizing syntax {foo} bar} - unmatched.
> {recognizing syntax {foo{ foo bar}} {bar}} - unmatched.
/^{[^{}]*}$/
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
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 8321
***************************************