[24724] in Perl-Users-Digest
Perl-Users Digest, Issue: 6879 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 18 11:06:12 2004
Date: Wed, 18 Aug 2004 08:05:10 -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 Wed, 18 Aug 2004 Volume: 10 Number: 6879
Today's topics:
Re: Can I easily automate testing of my cgi using Test: (David Efflandt)
Re: Can I easily automate testing of my cgi using Test: <dont@email.me>
could I use perl to write a script to logon multiple we <end@dream.com>
Re: could I use perl to write a script to logon multipl <tore@aursand.no>
Re: could I use perl to write a script to logon multipl <peter@semantico.com>
Re: could I use perl to write a script to logon multipl <end@dream.com>
Re: could I use perl to write a script to logon multipl <end@dream.life>
Re: could I use perl to write a script to logon multipl <peter@semantico.com>
Re: could I use perl to write a script to logon multipl <tadmc@augustmail.com>
Re: could I use perl to write a script to logon multipl <tore@aursand.no>
Re: could I use perl to write a script to logon multipl <end@dream.life>
Re: could I use perl to write a script to logon multipl <end@dream.life>
Re: could I use perl to write a script to logon multipl <end@dream.life>
Re: could I use perl to write a script to logon multipl <tore@aursand.no>
Re: Earthquake forecasting program Aug. 16, 2004 <bobofficers@invalid.net>
Re: Earthquake forecasting program Aug. 16, 2004 (Oriel36)
Re: Earthquake forecasting program Aug. 16, 2004 (Palmer Clancy)
Re: Earthquake forecasting program Aug. 16, 2004 <jurgenex@hotmail.com>
Re: editing perl script through TEXTAREA <noreply@gunnar.cc>
Re: editing perl script through TEXTAREA <gnari@simnet.is>
Re: editing perl script through TEXTAREA <tore@aursand.no>
Re: editing perl script through TEXTAREA <noreply@gunnar.cc>
Re: How do I pick up existing objects in event handling (Johan Lindstrom)
How to upload a file from a user's desktop to a web ser (srini)
Re: How to upload a file from a user's desktop to a web <tore@aursand.no>
Re: Materializing an indirect sort using only swap <bowsayge@nomail.afraid.org>
Re: Materializing an indirect sort using only swap (Anno Siegel)
Re: My own handy Pocket Reference notes <abigail@abigail.nl>
Re: My own handy Pocket Reference notes <abigail@abigail.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Aug 2004 08:17:13 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Can I easily automate testing of my cgi using Test::[something]?
Message-Id: <slrnci6449.pnk.efflandt@typhoon.xnet.com>
On Tue, 17 Aug 2004 17:32:15 -0400, SC <dont@email.me> wrote:
> I'd like to automate testing on a current project. I read
> Test::Tutorial and the related docs by Michael Schwern (Test::Simple and
> Test::More) and everything seems prety clear to me.
>
> The only problem is that all the examples are for testing modules.
> (About which I don't really know anything). Is there any way I can test
> the output from my cgi scripts as-is using some of these testing tools
> or am I out of luck?
The best way to test CGI, short of the production server, is with various
web browsers on your own similar web server. What got me into Linux in
1995 was frustration trying to test perl scripts in Windows and then
massaging them to work in apache on my Solaris ISP (different paths, or
Unix things that could not be tested in Windows). Even though the path to
perl (which was perl4 then) or other paths might be different, that was
easy enough to fix with a symbolic links in Linux, so I could simply
upload the working scripts unmodified to Solaris.
Or you can install FreeBSD on a PC if your web host is BSD or FreeBSD.
If your production server is Windows, my experience with IIS is limited
ftp or FrontPage access and minimal ASP to get by with a donated club site
(don't even know if it is configured for Perl and/or CGI).
There is no substitute for live testing, even if on a private server.
--
David Efflandt - All spam ignored http://www.de-srv.com/
------------------------------
Date: Wed, 18 Aug 2004 09:18:39 -0400
From: SC <dont@email.me>
Subject: Re: Can I easily automate testing of my cgi using Test::[something]?
Message-Id: <41235601_3@news3.prserv.net>
Bill wrote:
> SC wrote:
>
>> I'd like to automate testing on a current project. I read
>> Test::Tutorial and the related docs by Michael Schwern (Test::Simple
>> and Test::More) and everything seems prety clear to me.
>>
>> The only problem is that all the examples are for testing modules.
>> (About which I don't really know anything). Is there any way I can
>> test the output from my cgi scripts as-is using some of these testing
>> tools or am I out of luck?
>>
>> My cgis are fairly simple affairs taking some params, reading from
>> some files/DBMs then outputing html. I'm not doing anything really
>> clever or complicated but I find that the number of things I need to
>> test for is growing larger than I can easily handle manually.
>>
>> I'd really appreciate it if anyone has link to a tutorial or howto on
>> the subject.
>>
>>
>> Scot
>>
> Look at CGI::Test on CPAN. And use -T. Taint mode is your shield.
>
> Most of the work is still trying to decide what to test and under which
> circumstances, of course. You can easily spend more time revising the
> tests than the CGI :).
Ah great, thank you. I should have looked there but got so hung up on
the Test:: suite that I forgot theres more tan one place to find it :-)
...and yes, taint mode all the way :-)
Actually, -wT, use strict, and $|++; are the first three things I add to
any new script (after tht #! of course)
Scot
------------------------------
Date: Wed, 18 Aug 2004 15:10:12 +0800
From: Alont <end@dream.com>
Subject: could I use perl to write a script to logon multiple web forum?
Message-Id: <4126ffe3.5997171@130.133.1.4>
I have registerd many web site or web forum, and I want release some
information to all these web site, could I do this in perl?
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 11:27:08 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <pan.2004.08.18.09.27.07.798092@aursand.no>
On Wed, 18 Aug 2004 15:10:12 +0800, Alont wrote:
> I have registerd many web site or web forum, and I want release some
> information to all these web site, could I do this in perl?
Yes.
--
Tore Aursand <tore@aursand.no>
"The road to hell is full of good intentions." (Bruce Dickinson)
------------------------------
Date: Wed, 18 Aug 2004 10:42:39 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <4123248f$0$10133$afc38c87@news.easynet.co.uk>
Alont wrote:
> I have registerd many web site or web forum, and I want release some
> information to all these web site, could I do this in perl?
So you are planning to spam a load of sites? Can anyone read japanese and see
what dream.com's AUP is?
------------------------------
Date: Wed, 18 Aug 2004 18:49:24 +0800
From: Alont <end@dream.com>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <4126337c.19206593@130.133.1.4>
and I want register a new acount in a web site,
the site only accept (FORM METHOD="POST"),How
I can custom the HTTP head information?(change "GET" to "POST")
thanks :-)
at Wed, 18 Aug 2004 11:27:08 +0200
Tore Aursand <tore@aursand.no>×íõ¸õ¸µÄÄØà«µÀ:--
>Yes.
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 19:22:45 +0800
From: Alont <end@dream.life>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <4127396c.20725859@130.133.1.4>
not spam, but send some product information to such as
"www.alibaba.com" and other business site, I don't want click the
"register" or "login" or type password again and again,
I'm sorry I use "end@dream.com" as my email acount, in fact this
acount is not exist, I use "end@dream.life" before, and you know what
this "account" mean, hehe, in fact, I even don't know there exist a
"www.dream.com" site, I really don't know, maybe I should change my
eamil account again.
at Wed, 18 Aug 2004 10:42:39 +0100
Peter Hickman <peter@semantico.com>×íõ¸õ¸µÄÄØà«µÀ:--
>So you are planning to spam a load of sites? Can anyone read japanese and see
>what dream.com's AUP is?
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 13:26:53 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <41234b0e$0$13794$afc38c87@news.easynet.co.uk>
Alont wrote:
> not spam, but send some product information to such as
> "www.alibaba.com" and other business site, I don't want click the
> "register" or "login" or type password again and again,
So I take it that these sites did not solicit this information to be posted to
their forums, this is spam then by any definition.
> I'm sorry I use "end@dream.com" as my email acount, in fact this
> acount is not exist, I use "end@dream.life" before, and you know what
> this "account" mean, hehe, in fact, I even don't know there exist a
> "www.dream.com" site, I really don't know, maybe I should change my
> eamil account again.
The use of fake addresses will always make you look slimy, being a wannabe
spammer doubly so.
------------------------------
Date: Wed, 18 Aug 2004 07:34:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <slrnci6j6d.f4r.tadmc@magna.augustmail.com>
Alont <end@dream.com> wrote:
> Subject: could I use perl to write a script to logon multiple web forum?
perldoc -q form
How do I automate an HTML form submission?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 18 Aug 2004 15:16:03 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <pan.2004.08.18.13.16.03.270782@aursand.no>
On Wed, 18 Aug 2004 18:49:24 +0800, Alont wrote:
> [...]
Don't top post.
> and I want register a new acount in a web site, the site only accept
> (FORM METHOD="POST"),How I can custom the HTTP head information?(change
> "GET" to "POST")
This is answered in the FAQ. You could also have a look at CPAN where
you'll find numerous modules which helps you with this.
--
Tore Aursand <tore@aursand.no>
"Be nice to nerds. Chances are you'll end up working for one." (Bill
Gates)
------------------------------
Date: Wed, 18 Aug 2004 21:59:43 +0800
From: Alont <end@dream.life>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <412560c3.30796875@130.133.1.4>
not forum, I want input information to the product database
automatically instead handwork, but not where people discussing.
My english is so poor, something I can't explain clearly----I'm sorry.
but please believe my basic morality, I hate spam as you! that's why I
use a fake e-mail address----I have to, my e-mail box is broken!
a tool, a knife have different usage, I can use a knife to kill you,
and I can use it to pare a apple for you.
I'm sorry my english is so poor, hope you'll understand what my
sentences say :-)
at Wed, 18 Aug 2004 13:26:53 +0100
Peter Hickman <peter@semantico.com>×íõ¸õ¸µÄÄØà«µÀ:--
>Alont wrote:
>
>> not spam, but send some product information to such as
>> "www.alibaba.com" and other business site, I don't want click the
>> "register" or "login" or type password again and again,
>
>So I take it that these sites did not solicit this information to be posted to
>their forums, this is spam then by any definition.
>
>> I'm sorry I use "end@dream.com" as my email acount, in fact this
>> acount is not exist, I use "end@dream.life" before, and you know what
>> this "account" mean, hehe, in fact, I even don't know there exist a
>> "www.dream.com" site, I really don't know, maybe I should change my
>> eamil account again.
>
>The use of fake addresses will always make you look slimy, being a wannabe
>spammer doubly so.
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 22:00:06 +0800
From: Alont <end@dream.life>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <41235dce.30040500@130.133.1.4>
thank you, I'll search FAQ just now...
at Wed, 18 Aug 2004 15:16:03 +0200
Tore Aursand <tore@aursand.no>×íõ¸õ¸µÄÄØà«µÀ:--
>This is answered in the FAQ. You could also have a look at CPAN where
>you'll find numerous modules which helps you with this.
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 22:11:02 +0800
From: Alont <end@dream.life>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <41276136.30911953@130.133.1.4>
thanks for your reply :-)
BTW: I want to communicating with foreigner long time ago, especially
American, but I till hard to talk in english,
I wonder: it's time for me speak up?
hehe, I like the nation system of America,
I hope one day I'll get freedom as American.
I'm living in fujian China.
at Wed, 18 Aug 2004 07:34:21 -0500
Tad McClellan <tadmc@augustmail.com>×íõ¸õ¸µÄÄØà«µÀ:--
> perldoc -q form
>
> How do I automate an HTML form submission?
>
>
>--
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
Your fault as a Government is My failure as a citizen
------------------------------
Date: Wed, 18 Aug 2004 16:29:39 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: could I use perl to write a script to logon multiple web forum?
Message-Id: <pan.2004.08.18.14.29.38.962592@aursand.no>
On Wed, 18 Aug 2004 22:11:02 +0800, Alont wrote:
> I wonder: it's time for me speak up?
> hehe, I like the nation system of America, I hope one day I'll get
> freedom as American. I'm living in fujian China.
*must...res...ist...reply...ing....to....this...post*
Damn! :)
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Wed, 18 Aug 2004 02:44:03 -0700
From: Bob Officer <bobofficers@invalid.net>
Subject: Re: Earthquake forecasting program Aug. 16, 2004
Message-Id: <1v86i0908fnd4b2jbj3sm1gl6q4ov0rr3r@4ax.com>
Keywords: X
On Tue, 17 Aug 2004 06:55:50 GMT, in sci.geo.earthquakes, "edgrsprj"
<edgrsprj@ix.netcom.com> wrote:
>
>"Jaxtraw" <jaxtraw@nospamnobigfoot.com> wrote in message
>news:1092684544.19111.0@ersa.uk.clara.net...
>> "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
>> news:0f1Uc.23551$nx2.17009@newsread2.news.atl.earthlink.net...
>> > August 16, 2004 Posted to sci.geo.earthquakes and other Newsgroups
>
>>
>> Intriguing, but it seems to me you should test also for false negatives.
>> ...
>
>August 17, 2004
>
>Hi Ian, Thanks for the comments.
>
>At the moment this what might be described as "Any port in the storm
>technology." That means that we have a desperate situation where
>earthquakes are claiming lives without anything to stop that from happening.
>More than 25,000 people reportedly perished last December in Iran from an
>unexpected earthquake. And the immediate goal is to find anything at all
>which can help.
>
>I know of at least two promising looking technologies which are being used
>in China. But each of the detector units runs something like $10,000 U.S.
>You need multiple units to cover a given area plus all of the support
>personnel. And they still apparently miss an unacceptably high percentage
>of the destructive earthquakes.
That means the system doesn't work...
>One of the reasons that my program looks so attractive at the moment is the
Only to you... but then it isn't really your program. you didn't gather the
data or write the computer program. You are a CRACKPOT.
--
Aktohdi
------------------------------
Date: 18 Aug 2004 05:35:08 -0700
From: geraldkelleher@hotmail.com (Oriel36)
Subject: Re: Earthquake forecasting program Aug. 16, 2004
Message-Id: <273f8e06.0408180435.64d94f2b@posting.google.com>
"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message news:<4jCUc.25401$nx2.24562@newsread2.news.atl.earthlink.net>...
> "Oriel36" <geraldkelleher@hotmail.com> wrote in message
> news:273f8e06.0408170318.1611ffb5@posting.google.com...
> > "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
> news:<0f1Uc.23551$nx2.17009@newsread2.news.atl.earthlink.net>...
> > > August 16, 2004 Posted to sci.geo.earthquakes and other Newsgroups
> > >
>
> August 18, 2004
>
> What my data show is that there is some type of link between the positions
> of the sun and the moon in the sky and the times when many of our
> earthquakes are being triggered. And the only forces which I can picture as
> being involved are the sun and moon gravitational pulls on the Earth.
>
All gravitational observations are based on the sidereal format which
is the only means to determine a geocentric/heliocentric orbital
equivalency.After Kepler,Galileo and others struggled for recognition
of the heliocentric motion of the planets,Newton reverted back to an
odd mixture of geocentrism and heliocentrism to get his gravitational
agenda to work.He used Flamsteed erroneous proof for axial
rotational/stellar circumpolar equivalency and morphed it into a
geocentric/heliocentric orbital equivalency.
"PHÆNOMENON IV.
That the fixed stars being at rest, the periodic times of the five
primary planets, and (whether of the sun about the earth, or) of the
earth about the sun, are in the sesquiplicate proportion of their mean
distances from the sun.
http://members.tripod.com/~gravitee/phaenomena.htm
I will put it another way,at dawn,the Earth axially rotates out of its
orbital shadow but if you are the minset of sunrise and sunset you
will place great stake in the position of the Sun in the sky and this
is exactly where you are at, so is everyone else thanks to Newton.In
the early 1920's they jettisoned Newton's geocentric/heliocentric
framehopping and resorted to homocentrism which is why the 'every
valid point is the center of the universe' is paraded today for the
sake of the 'laws of physics'.
Newton's spiel of the Earth around the Sun and the Sun around the
Earth is an unauthorised addition to Kepler's insights on planetary
motion and I assure you it makes all the difference.You cannot
possibly imagine the astronomical damage save that we live in an era
where the more exotic the explanation the better.
"The proportion existing between the periodic times of any two planets
is exactly the sesquiplicate proportion of the mean distances of the
orbits, or as generally given,the squares of the periodic times are
proportional to the cubes of the mean distances." Kepler
If you can determine that the Earth and the Sun can swap positions in
the following diagram then Newton is for you and you are welcome to
him but forget about astronomy or geology never mind trying to link
them.
http://www.absolutebeginnersastronomy.com/sidereal.gif
> The nature of the actual triggering mechanism is I believe still a mystery.
> But I am not even certain of that because there has been some work in this
> area done by researchers in Europe. And I don't yet know if they have been
> able to clearly identify the triggering mechanism. It might be the bending,
> stretching, and compression of fault zone rock layers related to the Solid
> Earth Tide or perhaps something related to the differences between the sun
> and moon gravitational forces related movements of the core of the Earth
> versus those of its crust.
>
> This is a matter that geophysicists can work on. I am personally
> certain that my computer programs, EM signal data, and theories could
> provide them with a doorway to an exciting and valuable new area of science.
> But so far no members of that community have expressed any interest in it.
> I suspect that part of the problem has to do with the fact that celestial
> mechanics are involved. This is not a science which focuses simply on
> geophysics.
>
>
> Regarding copyrights, I am not a legal expert. But I believe that the
> following is the case;
>
> Here in the U.S., whenever you create a drawing, song, research report,
> computer program etc. you are the automatic owner of the copyright for it.
> But if you don't formally apply for a copyright with the U.S. Copyright
> Office then if someone else wants to say that he created the computer
> program etc. you would have to find some other way to prove that you were
> the author. In my opinion it is probably worth the $30 copyright fee to
> avoid hassles like that.
>
> At the top of my computer program there is a section which says that people
> can use it for free. And it says that they can modify it if they wish as
> long as they note in that section of their copy that modifications were
> made. They can also send copies to other people as far as I am concerned.
> What I have said they should not do is claim to be the original author of
> the program or sell copies of it.
>
> Remember, that Perl language computer program was primarily created in the
> hopes that it might save some lives, not generate a fortune from patents or
> copyrights.
------------------------------
Date: 18 Aug 2004 06:27:37 -0700
From: cb8182004@hotmail.com (Palmer Clancy)
Subject: Re: Earthquake forecasting program Aug. 16, 2004
Message-Id: <4c7a939.0408180527.145615f@posting.google.com>
Obviously I'm not the only one here who thinks this thread is a sham -
but glancing through the code the original poster provided I couldn't
find what the catch was. Granted the code was unnecessarily long and
difficult to read (goto???), but at a superficial glance nothing
seemed untoward.
So the question for the rest of you good people out there is - Is this
thread a conniving attempt at trickery? or simply naivete to the
extreme?
------------------------------
Date: Wed, 18 Aug 2004 13:41:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Earthquake forecasting program Aug. 16, 2004
Message-Id: <c0JUc.7338$og.3808@nwrddc04.gnilink.net>
Palmer Clancy wrote:
> Obviously I'm not the only one here who thinks this thread is a sham -
> but glancing through the code the original poster provided I couldn't
> find what the catch was. Granted the code was unnecessarily long and
> difficult to read (goto???), but at a superficial glance nothing
> seemed untoward.
>
> So the question for the rest of you good people out there is - Is this
> thread a conniving attempt at trickery? or simply naivete to the
> extreme?
It is simple stupidity or maybe classic trolling.
We had exactly the same discussion half a year ago already, please see
google for details.
No need to go through the same procedure again.
jue
------------------------------
Date: Wed, 18 Aug 2004 11:16:06 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: editing perl script through TEXTAREA
Message-Id: <2ogl3hFahr3pU1@uni-berlin.de>
anita wrote:
> One other person suggested that I save before converting. I am not
> sure what was meant by that.
Suppose I'm that "other person". Post your code if you want me to
explain further.
> From what I understand, my file has to be processed to replace all
> the special HTML chars before display (so browser wont complain)
No, your file does not need to be processed. Your *data*, whereever it
come from, need to be processed before display.
> and once the user edits and tries to save it through the form, it
> has to be stripped off the special entities, so it can be saved...
No. The form takes care of that.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 18 Aug 2004 09:07:02 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: editing perl script through TEXTAREA
Message-Id: <cfv63q$66f$1@news.simnet.is>
"Abigail" <abigail@abigail.nl> wrote in message
news:slrnci55tt.3tq.abigail@alexandra.abigail.nl...
> anita (anita1766@yahoo.com) wrote on September MCMXCIII in
> <URL:news:1a1fc02.0408171244.3114d5ce@posting.google.com>:
> --
> -- I am trying to get to edit my perl scripts through a form. I'm loading
>
>
> That sounds about as cumbersome and useful as eating soup through
> the keyhole of a door.
naw, you just use one of those bendy straws.
gnari
------------------------------
Date: Wed, 18 Aug 2004 12:50:40 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: editing perl script through TEXTAREA
Message-Id: <pan.2004.08.18.10.50.39.449158@aursand.no>
On Tue, 17 Aug 2004 20:46:05 -0700, anita wrote:
> Lets just say I am editing some file, any file through the form... Not
> necessarily a perl script. That- is a good example because it tends to
> have a lot of special characters.
You still want to use the HTML::Entities module. Here's an example for
you to (hopefully) learn from (untested):
#!/usr/bin/perl
#
use strict;
use warnings;
use HTML::Entities qw( encode_entities );
my $data = 'whatever'; # This is very you read the data you want to
# convert to HTML from a file or something.
$data = encode_entities( $data ); # Convert any "special" characters
# to HTML entities.
# Do whatever you need to do with the converted $data variable.
--
Tore Aursand <tore@aursand.no>
"When you love someone, all your saved-up wishes start coming out."
(Elizabeth Bowen)
------------------------------
Date: Wed, 18 Aug 2004 14:00:59 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: editing perl script through TEXTAREA
Message-Id: <2ogup9Fa8p2bU1@uni-berlin.de>
Gunnar Hjalmarsson wrote:
> anita wrote:
>> One other person suggested that I save before converting. I am not
>> sure what was meant by that.
>
> Suppose I'm that "other person". Post your code if you want me to
> explain further.
Second thought: The test.pl script below should explain the logic that
is my starting-point.
#!/usr/bin/perl -T
use strict;
use warnings;
use CGI::Carp 'fatalsToBrowser';
use CGI 'escapeHTML';
my $q = new CGI;
my $in;
my $file = 'file_to_edit.txt';
if ($ENV{REQUEST_METHOD} eq 'POST') {
$in = $q->Vars;
} else {
if ( open my $f, $file ) {
$in->{content} = do { local $/; <$f> };
} else {
$in->{content} = '';
}
}
open my $f, "> $file" or die $!;
print $f $in->{content}; # here it's saved ...
close $f;
$in->{content} = escapeHTML $in->{content}; # and here it's converted
print $q->header;
print <<FORM;
<form action="test.pl" method="post">
<textarea name="content" cols="50" rows="25">$in->{content}</textarea>
<br>
<input type="submit">
</form>
FORM
__END__
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 18 Aug 2004 06:52:26 -0700
From: johan__l@yahoo.com (Johan Lindstrom)
Subject: Re: How do I pick up existing objects in event handling code?
Message-Id: <cf376ef.0408180552.74ef16ff@posting.google.com>
Graham Wood <Graham.T.removethis.Wood@oracle.andthis.com> wrote in message news:<8S2Uc.30$bW.78@news.oracle.com>...
> I notice that the gui $win object is picked up with code like this:
>
> defined(my $win = $Win32::GUI::Loft::window(winCopyFiles})
> or return (1);
>
> Can I do something similar with Net::FTP objects like
> defined(my $ftp = $Net::FTP);
Yes, you can attach an object to the Win32::GUI::Loft::Design object
you created when loading the design from the .gld file. The property
is called objApp:
Some user-defined object, normally used to connect a
application object responsible for this window.
So if you assign your FTP object (or any object) to the Design like
this (untested code):
my $objDesign = Win32::GUI::Loft::Design->newLoad($fileWindow); #or
die
$objDesign->objApp($ftp);
then you can get it out of the object in the event handlers like this:
my ($win, $design, $ftp) = tglApp('yourWindowName) or die;
Something like that.
I happened to stumble across this post by accident. There is a support
mailing list at the TGL site which I at least read a bit more often:
http://www.bahnhof.se/~johanl/perl/Loft/
/J
------------------------------
Date: 18 Aug 2004 07:02:36 -0700
From: schimata2@yahoo.com (srini)
Subject: How to upload a file from a user's desktop to a web server?
Message-Id: <5fc50f33.0408180602.37c59e62@posting.google.com>
Hi all,
I am writing a HTML/CGI perl script to attach a file from a HTML
submit form and to store that attachment in a tmeporary variable on
the web server that hosts the perl script.
snippet of code:
HTML part:
---------------
<tr><td colspan="2"> <FONT color=black>Attachment (if any):</FONT><BR>
<INPUT type="file" size=50 name="attachedfile" ALLOW="text/*">
</td></tr>
--------------
Perl code:
-----------------------------------------------
$attachedFile = $query -> param ("attachedfile");
# $attachedFile =~ s/\\/\\\\/g;
------------------------------------------------
Now I want to capture the file attachment from a user's desktop and
upload it into a temp variable on the web server. I tired to use
fielfield() and tmpFileName() functions, but in vain.
Can some boby kindly tell me how my perl code should be modified so
that I can store the $attachedFile in to $temp variable on the web
server?
Thanks in advance,
Srini
------------------------------
Date: Wed, 18 Aug 2004 16:30:44 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: How to upload a file from a user's desktop to a web server?
Message-Id: <pan.2004.08.18.14.30.44.32096@aursand.no>
On Wed, 18 Aug 2004 07:02:36 -0700, srini wrote:
> Can some boby kindly tell me how my perl code should be modified so that
> I can store the $attachedFile in to $temp variable on the web server?
Read the documentation for the CGI.pm module. You could also do a search
on this group (using Google). This question has been answered multiple
times in the past.
--
Tore Aursand <tore@aursand.no>
"What we do is never understood, but only praised and blamed."
(Friedrich Nietzsche)
------------------------------
Date: Wed, 18 Aug 2004 14:30:08 GMT
From: bowsayge <bowsayge@nomail.afraid.org>
Subject: Re: Materializing an indirect sort using only swap
Message-Id: <QJJUc.1686$2L3.98@newsread3.news.atl.earthlink.net>
Jeff 'japhy' Pinyan said to us:
>
> Sorry this took so damn long. I couldn't figure out where I was going
> wrong until I realized I needed two additional arrays, not just one:
>
> # use like so:
> multi_swap($the_object, \@new_indices);
>
> sub multi_swap {
> my ($object, $o) = @_;
> my @P = my @R = 0 .. $#$o;
>
> for (0 .. $#$o) {
> next if $P[$$o[$_]] == $_;
> swap($object, $P[$$o[$_]], $_);
> (@P[$R[$_], $$o[$_]], @R[$P[$$o[$_]], $_ ]) =
> (@P[$$o[$_], $R[$_] ], @R[$_, $P[$$o[$_]]]);
> }
> }
>
> # replace this as you see fit
> sub swap {
> my ($a, $x, $y) = @_;
> @$a[$x,$y] = @$a[$y,$x];
> }
>
> I think I can explain the algorithm, but it's a bitch. It does it in one
> pass, making it O(N).
Bowsayge also tried it. It's just like you said, a b****.
This program creates a sorted array of indexes. Then it
swaps based on those indexes. It should never require more
than N swaps.
Here is the program:
if (1) {
# my (@array) = qw(16 22 5 33 45 1 9 25 45 37 26 47
# 40 48 42 30 45 33 17 26);
my @array = map int(rand(60)), (1..21);
my $cmpfn = sub { $_[0] <=> $_[1] };
print "array: @array\n";
my $cnt = sort_index_swap(\@array, $cmpfn);
print "array: @array\n";
print "swap count: $cnt\n";
}
sub sort_index_swap {
local *::objs = shift @_;
our @objs;
my $cmpfn = $_[0];
my @sortidx = sort {
$cmpfn->($objs[$a], $objs[$b])
} (0..$#objs);
my $swapcnt = 0;
foreach ($[..$#sortidx) {
my ($pri, $sec) = ($_, $sortidx[$_]);
if ($pri == $sec) { next }
($objs[$sec], $objs[$pri]) = ($objs[$pri], $objs[$sec]);
foreach (@sortidx[$pri+1..$#sortidx]) {
$_ = $sec if ($_ == $pri);
}
$swapcnt++;
}
$swapcnt;
}
--
my (@str) = split //,'wle.oertahruenenp bits J';
my (@ndx, @arr) = qw(20 16 23 24 7 10 15 3 5 9 11 1 14
18 19 6 13 12 4 21 22 8 2 17 0);
$arr[$ndx[$_]] = $str[$_] for (@ndx); print @arr, "\n";
------------------------------
Date: 18 Aug 2004 14:56:40 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Materializing an indirect sort using only swap
Message-Id: <cfvqn8$dln$2@mamenchi.zrz.TU-Berlin.DE>
bowsayge <bowsayge@nomail.afraid.org> wrote in comp.lang.perl.misc:
> my (@str) = split //,'wle.oertahruenenp bits J';
> my (@ndx, @arr) = qw(20 16 23 24 7 10 15 3 5 9 11 1 14
> 18 19 6 13 12 4 21 22 8 2 17 0);
> $arr[$ndx[$_]] = $str[$_] for (@ndx); print @arr, "\n";
The first statement on the last line is the same as
@arr[ @ndx[ @ndx]] = @str[ @ndx];
Since @ndx is a permutation of 0 .. 24, that is the same as
@arr[ @ndx] = @str;
Of course, this is a Japh, so the normal rules of programming don't
necessarily apply.
Anno
------------------------------
Date: 18 Aug 2004 07:27:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: My own handy Pocket Reference notes
Message-Id: <slrnci6169.3tq.abigail@alexandra.abigail.nl>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on September MCMXCIII
in <URL:news:86brh9xvt6.fsf@blue.stonehenge.com>:
}}
}} Because it breaks as a general pattern. Witness:
}}
}} use constant INCOMING => "/tmp/incoming.file.txt";
}} ...
}} rename INCOMING => $new or die "Cannot rename ... ";
}}
}} The problem is that once you start showing the pattern, the newbies
}} will combine it, not realizing that a fat arrow autoquotes the left
}} arg. Ooops. Cargoculting breaking things again.
So what? At least with 'rename' it's very likely it'll die. But what about:
$seen {INCOMING} = 1;
Should we now stop using hashes because newbies might not realize the
autoquoting of hash keys? If not, then why not using fat arrows?
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 18 Aug 2004 07:31:36 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: My own handy Pocket Reference notes
Message-Id: <slrnci61eo.3tq.abigail@alexandra.abigail.nl>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on September MCMXCIII
in <URL:news:86smaly8a6.fsf@blue.stonehenge.com>:
-: >>>>> "Ala" == Ala Qumsieh <notvalid@email.com> writes:
-:
-: Ala> David Filmer wrote:
-: >> To set a variable to the greater (larger) of two choices:
-: >> $var = ($a > $b) ? $a : $b;
-:
-: Ala> I find this a bit more amusing, although less maintainable:
-:
-: Ala> $var = [$b => $a] -> [$b <= $a];
-:
-: And more expensive. All the work to create an anonymous list, then an
-: anonymous array from that, take a reference to it, dereference it, and
-: then pull one of the two items back out, and then discard the array
-: and the list value.
-:
-: Ugh.
-:
-: Please shoot the person who came up with that cute hack.
The first time I saw this "hack" was on page 245 of "Effective Perl
Programming" by Joseph N. Hall with Randal L. Schwartz. You might have
heard of the book. It's attributed to Phil Abercrombie.
Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
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 6879
***************************************