[11413] in Perl-Users-Digest
Perl-Users Digest, Issue: 5013 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 11:07:34 1999
Date: Mon, 1 Mar 99 08:03:10 -0800
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 Mar 1999 Volume: 8 Number: 5013
Today's topics:
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Newbie problems with CGI/Perl <zosima@geocities.com>
Newbie question johan.levin@mbox300.swipnet.se
Re: News::NNTPClient 480 Authentication (Phillip George Geiger)
nmake, adding modules in Win 98 tbird99@my-dejanews.com
Re: nmake, adding modules in Win 98 (Randy Kobes)
Non-greedy regex efficiency (Ronald J Kimball)
Re: Non-greedy regex efficiency (Abigail)
Re: Non-greedy regex efficiency (Ilya Zakharevich)
Re: Numeric Sort <jdf@pobox.com>
PC - UNIX text converter <NOSPAMwibbly.wobbly.web@w3.to>
Re: PC - UNIX text converter <au_aaron@hongkong.com>
Re: PC - UNIX text converter <mpullen@midwest.net>
Re: PC - UNIX text converter ran@netgate.net
Re: perl open function (Larry Rosler)
Re: Perl REQUIRE question (Andrew M. Langmead)
Regex to parse m/d/yy into yyyy-mm-dd <bwebb@fred.net>
Re: regexp <gellyfish@btinternet.com>
sendmail doesn't work <philip.class@popcorn-studio.ch>
Server Upgrade Causes Broken Cookie Code andre_sanchez@my-dejanews.com
Re: Splitting and assigning parts of an array <jdf@pobox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Mar 1999 15:05:25 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <7beabl$ti$2@info.uah.edu>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 22 Feb 1999 14:47:54 GMT and ending at
01 Mar 1999 18:37:32 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 1998 Greg Bacon. All Rights Reserved.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 246 (49.6% of all posters)
Articles: 363 (25.4% of all articles)
Volume generated: 583.5 kb (24.4% of total volume)
- headers: 255.0 kb (5,331 lines)
- bodies: 319.3 kb (10,810 lines)
- original: 241.2 kb (8,415 lines)
- signatures: 9.0 kb (204 lines)
Original Content Rating: 0.755
Averages
========
Posts per poster: 1.5
median: 1.0 post
mode: 1 post - 170 posters
s: 1.1 posts
Message size: 1646.1 bytes
- header: 719.3 bytes (14.7 lines)
- body: 900.6 bytes (29.8 lines)
- original: 680.4 bytes (23.2 lines)
- signature: 25.3 bytes (0.6 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
7 10.7 ( 4.4/ 6.3/ 1.7) cant_take@the_spam.com
7 12.9 ( 5.5/ 7.4/ 3.6) Arnauld Van Muysewinkel <avm@atos.be>
6 12.7 ( 3.6/ 9.1/ 7.6) "Sheila Eugenio" <seugenio@man.amis.com>
4 9.8 ( 3.0/ 6.8/ 5.6) null@effierover.com (Effie Rover)
4 4.8 ( 2.6/ 1.6/ 0.4) Heiko Marschall <hm@garmisch.net>
4 8.3 ( 2.9/ 5.4/ 4.4) "coyote38" <coyote38@pacbell.net>
4 4.8 ( 2.8/ 2.0/ 2.0) root <root@redbox.caroline.net>
4 3.7 ( 2.6/ 1.0/ 0.8) KC <hunt@queen.es.hac.com>
4 5.1 ( 2.4/ 2.7/ 0.7) lufan@hotmail.com
4 5.9 ( 3.3/ 2.6/ 0.7) Donny Widjaja <donny@impulsesoftware.com>
These posters accounted for 3.4% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
12.9 ( 5.5/ 7.4/ 3.6) 7 Arnauld Van Muysewinkel <avm@atos.be>
12.7 ( 3.6/ 9.1/ 7.6) 6 "Sheila Eugenio" <seugenio@man.amis.com>
10.7 ( 4.4/ 6.3/ 1.7) 7 cant_take@the_spam.com
9.8 ( 3.0/ 6.8/ 5.6) 4 null@effierover.com (Effie Rover)
9.8 ( 1.7/ 8.1/ 7.2) 3 "Clawed Le Mew" <clm@biteme.com>
8.3 ( 2.9/ 5.4/ 4.4) 4 "coyote38" <coyote38@pacbell.net>
8.2 ( 0.7/ 7.5/ 7.3) 1 Gilles Guillemette <gilles.guillemette2@sympatico.ca>
7.7 ( 2.4/ 5.3/ 3.8) 3 snowhare@long-lake.nihongo.org (Benjamin Franz)
6.6 ( 1.5/ 5.1/ 4.1) 2 Joachim Backes <backes@rhrk.uni-kl.de>
6.5 ( 0.9/ 5.3/ 5.3) 1 Frazer Worley <fworley@dal.asp.ti.com>
These posters accounted for 3.9% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 2.0 / 2.0) 4 root <root@redbox.caroline.net>
1.000 ( 1.9 / 1.9) 3 "aaron" <aaron@tyc.net>
1.000 ( 2.3 / 2.3) 3 "John" <john@terminalreality.com>
0.889 ( 7.2 / 8.1) 3 "Clawed Le Mew" <clm@biteme.com>
0.835 ( 7.6 / 9.1) 6 "Sheila Eugenio" <seugenio@man.amis.com>
0.821 ( 5.6 / 6.8) 4 null@effierover.com (Effie Rover)
0.821 ( 4.4 / 5.4) 4 "coyote38" <coyote38@pacbell.net>
0.805 ( 3.3 / 4.1) 3 mordasm@home.com (RedWine)
0.792 ( 0.8 / 1.0) 4 KC <hunt@queen.es.hac.com>
0.783 ( 1.8 / 2.4) 3 palfrader@usa.net (Peter Palfrader)
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.586 ( 1.1 / 1.8) 3 Geoff Dreyer <geoff@gdreyer.com>
0.483 ( 3.6 / 7.4) 7 Arnauld Van Muysewinkel <avm@atos.be>
0.480 ( 1.0 / 2.2) 3 "Arnold M|ller" <Arnold_Mueller@csi.com>
0.396 ( 0.8 / 2.0) 3 "Tomer Kalev" <DblClick@inter.net.il>
0.309 ( 0.8 / 2.5) 3 Chuck Brashear <chuckb@mailhub.icx.net>
0.306 ( 1.0 / 3.4) 3 Thomas Eliasson <thel@serop.abb.se>
0.269 ( 0.7 / 2.6) 4 Donny Widjaja <donny@impulsesoftware.com>
0.268 ( 1.7 / 6.3) 7 cant_take@the_spam.com
0.265 ( 0.7 / 2.7) 4 lufan@hotmail.com
0.261 ( 0.4 / 1.6) 4 Heiko Marschall <hm@garmisch.net>
23 posters (9%) had at least three posts.
Top 10 Crossposters
===================
Articles Address
-------- -------
15 swintel@badchips.com (Boycott Swintel)
11 Nektarios Kalogridis <nektarios@home.com>
6 JoHn DoH <johndoh@home.com>
6 bell@clark.net
6 "Kano" <keith@cs.oswego.edu>
4 sky34169 <pierre.bachelart@skynet.be>
4 Ron Dilley <ron.dilley@ada.com>
4 Victor Acevedo <vacevedo@tyr.mty.itesm.mx>
3 "Wayne S. Mery" <wsm0@ns3-1.CC.Lehigh.EDU>
3 "John" <john@terminalreality.com>
------------------------------
Date: Sun, 28 Feb 1999 19:08:23 -0500
From: Michael Benedict <zosima@geocities.com>
Subject: Newbie problems with CGI/Perl
Message-Id: <36D9DA77.98263B3E@geocities.com>
Hello,
I am trying to write a CGI frontend / Perl backend script that will
display a variable webpage depending on a one field input (see the
bottom for detailed problem and my approach). I am trying to use the
CGI_Lite library to aid in helping me with my cause. The basic problem
is that, while I can get the result I want from the command line,
I can't do it with CGI, primarily because I do not understand http that
well and secondly becuase I can't figure out how to use the library (I
have tried the man page, all sorts of online faqs [including the idiot's
one], the "Programming Perl" book I bought, etc). The error I get,
client and server side (I am also the server (Apache) administrator), is
"Premature end of script headers".What I would very much appreciate
would be a good URL showing a concrete, simple example example of a
script that would do something similiar. If you are feeling very
magnanimous, perhaps you could post a script that would take the input
from a cgi-embedded page (say, with the text field name) and output an
web page that would say "hello $name" or whatever using CGI_Lite
(preferably) or the CGI library. Thank you so much for your time and
feel free to email me if any of this wasn't clear
-Mike Benedict
zosima@geocities.com
PS: I would appreciate Email, if you are willing to help.
_____________
Detailed problem explaination:
There is a program, VNC (http://uk.research.att.com/vnc) that
basically serves as a cross platform gui telnet. One very nice thing is
that has a java viewer that can be used with any java compatable
browser. The web page for a given vnc/X server web page is
http://host.com:580x where x is the vnc/X server being run I have a
couple people with this running and would like to have a page where they
could enter their username in and they would be returned to their
dynamic vnc page (or an intermediate page that uses "refresh" to get to
that page). I have already gotten it working from the command line,
such that if the user supplies their login name it will search in their*
vnc directory and return the the address that their server is running
on. However, using CGI i/o is just throwing me.
*=this assumes read permission of their directory. I am using opendir
and readir to do this. Now the script is run under under user "nobody",
but I did 'chmod go+r' each user's vnc directory, so I believe this
should work. Regardless, it isn't my only problem becuase I am not
getting the 'die' message that it couldn't open the directory, just that
"Premature end of script headers" error. Thanks again. . .:
------------------------------
Date: Sat, 27 Feb 1999 16:33:18 GMT
From: johan.levin@mbox300.swipnet.se
Subject: Newbie question
Message-Id: <7b96of$jmm$1@nnrp1.dejanews.com>
Hi
I've only just started to learn perl.
I understand these lines should do the same thing:
<STDIN>
$_ = <STDIN>
But they don't. (Actually I don't understand what the first one does at all.)
When I do:
#! /usr/bin/perl -w
<STDIN>;
print;
I get this error:
Use of uninitialized value at ./tmp line 3, <STDIN> chunk 1.
If I change <STDIN> to $_ = <STDIN> it works.
Can anyone explain this?
TIA
/Johan Levin
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 1 Mar 1999 00:03:21 GMT
From: geiger@cs.ucdavis.edu (Phillip George Geiger)
Subject: Re: News::NNTPClient 480 Authentication
Message-Id: <7bclg9$feg$1@mark.ucdavis.edu>
Never mind, the line
$c->authinfo("myusername","mypassword");
did the trick.
Phillip George Geiger (geiger@cs.ucdavis.edu) wrote:
: My apologies if this should have been posted to just c.l.p.modules;
: I searched DejaNews and all of the relevant articles seemed to be in
: the misc group.
:
:
: I recently installed NNTPClient-0.28 on my system (Linux) and have
: been fiddling around with it.
:
: I copied the sample program from the man page, adding in the name
: of my news server:
:
: ----
: #!/usr/bin/perl -w
:
: use News::NNTPClient;
:
: $c = new News::NNTPCLient("my.news.server"");
:
: ($first, $last) = ($c->group("alt.test"));
:
: for(; $first <= $last; $first++ ) {
: print $c->article($first);
: }
: ----
:
: When I run the program, I get:
: NNTPERROR: 480 Authentication Required
: Use of unitialized value at ./test.pl line 9 <SOCK1> chunk 2.
: NNTPERROR: 480 Authentication Required
: Use of unitialized value at ./test.pl line 9 <SOCK1> chunk 3.
:
: Consulting the man page again, I found (under "Extended NNTP Commands"):
: authinfo Expects two arguments, user and password.
:
: I have a username and password for this server. My question, as a very
: new Perl programmer, is how to employ the authinfo command so that the
: news server will allow me to download and print all the articles in the
: "alt.test" newsgroup.
:
: Suggestions would be appreciated. Thanks!
:
:
: --
: Phil Geiger
: geiger@cs.ucdavis.edu
--
Phil Geiger
geiger@cs.ucdavis.edu
------------------------------
Date: Sun, 28 Feb 1999 12:29:42 GMT
From: tbird99@my-dejanews.com
Subject: nmake, adding modules in Win 98
Message-Id: <7bbcrj$aj8$1@nnrp1.dejanews.com>
I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02, and
the path is correct. I get the error, "Bad command or file name" whenever I
try to do the nmake step for adding a module. Am I doing something wrong?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 1 Mar 1999 01:00:52 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: nmake, adding modules in Win 98
Message-Id: <slrn7djq94.s3b.randy@theory.uwinnipeg.ca>
On Sun, 28 Feb 1999 12:29:42 GMT,
tbird99@my-dejanews.com <tbird99@my-dejanews.com> wrote:
>I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02, and
>the path is correct. I get the error, "Bad command or file name" whenever I
>try to do the nmake step for adding a module. Am I doing something wrong?
Hi,
It probably means you don't have nmake installed - you can grab it
from ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe. If you're
using ActiveState's perl port, then this should work - if not, you might
have to edit perl's Config.pm file to tell it what make program you're
using.
For some modules (XS modules), you'll need a C compiler as
well. For ActiveState's perl VC++ is the default, but Borland's
will work as well. You may have come across the cygwin ports of
gcc and related tools, including make - these won't work unless
they're the same tools used to compile perl itself.
Alternatively, if you're using ActiveState's perl, you might want
to check out their Perl Package Manager (ppm), which can install
automatically the modules ActiveState makes available. Look in the
ActiveState docs for its usage.
--
Best regards,
Randy Kobes
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theory.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: Sat, 27 Feb 1999 12:08:46 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Non-greedy regex efficiency
Message-Id: <1dnvtuw.1jbsu4e19zqwqgN@bay3-97.quincy.ziplink.net>
A couple months ago, Ilya posted a comment to clp.misc that a non-greedy
regular expression was now more efficient than the equivalent
negated-character-class regular expression.
http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=420718487
Well, I finally got around to looking into this assertion. Here's my
Benchmark code:
C:/> cat re.pl
#!perl
use Benchmark;
$n = ('abc' x 10) . '"' . ('abc' x 10);
$y = $n . '"';
timethese (1 << shift, {
nonG_y => sub { $y =~ /"(.*?)"/ },
nonG_n => sub { $n =~ /"(.*?)"/ },
negC_y => sub { $y =~ /"([^\"]*)"/},
negC_n => sub { $n =~ /"([^\"]*)"/},
}
);
__END__
I can't say that I was surprised by these results:
C:/> perl re.pl 17
Benchmark: timing 131072 iterations of negC_n, negC_y, nonG_n, nonG_y...
negC_n: 4 wallclock secs ( 3.75 usr + 0.00 sys = 3.75 CPU)
negC_y: 2 wallclock secs ( 2.60 usr + 0.00 sys = 2.60 CPU)
nonG_n: 5 wallclock secs ( 4.52 usr + 0.00 sys = 4.52 CPU)
nonG_y: 4 wallclock secs ( 5.12 usr + 0.00 sys = 5.12 CPU)
As you can see, the non-greedy regex is *not* more efficient than the
equivalent negated-character-class regex. In fact, when the regex
successfully matches against the target string, the negated-character-class
regex is almost twice as fast.
I would be interested in comments on this situation. Particularly from Ilya,
of course.
c:/> perl -v
This is perl, version 5.005_02 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-1998, Larry Wall
Binary build 509 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 13:37:15 Jan 5 1999
--
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
perl -s -e'print sort grep /[^\S]/, keys %main::
' -- -is -' Just' -' another ' -'Perl ' -'hacker
' http://www.ziplink.net/~rjk/ [rjk@linguist.dartmouth.edu]
------------------------------
Date: 28 Feb 1999 12:00:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Non-greedy regex efficiency
Message-Id: <7bbb4t$a0$1@client2.news.psi.net>
[comp.lang.perl.moderated from Newsgroups]
Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MMVI September
MCMXCIII in <URL:news:7b9f3k$j26$1@mathserv.mps.ohio-state.edu>:
~~ [A complimentary Cc of this posting was sent to Ronald J Kimball
~~ <rjk@linguist.dartmouth.edu>],
~~ who wrote in article <1dnvtuw.1jbsu4e19zqwqgN@bay3-97.quincy.ziplink.net>:
~~ > A couple months ago, Ilya posted a comment to clp.misc that a non-greedy
~~ > regular expression was now more efficient than the equivalent
~~ > negated-character-class regular expression.
~~
~~ > This is perl, version 5.005_02 built for MSWin32-x86-object
~~
~~ I said *now*, not half-a-year ago.
5.005_02 is the latest released version of Perl.
Don't try to always blur the discussion by bringin up phantom Perls.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: 27 Feb 1999 18:55:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Non-greedy regex efficiency
Message-Id: <7b9f3k$j26$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ronald J Kimball
<rjk@linguist.dartmouth.edu>],
who wrote in article <1dnvtuw.1jbsu4e19zqwqgN@bay3-97.quincy.ziplink.net>:
> A couple months ago, Ilya posted a comment to clp.misc that a non-greedy
> regular expression was now more efficient than the equivalent
> negated-character-class regular expression.
> This is perl, version 5.005_02 built for MSWin32-x86-object
I said *now*, not half-a-year ago.
EnegC_n: 3 wallclock secs ( 2.35 usr + 0.00 sys = 2.35 CPU)
EnegC_y: 2 wallclock secs ( 2.00 usr + 0.00 sys = 2.00 CPU)
EnonG_n: 1 wallclock secs ( 1.72 usr + 0.00 sys = 1.72 CPU)
EnonG_y: 2 wallclock secs ( 1.85 usr + 0.00 sys = 1.85 CPU)
negC_n: 5 wallclock secs ( 3.85 usr + 0.00 sys = 3.85 CPU)
negC_y: 3 wallclock secs ( 2.38 usr + 0.00 sys = 2.38 CPU)
nonG_n: 4 wallclock secs ( 4.16 usr + 0.00 sys = 4.16 CPU)
nonG_y: 3 wallclock secs ( 4.28 usr + 0.00 sys = 4.28 CPU)
nonG_y => sub { $y =~ /"(.*?)"/s },
nonG_n => sub { $n =~ /"(.*?)"/s },
negC_y => sub { $y =~ /"([^\"]*)"/},
negC_n => sub { $n =~ /"([^\"]*)"/},
EnonG_y => sub { $y =~ /".*?"/s },
EnonG_n => sub { $n =~ /".*?"/s },
EnegC_y => sub { $y =~ /"[^\"]*"/},
EnegC_n => sub { $n =~ /"[^\"]*"/},
But you are right, the optimization might have worked with '()' too.
Ilya
------------------------------
Date: 01 Mar 1999 10:27:26 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "coyote38" <coyote38@pacbell.net>
Subject: Re: Numeric Sort
Message-Id: <m3emn9kz6p.fsf@joshua.panix.com>
"coyote38" <coyote38@pacbell.net> writes:
> #! /usr/bin/perl5
Do you have a good reason not to be using -w?
> # If you don't get the filename as an arguement
> if(! $ARGV[0])
> {
> # prompt for path/filename
> print "Name of file you you want to process?\n";
> # read it in
> $fileName = <STDIN>;
Why go through all of that? You're going through hoops to avoid some
of Perl's most convenient features, specifically: in-place editing,
automagic processing of @ARGV and the <> operator, automatic
end-of-line processing, and the implicit read-process-print loop of
-p. Here's a complete program that does what your program does,
except that it saves the original file as `filename.unsorted' and
spits out the sorted file as `filename'.
#!/usr/bin/perl -wlpi.unsorted
($name, @numbers) = split;
$_ = "$name\t" . join("\t", sort { $b <=> $a } @numbers);
In general you want to write your programs so that they don't
"pollute" the STDOUT with prompts and messages, because the STDOUT is
where *data* goes. If you must have prompts or menus or such then you
might consider wrapping another program around this one. The wrapper
would ask questions and then run the "clean" program. In general,
messages in programs like these want to go to STDERR, since that
enables folks to redirect the meaningful output.
To read about the features I used in that program, see these
documents:
perldoc perlrun [ for the -l -w -p and -i switches ]
perldoc -f split
perldoc -f join
perldoc perlvar [ for the $_ variable ]
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 27 Feb 1999 16:15:22 GMT
From: "Fred O'Brian" <NOSPAMwibbly.wobbly.web@w3.to>
Subject: PC - UNIX text converter
Message-Id: <uSUB2.2159$uJ1.1157@nnrp3.clara.net>
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01BE626C.1FA2B720
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Am I missing something REALLY obvious here?
All I need is a tool to add/remove the carrage returns in
text files. Surely this must already exsist! Can anybody suggest
one? (I am using Redhat linux / Win95)
--=20
Fred O'Brian (remove NOSPAM from address)
-------------------------------------------------------------------------=
-
A stupid quote is like a drink from a muddy pool.
-The right confused Rev. Copernicus D1542
-------------------------------------------------------------------------=
------=_NextPart_000_0008_01BE626C.1FA2B720
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Am I missing something REALLY =
obvious=20
here?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>All I need is =
a tool to=20
add/remove the carrage returns in</FONT></DIV>
<DIV><FONT size=3D2>text files. Surely this must already exsist! =
Can anybody=20
suggest</FONT> </DIV>
<DIV><FONT size=3D2>one? (I am using Redhat linux / =
Win95)</FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2><BR>-- <BR><BR>Fred O'Brian (remove =
NOSPAM from=20
address)<BR>-------------------------------------------------------------=
-------------<BR>A=20
stupid quote is like a drink from a muddy=20
pool.<BR> -The right confused =
Rev.=20
Copernicus=20
D1542<BR>----------------------------------------------------------------=
---------</FONT> </DIV></BODY></HTML>
------=_NextPart_000_0008_01BE626C.1FA2B720--
------------------------------
Date: Sun, 28 Feb 1999 00:53:56 +0800
From: Aaron Au <au_aaron@hongkong.com>
Subject: Re: PC - UNIX text converter
Message-Id: <36D82324.369706CA@hongkong.com>
--------------654BAD68A6F6428025E4C9D0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
"Ultraedit" and "Notetab" can remove the carriage return between unix
and dos.
Fred O'Brian wrote:
> Am I missing something REALLY obvious here?All I need is a tool to
> add/remove the carrage returns intext files. Surely this must already
> exsist! Can anybody suggestone? (I am using Redhat linux / Win95)
> --
>
> Fred O'Brian (remove NOSPAM from address)
>
> -------------------------------------------------------------------------
>
> A stupid quote is like a drink from a muddy pool.
> -The right confused Rev. Copernicus D1542
>
> ------------------------------------------------------------------------
--
Cheers,
Aaron Au
--------------654BAD68A6F6428025E4C9D0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<BODY BGCOLOR="#FFFFFF">
"Ultraedit" and "Notetab" can remove the carriage return between unix and
dos.
<P>Fred O'Brian wrote:
<BLOCKQUOTE TYPE=CITE> <FONT COLOR="#000000"><FONT SIZE=-1>Am I missing
something REALLY obvious here?</FONT></FONT><FONT SIZE=-1>All I need is
a tool to add/remove the carrage returns in</FONT><FONT SIZE=-1>text files.
Surely this must already exsist! Can anybody suggest</FONT><FONT SIZE=-1>one?
(I am using Redhat linux / Win95)</FONT>
<BR><FONT COLOR="#000000"><FONT SIZE=-1>--</FONT></FONT>
<P><FONT COLOR="#000000"><FONT SIZE=-1>Fred O'Brian (remove NOSPAM from
address)</FONT></FONT>
<BR><FONT COLOR="#000000"><FONT SIZE=-1>--------------------------------------------------------------------------</FONT></FONT>
<BR><FONT COLOR="#000000"><FONT SIZE=-1>A stupid quote is like a drink
from a muddy pool.</FONT></FONT>
<BR><FONT COLOR="#000000"><FONT SIZE=-1>
-The right confused Rev. Copernicus D1542</FONT></FONT>
<BR><FONT COLOR="#000000"><FONT SIZE=-1>-------------------------------------------------------------------------</FONT></FONT></BLOCKQUOTE>
<P>--
<BR>Cheers,
<BR>Aaron Au
<BR>
</BODY>
</HTML>
--------------654BAD68A6F6428025E4C9D0--
------------------------------
Date: 27 Feb 1999 11:23:25 -0600
From: Mike Pullen <mpullen@midwest.net>
Subject: Re: PC - UNIX text converter
Message-Id: <m3sobr69rm.fsf@darby.net>
Here is a perl script I found some time ago that does what you
asked. I do not know who the original author is.
It converts text files from dos to unix to mac and back again. You
need to create symbolics links to get it to work.
For example:
ln -s dos2unix2perl.pl d2u
----- cut here -----
#!/usr/bin/perl -wp
# dos2unix2perl.pl
#
# Simpler unix2dos2mac utility for 2-cent tip, mainly because Tcl is ugly.
# No comments that Perl is ugly too, please.
#
# Usage: a standard Unix filter:
# input: filename(s) or stdin
# output: stdout
# Buglet: u2m leaves lone CR at the end of file if it didn't end in LF
# (Fixing it would use more memory.)
BEGIN {
$_=$0 =~ s|.*/||;
$pcmd='s/$/\r/' if ($0 eq 'u2d'); # unix to dos
$pcmd='s/\r$//' if ($0 eq 'd2u'); # dos to unix
$pcmd='s/$/\r/;chop' if ($0 eq 'u2m'); # unix to mac
$pcmd='s/\r/\n/g' if ($0 eq 'm2u'); # mac to unix
$pcmd='chomp' if ($0 eq 'd2m'); # dos to mac
$pcmd='s/\r/\r\n/g' if ($0 eq 'm2d'); # mac to dos
unless($pcmd) {
print STDERR "This script must be invoked under one of the names:\n",
" u2d, d2u, u2m, m2u, d2m, m2d\n";
exit 1;
}
}
eval $pcmd;
--
Mike Pullen mpullen@midwest.net
Linux localhost 2.0.33 #1 Mon Jan 18 17:39:07 CST 1999 i586
11:18am up 2 days, 12:04, 1 user, load average: 0.13, 0.13, 0.08
------------------------------
Date: 27 Feb 1999 18:54:33 GMT
From: ran@netgate.net
Subject: Re: PC - UNIX text converter
Message-Id: <7b9f19$fif$1@remarQ.com>
In <uSUB2.2159$uJ1.1157@nnrp3.clara.net>, "Fred O'Brian" <NOSPAMwibbly.wobbly.web@w3.to> writes:
>Am I missing something REALLY obvious here?
>All I need is a tool to add/remove the carrage returns in
>text files.
Not so: you also need a newsreader that doesn't take a simple 4-line
text message, explode it into 25 lines of HTML, then wrap the whole
mess in 15 lines of MIME headers...
Look for a package called "XEOL". You might have to get it from
hobbes.nmsu.edu, since it includes a version for OS/2, but there's a
DOS .EXE in it, too.
Ran
------------------------------
Date: Sat, 27 Feb 1999 08:10:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: perl open function
Message-Id: <MPG.1141b8cb938c888e9896a5@nntp.hpl.hp.com>
In article <m3k8x3sviu.fsf@joshua.panix.com>, on 27 Feb 1999 10:42:33 -
0500 jdf@pobox.com says...
> RS <rajshreesankaran@hotmail.com> writes:
...
> my $path = "$DIR\\reg.htm$VAR1";
...
> Also, using backwhacks as path separators leads to mental confusion.
> Forward slashes work just dandy under NT, and you don't have to worry
> about interpolation.
True, and worth repeating many times. But in this case, interpolation
is what RS wanted, hence the double quotes, hence the double
backslashes.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 1 Mar 1999 00:28:31 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl REQUIRE question
Message-Id: <F7w3zK.Fxx@world.std.com>
"John" <john@terminalreality.com> writes:
>How does the Perl REQUIRE function work? Is the file listed in the require
>function loaded when the line that contains the REQUIRE function is reached
>or as soon as the PERL file that contains the REQUIRE function is loaded?
When the require function is executed (not when it is parsed) the file
is then parsed and executed. (The function "use" does something
similar, but as soon as the use statement is completely parsed.) Once
the require executed, the perl interpreter checks to see if the file
has not yet been executed already, and parses and executes it only
if it has not.
>The reason I ask is that I was wondering if I could speed up the performance
>of a perl script by not having the whole script loaded at once. If I break
>up the
>script into commonly used and non-commonly used parts and if I only
>load the parts that are in demand it might speed things up???
It sounds like you are describinperldoc AutoSplit and AutoLoader
modules. Check their documentation for details.
--
Andrew Langmead
------------------------------
Date: Sun, 28 Feb 1999 19:47:31 -0500
From: "Robert E Webb" <bwebb@fred.net>
Subject: Regex to parse m/d/yy into yyyy-mm-dd
Message-Id: <nslC2.101$3E1.128925@news.abs.net>
Hello, I need to write a regex in perl to parse a date in m/d/yy format to
yyyy-mm-dd. At first glance it looks simple. I could do something like this:
#!/usr/bin/perl -p0777
s/(\d)+\/(\d)+\/(\d)+/$3-$1-$2/g;
and it works if I have a date that looks like 1/1/99. The problem is that I
need to pad 19 onto 99, or 20 onto dates in the year 2000. Also, I need to
pad a leading 0 for month and day numbers less that 10.
So I need to write a regex that parses 1/1/99 to 1999-01-01, and 7/12/2001
to 2001-07-12.
My regex and perl experience is limited, so I need some help to accomplish
this. Any help would be most appreciated.
Thanks,
Bob/
------------------------------
Date: 28 Feb 1999 23:52:43 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: regexp
Message-Id: <7bcksb$1h3$1@gellyfish.btinternet.com>
On Sun, 28 Feb 1999 21:55:25 GMT Mark P. wrote:
> Lets try this again. Although using URI::URL might be helpful,
> from the documentation, I'm only able to return a relative path. What
> I need is to get just the document without anything following it. IE;
> turn http://www.what.com/what/index.shtml#whatever, to index.shtml.
> I need a rexexp that will do this. It seems to me to be the
> best way, unless someone can point me to some good examples of how to
> use URI::URL to do the same thing. I haven't found anything yet that
> suggests I should use the module.
>
Well I would suggest that you havent been reading the documentation very
well - I posted this earlier on but I guess that it could do with another
outing :
#!/usr/bin/perl
use URI::URL;
my $url = new URI::URL 'http://localhost/manual/index.html';
my @path = $url->path_components();
@path[$#path] = 'index.txt';
$url->path_components(@path);
print $url->as_string,"\n";
The method path_components returns an array comprising the file path
components of the URL and as you can see it can also take an argument
that will modify those components - the use of the module will enable
you to deal with a far wider range of different formed URLs than you
might take into account with any regex.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 27 Feb 1999 19:50:09 +0100
From: "Philip Class" <philip.class@popcorn-studio.ch>
Subject: sendmail doesn't work
Message-Id: <7b9elf$e1h$1@bw107zhb.bluewin.ch>
I'm running a Web on a NT-Server.
The admin has installed a email-handling Perl Prg, that uses a sendmail
Program located at
/usr/bin/sendmail . His email-handling cgi-Program is located in a virtual
Dir called /global-cgi/mailprogram.pl.
But as soon as I copy the mailprogram.pl into a cgi-bin Directory of my own
Domain, it doesn't work anymore.
The Script doesn't display an error message, but NO EMAIL are sent out.
What's wrong ?
My cgi-bin Directory own all permissions for executing Scripts etc.
1) How can I find out if the Sendmail-location is really understood be the
Program ?
( using something like .... open(MAIL,"|$mailprogram") || die "display
Error Message"; ... never displays an Error, even
if the $mailprogram name is surely wrong )
2) What's the difference between running the exactly same script in the
administrators /global-cgi Directory and letting it run in my own cgi-bin ?
Thanks a lot for your help,
Philip
------------------------------
Date: Mon, 01 Mar 1999 01:30:30 GMT
From: andre_sanchez@my-dejanews.com
Subject: Server Upgrade Causes Broken Cookie Code
Message-Id: <7bcqjn$ct7$1@nnrp1.dejanews.com>
My hosting service upgraded its servers. After the upgrade, code I had
written to issue cookies to visitors no longer worked. After hours of talking
to the support staff, they assured me that everything was installed as before
and that cookies were client side objects that were beyond their control. I
had no choice by to rewrite my code.
Originally I had was using cgi.pm (see sample code below), and the code still
worked on certain browsers, namely Netscape 4. However, it no longer worked
for IE 4 and Netscape 3 browsers. The new code issues the cookie in a more
primitive way, and works for the all the above mentioned browsers.
However, I have been getting e-mails from visitors that cannot get past a
subsequent check that I perform to verify that the cookie was indeed set.
What could possibly be impeding the issuance of my cookies?
I am including one the environmental variables below:
SERVER_SOFTWARE: Stronghold/2.2 Apache/1.2.5 C2NetUS/2002
# Original code ------------------------------------------------------
#!/usr/local/bin/perl
use CGI qw(:standard);
$query = new CGI;
$unique_id = $$ . "-" . $ENV{'REMOTE_ADDR'} . "-" . time();
$cookie1=$query->cookie(-name=>"unique_id",
-value=>$unique_id,
-expires=>'+1h');
print $query->header(-expires=>'now',-cookie=>$cookie1);
# etc., etc.,
# New code -----------------------------------------------------------
#!/usr/local/bin/perl
$unique_id = $$ . "-" . $ENV{'REMOTE_ADDR'} . "-" . time();
print "Content-type: text/html\n";
print "Set-Cookie: unique_id=$unique_id;\n\n";
# etc., etc.,
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Feb 1999 10:57:01 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Splitting and assigning parts of an array
Message-Id: <m3g17rsuuq.fsf@joshua.panix.com>
linberg@literacy.upenn.edu (Steve Linberg) writes:
> In article <7b6rd2$mda$1@nnrp1.dejanews.com>, thst@my-dejanews.com wrote:
> > 2.) remove the last 200 elements from the original array.
> > (@oldarray = oldarray[0 .. 799] doesn't work)
>
> $#oldarray -= 200;
Yes, and there's also
splice @oldarray, 800;
Which leads one to...
#!/usr/bin/perl -w
use Benchmark;
my @array = map {rand} 1..1000;
sub use_splice { my @b = @array; splice @b, 800; }
sub use_var { my @b = @array; $#b -= 200; }
timethese( 20_000, {
splice => \&use_splice,
var => \&use_var,
});
__END__
Benchmark: timing 20000 iterations of splice, var...
splice: 23 wallclock secs (22.63 usr + 0.00 sys = 22.63 CPU)
var: 23 wallclock secs (22.66 usr + 0.03 sys = 22.69 CPU)
Scary.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5013
**************************************