[16290] in Perl-Users-Digest
Perl-Users Digest, Issue: 3702 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 18 03:05:38 2000
Date: Tue, 18 Jul 2000 00:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963903915-v9-i3702@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 18 Jul 2000 Volume: 9 Number: 3702
Today's topics:
???How to make Daemon in Perl without Cron? pastan@my-deja.com
Re: [NEWBI] Reg Exp request for help (Craig Berry)
Re: Attatchments from client (Mark W. Schumann)
Re: closing read-only filehandles [was: Read a file int <lr@hpl.hp.com>
Re: date in YYYYMMDDHH24MISS format <bcaligari@shipreg.com>
Re: DBI/Oracle/bind_param/boolean <rereidy@indra.com>
Re: Difference between a .cgi file and a .pl file? <peter.sundstrom@eds.com>
Re: Difference between a .cgi file and a .pl file? <joe.kline@sdrc.com>
difference between running perl from command line and w (Shao Zhang)
Re: difference between running perl from command line a (Mark W. Schumann)
escaping HTML [was: limits on GET] (jason)
Re: escaping HTML [was: limits on GET] (Prasanth A. Kumar)
Re: escaping HTML [was: limits on GET] (jason)
Re: Flock unsupported on which systems? (William Herrera)
Re: how to convert "1.2.3.10" to "01020310"? (Craig Berry)
Re: limits on GET <godzilla@stomp.stomp.tokyo>
Re: limits on GET (Prasanth A. Kumar)
Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? (brian d foy)
NEW: AI::NeuralNetwork - idea, comments <jdb@wcoil.com>
Re: Newbie - "open for read" w/ perl function (not shel (jason)
Re: Newbie Question (Mark W. Schumann)
Re: Perl can't add ! (Ilya Zakharevich)
Re: Perl Expert? I need help! (Bernard El-Hagin)
Re: Please help me this this <ttompkins@uswest.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Jul 2000 05:32:00 GMT
From: pastan@my-deja.com
Subject: ???How to make Daemon in Perl without Cron?
Message-Id: <8l0q4g$1mb$1@nnrp1.deja.com>
Hello All,
I need to schedule my tasks without. But unfortunately I don't have an
opportunity to use Cron or similar. How can I implement scheduling
by means of Perl functions such as fork, kill,...?
Thank You, all
Regards,
Andrew
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 18 Jul 2000 06:12:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <sn7ta187o53102@corp.supernews.com>
Keith Calvert Ivey (kcivey@cpcug.org) wrote:
: cberry@cinenet.net (Craig Berry) wrote:
: >First, be aware that any attempt to impose case on names is doomed. How
: >do you handle e.g. MacMann? And there are a zillion other cases where
: >that came from.
:
: You put in a special case for the MacDonalds and annoy the
: Macdonalds. That's why Amazon lists an "McSe Training Kit".
Oh, that's beautiful! I'm stealing that as an example for the next time
this comes up.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: 18 Jul 2000 02:02:21 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Attatchments from client
Message-Id: <8l0rtd$ggh@junior.apk.net>
In article <39734FA5.D5D19471@muskegon.k12.mi.us>,
<cpoole@muskegon.k12.mi.us> wrote:
>I have installed Mail::Sender by JENDA and it works well for
>attatchments that reside on the server; however, what if I want to send
>an attatchment from my client workstation? Does anyone know of the
>command I would use to to send a attatchment from my client workstation
>(i.e. like a MS word file from my PC) or is there another module out
>there which would be better for me to use.
It depends. If the Perl program is running on the "server" then your
"client" probably isn't even visible to it. Is this a CGI question
in disguise?
>I would appreciate any advice anyone can give me. Thank You.
First refine the question. What happens when you try to send a file
from your client PC?
------------------------------
Date: Mon, 17 Jul 2000 22:35:54 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: closing read-only filehandles [was: Read a file into a hash ?]
Message-Id: <MPG.13dd8c91b12d3fba98abdd@nntp.hpl.hp.com>
In article <MPG.13de73b7c8a0cdaf9896e4@news>, elephant@squirrelgroup.com
says...
> Eric Bohlman wrote ..
> >jason (elephant@squirrelgroup.com) wrote:
> >: surely the closing of read filehandles is pro-active programming -
> >: preventing problems that arise from unforseen uses of our code .. the
> >: filehandle is going to be closed at some point - so why not do it
> >: explicitly when we're finished with it
> >
> >Didn't we have a thread a few weeks ago where somebody's problem turned
> >out to be that they were trying to unlink or rename a file on a Win32
> >system and they couldn't because they still had it open for reading?
>
> I didn't catch that one .. I'd be interested to read it - and read why
> people still see closing read-only filehandles as pointless
This thread has gone somewhat astray.
Let us define 'pointless' as 'having no operational effect'. It is
indeed pointless to check for success when closing a read-only
filehandle. Whether it is pointless to close the file explicitly
depends on the circumstances of future access, as I said. Evidently
closing the file simply to document that it is no longer being used
might be considered enough 'point' by some.
> can you remember the subject - or part thereof so I can look it up ?
I don't remember the subject; I do remember suggesting the solution --
close the file before unlinking or renaming it!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 18 Jul 2000 07:58:33 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: date in YYYYMMDDHH24MISS format
Message-Id: <8l0r2j$s62$1@news.news-service.com>
<rrubin@rotor.net> wrote in message news:8kvhp2$3n2$1@nnrp1.deja.com...
> Hello,
>
> I need to format a date in the following format
>
>
> YYYYMMDDHH24MISS
>
>
> Any help would be appreciated.
>
> RR
localtime(time) returns a list of all the 'date/time elements (year,
min, etc) Care should be taken as the year 'returned' should
be added to 1900 and the 'month' is in the region 0-11 when
we have been brought up calling January as month 01.
(if you're on a unix box try "man ctime");
"sprintf" can let you format your string nicely
Brendon
------------------------------
Date: Mon, 17 Jul 2000 22:41:29 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: DBI/Oracle/bind_param/boolean
Message-Id: <3973DFF9.7D9424FF@indra.com>
grfalk@my-deja.com wrote:
>
> Help!
>
> Using DBI and DBD::Oracle, how do you use the
> bind_param_inout method to associate a local Perl
> variable to a BOOLEAN type parameter in a stored
> procedure call, or to a stored function's return
> value that is of type BOOLEAN? There appears to
> be no DBD variable type associated with the
> Oracle BOOLEAN variable type. No matter what DBI
> variable type I use in the bind_param_inout
> method call, I always receive the following error
> upon execution of the SQL statement: "PLS-00306:
> wrong number or types of arguments in call
> to '<stored procedure/function name>'". If I
> change the BOOLEAN variable in the stored
> procedure to VARCHAR2 or NUMBER, everything works
> fine.
>
> Is this possible to do? I find it hard to believe
> that it's not. Thank you in advance for your
> responses!
>
> Gary
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Gary,
A boolean type is a PL/SQL type. Perl does not have a data type that is
equivalent. You will need to wrap your SP call around an anonomous
PL/SQL block and interprit/convert the boolean return value into a
datatype Perl can use (i.e. integer).
Good luck.
--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.
------------------------------
Date: Tue, 18 Jul 2000 16:20:35 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <8l0lvr$ocj$1@hermes.nz.eds.com>
Alon Rachamim wrote in message <3973653c@news.bezeqint.net>...
> I think and for what I tested no difrence only .cgi can be for other
script
> language and .pl is for Perl only
I can call my Perl script foo.fred or foo.java or foo.c and it will still be
a Perl script.
------------------------------
Date: Tue, 18 Jul 2000 02:41:20 -0400
From: Joe Kline <joe.kline@sdrc.com>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <3973FC0F.9A9D63C7@sdrc.com>
"Jürgen Exner" wrote:
> <SNIP>
> But maybe you wanted to ask what is the difference between a Perl file and a
> CGI file?
> <SNIP>
> Perl just being one among many.
For some odd reason I had a flashback to "Full Metal Jacket":
This my Perl script this is my CGI.
One is for fightin' one is for fun.
---
(With sincerest apologies to the Marine Corps and the Rifle Creed)
This is my Perl. There are many like it, but this one is mine.
My Perl is my best friend. It is my life. I must master it as I must master my
life.
My Perl, without me is useless. Without my Perl, I am useless. I must code my
perl true. I must code before the Bill shoots me. I will...
My Perl and myself know that what counts in this war is not the lines we code,
the noise of our line, nor the obfuscation we make. We know that it is the code
that counts. We will code...
My Perl is pure, even as I, because it is my life. Thus, I will learn it as a
brother. I will learn its weaknesses, its strengths, its parts, its
accessories, its JAPHs, and its one-liners. I will ever guard it against the
ravages of Bill and VB. I will keep my Perl clean and ready, even as I am clean
and ready. We will become part of each other. We will...
Before Larry I swear this creed. My Perl and myself are the defenders of my
Three Virtues. We are the masters of our enemy. We are the saviors of my life.
So be it, until victory is Perl's and there is no enemy, but Users!
Hey, I just finished watching "Evil Dead II" after a full day of tutorials...
--
Joe Kline
It takes a lot of brains to enjoy satire, humor, and wit;
but none to be offended by them. ---The Midnight Skulker
------------------------------
Date: 18 Jul 2000 14:18:22 +1000
From: shao@linux.cia.com.au (Shao Zhang)
Subject: difference between running perl from command line and web
Message-Id: <3973da8e@news>
Hi,
I am having some strange problems with perl.
For example:
$output = `echo name=value | lynx -post_data -dump
"www.blah.com/cgi-bin/blah.cgi"`;
Now, with earlier perl versions, this works from both command line and
web(as an cgi program). However, recently, I upgraded to perl5.005 and
now it only works from command line and not web anymore.
Any ideas?
Shao.
--
____________________________________________________________________________
Shao Zhang - Running Debian 2.1 ___ _ _____
Department of Communications / __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _
University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` |
Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@cia.com.au |___/
_____________________________________________________________________________
------------------------------
Date: 18 Jul 2000 01:57:59 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: difference between running perl from command line and web
Message-Id: <8l0rl7$fo5@junior.apk.net>
In article <3973da8e@news>, Shao Zhang <shao@linux.cia.com.au> wrote:
> I am having some strange problems with perl.
>
> For example:
>
> $output = `echo name=value | lynx -post_data -dump
> "www.blah.com/cgi-bin/blah.cgi"`;
>
> Now, with earlier perl versions, this works from both command line and
> web(as an cgi program). However, recently, I upgraded to perl5.005 and
> now it only works from command line and not web anymore.
>
> Any ideas?
How do you know it doesn't work? (i.e., what problems occur?)
Have you tried -w and strict?
Have you checked that lynx is still in your $PATH?
If you are using CGI.pm, have you turned on debugging? If not, why not?
Did you really use a URL without the (presumed) "http://" prefix?
------------------------------
Date: Tue, 18 Jul 2000 04:34:30 GMT
From: elephant@squirrelgroup.com (jason)
Subject: escaping HTML [was: limits on GET]
Message-Id: <MPG.13de7ba95265afda9896e6@news>
Prasanth A. Kumar wrote ..
>This brings up a related question... in the Perl CGI module, is there
>a function to do the encoding for href inside of anchor tags?
escape
it's not part of any of the export tags so you need to import it
explicitly
use CGI qw'escape';
works as you'd expect
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Tue, 18 Jul 2000 04:46:40 GMT
From: kumar1@home.com (Prasanth A. Kumar)
Subject: Re: escaping HTML [was: limits on GET]
Message-Id: <m3g0p8hwpb.fsf@C654771-a.frmt1.sfba.home.com>
elephant@squirrelgroup.com (jason) writes:
> Prasanth A. Kumar wrote ..
> >This brings up a related question... in the Perl CGI module, is there
> >a function to do the encoding for href inside of anchor tags?
>
> escape
>
> it's not part of any of the export tags so you need to import it
> explicitly
>
> use CGI qw'escape';
>
> works as you'd expect
>
> --
> jason -- elephant@squirrelgroup.com --
I don't think I saw that in the man pages. I there a standard way to
find about these kind of commands? Or do I just look at the source?
--
Prasanth Kumar
kumar1@home.com
------------------------------
Date: Tue, 18 Jul 2000 04:53:14 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: escaping HTML [was: limits on GET]
Message-Id: <MPG.13de80101594645d9896e7@news>
Prasanth A. Kumar wrote ..
>elephant@squirrelgroup.com (jason) writes:
>
>> Prasanth A. Kumar wrote ..
>> >This brings up a related question... in the Perl CGI module, is there
>> >a function to do the encoding for href inside of anchor tags?
>>
>> escape
>>
>> it's not part of any of the export tags so you need to import it
>> explicitly
>>
>> use CGI qw'escape';
>>
>> works as you'd expect
>
>I don't think I saw that in the man pages. I there a standard way to
>find about these kind of commands? Or do I just look at the source?
it's not documented .. and yes there's a standard way - however - the
standard way _is_ to look at the source ;)
(the non-standard way is to guess)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Tue, 18 Jul 2000 04:30:44 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Flock unsupported on which systems?
Message-Id: <3973dd08.599646139@news.rmi.net>
On 17 Jul 2000 15:18:59 GMT, The WebDragon <nospam@nospam.com> wrote:
>
>flock(); is unsupported on the current version of MacPerl (which problem
>will definitely go away with MacOS X (since it will run perl natively),
>and may possibly go away with the next release of MacPerl (if and when
>it gets released .. current version (520r4) is essentially 5.004)
Well, there is always the File::FlockDir module on CPAN, which enables flock
across networks and on Windows9x and MaxPerl. Though it really has not been
used much on Macs AFAIK.
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: Tue, 18 Jul 2000 06:10:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to convert "1.2.3.10" to "01020310"?
Message-Id: <sn7t63sno53115@corp.supernews.com>
Abigail (abigail@delanet.com) wrote:
: [] Nope. This is reasoned. map must accumulate results and build a list
: [] only to throw it away; for does not carry this overhead. As the two have
: [] roughly equal notational convenience, it makes sense to use the more
: [] efficient choice.
:
: map, of course, doesn't have to. Every other function in Perl is able
: to figure out its context, and act accordingly. I've never heard any
: convincing argument (in fact, I've never heard any argument) why map
: has to build a list regarding of its context. The fact that map does is
: a bug in perl. In perl that is, not in Perl. There's no reason to avoid
: map in Perl. There is a reason to fix the implementation of map in perl
: though. However, it has been known for a long, long time, but hasn't been
: found important enough to fix.
Of course. And more important, the efficiency argument is far less
central than the documentation-of-intent argument. foreach communicates
an intention to operate purely for side effects; map communicates an
intention to operate functionally. Speaking as someone who has had to
maintain a *lot* of old code (my own included), I state with some force:
The more you can do through coding conventions (applied fairly uniformly,
if informally) to make your code easy to eyeball-parse, the easier your
job will be when you're trying to brush aside the cobwebs a year from now.
: I don't see a reason to change my programming habits for your strange
: parser. If you see a print, do you think "where will the resulting
: value go"? As for strings, I am really baffled. Why on earth would you
: backtrack? How do you read single quoted strings? If you read English,
: do you do that letter by letter as well? I guess that use of qq or q
: gives you a nervous break down. All those different delimiters! I hope
: noone will ever tell you about autoquoted barewords. You'd experience
: a brainmelt!
Reductio ad absurdem won't get you far. I'm not saying I can't read any
arbitrary odd use of Perl syntax, nor that I apply a uniform and
mechanical rule requiring e.g. checking of print's return value. I *am*
saying that I take the easy "eyeball parser optimizations" -- things like
choosing quote syntax and map vs. foreach based on intended use -- as
consistently as I can managed. Even if I save only a tenth of a second of
brain processing per line of code read, that still adds up to a long lunch
on Friday. :)
: [] A lot of this stuff falls into the same more general category as e.g.
: [] indenting your code, or including comments. Perl doesn't care, but *you*
: [] will, or the maintenance programmer who comes after you.
:
: If a programmer gets confused if there's no interpolation happening in
: a double quoted string, then than programmer should not program.
I think perhaps you're picturing me coming to a screeching halt, jaw
hanging slack as I stare dumbfounded at the interplation-free dquoted
string. It's more like a flash of mental setup followed instants later by
a flash of self-correction. I see e.g.
$foo = "Here's a very &//? long and sym&^bol-\$rich string blah blah!";
deep inside the program somewhere. I can't grok that string all at once,
so I prepare to scan it for stuff of interest. Being double-quoted, I'm
looking for the whole family of escapes, plus interpolations. At the same
time, I'm forming hypotheses about what $foo might be used for just below,
what variables might be important that were mentioned right above, and how
they might help build $foo. Then I actually scan the string, find it
could have been single-quoted, and change my model to fit the '$foo starts
off as a statically-defined string' reality. All of this goes on in an
instant, without conscious effort, since I've been doing this for a while.
But it *does* take a tiny bit more work and time than would be the case if
the string were single-quoted. And tiny bits add up.
: BTW, don't tell me you ever do s/^\s+//;, you should of course be doing
: s'^\s+'';. You wouldn't want to confuse the maintenance programmer, having
: to backtrack a 4 character string for missing interpolation!
Again, reductio ad absurdem. Oh, and I reserve the right to pick and
choose, too. :)
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Mon, 17 Jul 2000 21:06:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: limits on GET
Message-Id: <3973D7DE.A151884C@stomp.stomp.tokyo>
Joshua McAdams wrote:
> I am calling a cgi via A HREF and when I recieve my key/value pairs, I get
> all but the last one. A wierd looking char is appearing instead. Is there
> a limit on the size of the HREF I am passing.
> here is the line that is being sent:
(snippage)
> ... §ion_to_modify=RealEst ...
> // section_to_modify shows up as ion_to_modify=RealEstate
> in the browser window and as soon as I get the string from
> the GET, it looks this way. There is some odd char that
> shows up before it
Change §ion to: &§ection
&§ection_to_modify=RealEstate
Much prettier, don't you think?
Guaranteed your problem will vanish.
Prudent advice would be to suggest
you research "html entities" for
an authoritative answer.
> (Sorry if my terminology isn't the best...
> started with perl and cgi's today)
Honestly and truly?
Godzilla!
--
$godzilla = "godzilla rocks!";
srand(time() ^ ($$ + ($$ << 15)));
sub randcase
{ rand(40) < 20 ? "\u$1" : "\l$1" ; }
$godzilla =~ s/([a-z])/randcase($1)/gie;
print $godzilla; exit;
------------------------------
Date: Tue, 18 Jul 2000 04:07:17 GMT
From: kumar1@home.com (Prasanth A. Kumar)
Subject: Re: limits on GET
Message-Id: <m3puoculn0.fsf@C654771-a.frmt1.sfba.home.com>
ebohlman@netcom.com (Eric Bohlman) writes:
> Joshua McAdams (jmcada@hotmail.com) wrote:
> : I am calling a cgi via A HREF and when I recieve my key/value pairs, I get
> : all but the last one. A wierd looking char is appearing instead. Is there
> : a limit on the size of the HREF I am passing.
> : here is the line that is being sent:
> : <a
> : href="http://classifiedcafe.com/cgi-bin/classifieds/classifieds.cgi?session_
> : key=39738f2539caa29a&modify_sections_input_form=on§ion_to_modify=RealEst
> : ate">Modify General Options</a>
> :
> : // section_to_modify shows up as ion_to_modify=RealEstate in the browser
> : window and as soon as I get the string from the GET, it looks this way.
> : There is some odd char that shows up before it
>
> This is actually an HTML problem; your browser is interpreting "§" as
> an entity reference to a character representing a section symbol.
> Ampersands in URLs that appear in HTML documents need to be escaped as &.
This brings up a related question... in the Perl CGI module, is there
a function to do the encoding for href inside of anchor tags?
--
Prasanth Kumar
kumar1@home.com
------------------------------
Date: Tue, 18 Jul 2000 02:25:23 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <brian-1807000225240001@59.sanjose-08-09rs16rt.ca.dial-access.att.net>
In article <8l03b1$ho9$1@nnrp1.deja.com>, vartekquest@my-deja.com wrote:
> The question is: is it possible to share both PHP, mod_perl and
>mod_ssl built on an Apache server?
yes.
> Or is it just plain stupid compiling
>mod_perl when you have PHP?
depends what you want to do.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 18 Jul 2000 05:11:37 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l0ou9$ml0$0@206.230.71.42>
Greetings perlfolk,
I have finished a new module designed to simulate simple neural
networks completly with Perl. I am writing to .modules mainly to
see if anyone has any objections to the namespace, or suggestions
for a better namespace.
Synopsis:
use AI;
my $net = new AI::NeuralNetwork($number_of_layers,$neurons_per_layer);
$net->learn(\@input_pattern_to_learn,\@desired_output_pattern);
my $output_array_ref = $net->run(\@new_pattern_to_test_network_with);
Description:
AI::NeuralNetwork allows creation of simple neural networks using only
perl.
You can teach it to associate patterns together, and then present it with a
completly
new pattern and it will attempt to match it with the best possible result
from the
stored patterns in the network.
The network learns via a generlalzation of the Delta rule combined with
a
makeover of Hobbs rule. It uses back-prop. for error-correction, and neurons
assume a single threshold value of 1 or 0.
I am putting the final touches on this version of the network code to get it
ready
for upload to CPAN under cpan author id JBRYAN. Any comments or criticims
about this module from the posting are welcome! :-) I will try to remember
to announce in CPLA when I upload the first public release of this module.
Cheers!
~ josiah
--
--
Josiah Bryan
VP of Product Development
TDCJ, Inc.
"Anything is possible."
vp@tdcj.com
http://www.josiah.countystart.com/
Tel: 937.316.6256
------------------------------
Date: Tue, 18 Jul 2000 04:21:29 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Newbie - "open for read" w/ perl function (not shell)
Message-Id: <MPG.13de789875ccf8859896e5@news>
santi_fisher@my-deja.com wrote ..
>I want to fetch a remote web page and extract certain information from
>it to send in an email. I plan to use LWP::Simple's "getprint" function
>to get the html code.
>
>I thought the most elegant way to pipe getprint's STDOUT in order to
>process it would be something like:
>
>open (HTML, "getprint 'http://webserver.com/specific.page.html' |");
>
>but I'm realizing that this kind of "open for reading" only applies to
>shell processes and not to perl functions like getprint (am I right
>here?).
yes .. you're right there .. of course you could always open the Perl
shell process
open HTML, q[perl -MLWP::Simple -e"getprint q[<URL>]" |] or die $!;
it's a bit messy though - see below
>What would be the best workaround for this ? I want to avoid writing
>html code to a local file and then working on it. Should I read html
>into an array ? Or is there a way to work directly with an "open for
>reading" filehandle like I mentioned ?
while LWP::Simple is very nice .. for something like this you may want
to bypass the simple methods and use LWP::UserAgent directly .. see the
lwpcook documentation
perldoc lwpcook
read the LARGE DOCUMENTS section .. this shows how to handle large
documents by providing a code reference to the Request method on an
LWP::UserAgent object (which is all that getprint does anyway)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 18 Jul 2000 02:04:32 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Newbie Question
Message-Id: <8l0s1g$h1f@junior.apk.net>
In article <zUOc5.13893$c5.37740@newsfeeds.bigpond.com>,
Allanon69 <allanon.69@no.spam.bigpond.com> wrote:
>Anyway the problem is that I'm reading in a file, getting the title and
>later searching for the title so I can replace it with some other text. The
>line below works fine if the text is one word, eg "FRED". However if it
>includes several words with spaces it doesn't match, eg. "FRED AND BARNEY".
>I can't seem to find anything to give me a hint as to what to do here...
>should I be quoting the $search with qw?
>.
>.
>($first_pass = $_) =~
>s{(</)(a|h[1..6])((\s.*?)?>)$search.*?(</)(a|h[1..6])(>)}{}isx;
>.
Note that your code will only pick out things delimited by ANCHOR
and HEADER tags, and not even that very well. It also seems to
depend on not having nested tags. Beyond that it's hard to know
out of context what this thing really does.
Have you tried HTML::Parser?
------------------------------
Date: 18 Jul 2000 05:07:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl can't add !
Message-Id: <8l0omn$i7r$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@delanet.com>],
who wrote in article <slrn8n7hpb.ibq.abigail@alexandra.delanet.com>:
> "" >Algebraic numbers can be represented perfectly in finite amount of memory.
> "" >After all, algebraic numbers are roots of finite degree polynooms,
> "" >with integer coordinates. The square root of 2 for instance is a root
> "" >of f(x):x^2 - 2.
> "" If you can represent them, that's great. But, can you do arithmetic on
> "" them? You can always do things symbolically, but ultimately you may
> "" want to have an actual value for your expression.
>
> Yes, you can (the set algebraic numbers is closed under addition,
> multiplication, subtraction, division and root extraction). There was
> an (invited) talk at the Canadian Conference for Computational Geometry
> (Waterloo, 1993) by Chee Yap where he did exactly this. Unfortunally, the
> paper doesn't appear in the conference proceedings and I have forgotten
> the details.
perl -MMath::Pari=:DEFAULT,Mod -wle '
$x = PARIvar "x"; $root_2 = Mod($x, $x**2 - 2);
print 12 if $root_2*$root_2 == 2'
12
perl -MMath::Pari=:DEFAULT,Mod -wle '
$x = PARIvar "x"; $y = PARIvar "y";
$root_2 = Mod($x, $x**2 - 2);
$root_3 = Mod($y, $y**2 - 3);
$t = $root_2 + $root_3;
print 12 if ($t**2 - 5)**2 == 24'
12
But working with algebraic numbers as solutions to equations is not
enough. $s = sqrt(2) is not completely described by $s**2 - 2 == 0,
since -sqrt(2) is also a root. Thus to work with algebraic numbers
one needs two pieces of info: the equation, and an approximation: say,
a pair (x**2 - 2, 1) denotes "the root of x**2 - 2 = 0 which is closest
to 1".
Given such two such representation for x and y, Math::Pari allows
finding the equation which, say, x+y satisfies. However, to find an
*apropriate* approximation to x+y it is not enough to add the *given*
approximations of x and y. Say, 2 is an appropriate approximation for
sqrt(2), 1 is appropriate for sqrt(3), but 2-1 is not appropriate for
sqrt(2)-sqrt(3). [It corresponds to sqrt(3)-sqrt(2) which is the root
of the same equation.]
One may need to *improve* the given approximations before doing the
arithmetic operation. [To simplify this, one may require that the
given approximation is in the basin of attraction of Newton method.]
Additionally, the equation for x+y may be decomposable (consider
sqrt(2)+sqrt(2), which satisfies not s**2 - 8 = 0, but s*(s**2 - 8) ==
0, so one may need to find which of the factors the exact sum satisfies.
Anyway, I think that writing a package (based on Math::Pari) for such
manipulations may be a nice exercise for a rainy evening. Any takers?
Ilya
------------------------------
Date: Tue, 18 Jul 2000 06:24:25 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Perl Expert? I need help!
Message-Id: <slrn8n7to4.90q.bernard.el-hagin@gdndev25.lido-tech>
On 17 Jul 2000 18:40:14 GMT, Greg Snow <snow@statsci.com> wrote:
>In article <CNGb5.399$Ew5.9130@news6-win.server.ntlworld.com>,
>Cal Henderson <cal@iamcal.com> wrote:
>>
>>"Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote...
>>:
>>: #!/usr/bin/perl -w
>>: use strict;
>>:
>>: my $a = "My name is Sylvain";
>>: $a =~ s/\s+//g;
>>: $a =~ s/^(.{8}).*$/$1/;
>>:
>>: print $a;
>>
>>can this be done in a single reg ex?
>
>my $a = "My name is Sylvain";
>$a =~
>s/(\S)\s*(\S)\s*(\S)\s*(\S)\s*(\S)\s*(\S)\s*(\S)\s*(\S).*/$1$2$3$4$5$6$7$8/s;
>
>print $a;
You're just being silly. :-)
>But I think that the other methods suggested are probably better in most
>cases.
I can't help but agree. ;)
Bernard
--
perl -e'@x=(3,2,4,1,3,2,1,3,1,3,2,3,3,2,3,0,0,1,2,1,1,1,4,1,2,1,1,2,2,1,
2,1,2,1,2,1,2,1,1,1,2,1,0,0,3,2,3,2,3,2,1,1,1,1,1,2,4,2,3,2,1,2,1,0,0,1,
2,1,1,1,4,1,2,1,1,1,2,2,1,1,4,1,1,1,2,1,1,1,2,1,0,0,3,2,4,1,1,2,1,1,1,3,
1,1,1,4,1,1,1,2,1,1,3,0,0);sub x{print q x$xx$_;print q x x x shift@x};#
while(defined($_=shift @x)){s o0o\no;$_!=0?x:print}' #Symmetry yrtemmyS#
------------------------------
Date: Mon, 17 Jul 2000 22:36:42 -0700
From: "Tim Tompkins" <ttompkins@uswest.net>
Subject: Re: Please help me this this
Message-Id: <OMTc5.2345$7Y2.526895@news.uswest.net>
You may want to consider moving the close(LOGIN) statement outside of the
while loop.
You're closing the file after reading the first line :o)
Thanks,
Tim Tompkins
----------------------------------------------
Programmer / Staff Engineer
http://www.arttoday.com/
----------------------------------------------
<suzbik@btinternet.com> wrote in message news:8kv0cf$l9h$1@nnrp1.deja.com...
> Hello,
>
> I have been working on this script but i cannot get it to work properly.
>
> The idea is that the customer enters their reference number and password
> and the script looks it up from a flat file database.
>
> The problem is that when i type in a reference number it will only find
> the details if the reference number is 10233 (which is the first row)
> if i try others then it doesnt work.
>
> can someone tell me why?
>
> The script is at: http://www.neighbourscan.co.uk/cgi-bin/check.pl
> To see what it should look like enter 10233 as the ref number and the
> passwod doesnt matter as i have not made it check that yet.
>
> The code is at: http://www.neighbourscan.co.uk/check.txt
> and the database is at: http://www.neighbourscan.co.uk/check-db.txt
>
> Thankyou
>
> Ben Periton
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3702
**************************************