[10549] in Perl-Users-Digest
Perl-Users Digest, Issue: 4141 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 3 15:07:28 1998
Date: Tue, 3 Nov 98 12:00:27 -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 Tue, 3 Nov 1998 Volume: 8 Number: 4141
Today's topics:
Re: 2Q: Perl modules & htaccess <smiles@wfubmc.edu>
Re: Alternative(s) for MailForm.pl dave@mag-sol.com
Re: CGI vs LWP modules (David Jacoby)
Re: CGI, common text question <alexb@sig.net>
Check this out... <anthony@nova-creations.com>
Re: Check this out... (Craig Berry)
Re: Check this out... (Brand Hilton)
Copy of AutoLoader.pm?? burtj@my-dejanews.com
Re: FAQ question. (Joergen W. Lang)
Re: FAQ question. (James Peregrino)
find and replace <mikej@1185design.com>
Re: find and replace (Larry Rosler)
Re: HELP: Parsing (Doran L. Barton)
Re: How to pipe a file <desar@club-internet.fr>
Re: How to run Perl/CGI under NT? <shane_baker@merck.com>
illegitimate data types ? mgrabens@my-dejanews.com
Re: module interface design <desar@club-internet.fr>
Re: Newbie: files in different directories. <mk@control.auc.dk>
Re: Not to start a language war but.. <uri@fastengines.com>
Re: Not to start a language war but.. <vchandra@mail.delcoelect.com>
Output to parallel port (Wendy Allison Verschoor)
Re: parsing email address problem <desar@club-internet.fr>
Re: PERL is TOO flexible (James Peregrino)
Re: PERL is TOO flexible <fncll@aurora.alaska.edu>
Re: PERL is TOO flexible (Andre L.)
Re: Perl Upload Script Needed Badly dturley@pobox.com
Re: Poll: How Did You Learn Perl? (Matthew Bafford)
POSIX::tmpnam uniqueness (etherl)
Re: Problem with installing modules sybperl & Data-Dump mpeppler@mbay.net
Re: Question regarding CGI.pm <gbc1@axe.humboldt.edu>
Reading multiple lines <webmaster@topproducer.com>
Re: Reading multiple lines (Matt Knecht)
Re: Reference Safety (Larry Rosler)
Re: Reference Safety <zenin@bawdycaste.org>
Re: regexp and date, help (Doran L. Barton)
Re: regexp and date, help <r28629@email.sps.mot.com>
Sambar Server <dwclarke@earthlink.net>
Unable to load Shared libs in PERL (Bibek Shrestha)
Re: volunteers needed to test javascript database <r28629@email.sps.mot.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Nov 1998 13:47:59 -0500
From: Steve miles <smiles@wfubmc.edu>
Subject: Re: 2Q: Perl modules & htaccess
Message-Id: <363F4FDF.85036A8E@wfubmc.edu>
Thanks Jye!
You told me JUST what I needed to know. :-)
Steve
Jye Tucker wrote:
> In article <363E0601.D176B9@wfubmc.edu>, Steve miles <smiles@wfubmc.edu> wrote:
>
> > Hi everyone. I have two questions:
> >
> > 1. What can you type at the telnet command line to get a list of Perl
> > modules installed on your system? (I'm just using a hosting company...)
> >
> > 2. When creating a password protected membership site, is there any way
> > of getting around having to use .htaccess and it's password file for the
> > membership database? Is there a way to use Perl to let the person sign
> > in via a HTML form instead of the .htaccess popup and still be able to
> > have the contents of an entire directory protected? (Of course I'm
> > assuming you will still use an .htaccess file for the protected
> > directories, but I'm just looking for a way around the popup member
> > entrance...)
>
> Hi Steve,
>
> 1. From the perlmodlib manpage...
>
> --o--
> To find out all the modules installed on your system, including those
> without documentation or outside the standard release, do this:
>
> % find `perl -e 'print "@INC"'` -name '*.pm' -print
> --o--
>
> 2. I just wrote a script to perform exactly the same thing that you are
> looking at. There is a .htaccess file in the protected directory to prevent
> anyone from getting in if they know the URL to that directory.
>
> It basically just reads the username and password from a form, reads a
> config file (my version generates a different page for each username), and
> makes its own HTTP request using the LWP module and the authorization_basic
> function.
>
> Hope that gives you a good start,
>
> Jye
------------------------------
Date: Tue, 03 Nov 1998 18:02:19 GMT
From: dave@mag-sol.com
Subject: Re: Alternative(s) for MailForm.pl
Message-Id: <71ngfc$o9e$1@nnrp1.dejanews.com>
In article <363F0F84.116AE855@nospam.com>,
Geert Roovers <Geert.Roovers@nospam.com> wrote:
> Hi,
>
> Let me know if this is actually a question for a CGI newsgroup...
>
> After I started using the FormMail.pl from Matt's Script Archive, I
> noticed that a lot of people in this news group didn't support the use
> of Matt's scripts. i take it that they have very good reasons for that,
> and frankly, I'm not really interested in them :o)
>
> What i am interested in though, is good alternatives. I realize I could
> hack something myself, and I would, if I had the time. But since I don't
> have the time, I went looking, and came up with a script called
> "mailto.cgi" at http://www.cgibuilder.com/afm/ (It's titled "Advanced
> Form Mailer")
>
> Does anyone know this script, and - more important - is it any better
> than Matt's? If not, what is a better alternative? I have to be able to
> read a form, put all info in a mail, preferably according to my lay-out.
Don't know how it compares to this Advanced Form Mailer, but I have a form
mail scripts called ms-mail.pl available for free download from my web site
at <http://www.mag-sol.com/Download.html>. It's pretty simple but (I like to
think) pretty versatile.
Please let me know if it's any good to you.
Dave...
p.s. And, yes, this would have been better asked in the CGI group.
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 3 Nov 1998 18:02:47 GMT
From: jacoby@kybernetes.ecn.purdue.edu (David Jacoby)
Subject: Re: CGI vs LWP modules
Message-Id: <71ngg7$88@mozo.cc.purdue.edu>
Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
>Re: CGI vs LWP modules, David
><jacoby@harbor.ecn.purdue.edu> said:
>David> clients. The CGI module simplifies the creation of
>David> CGI programs. I never use it, as I really get annoyed
>David> by the way it formats stuff. The browser still takes
>David> it, but when I look at the output, it goes longer
>David> than 80 characters.
>You'd throw away all that CGI.pm gives you just because of
>that?
Well, I learned to do it all, or at least what I use, without the
use of it. In fact, I do prefer controlling the interface, specifying
that this script can only use GET or POST, by my choice.
>You can always do a
>
> print "\n";
>
>to coerce the output stream into something more readable.
That's true. And likely, if I ever take the time to use it, I may
like it. But so far, it hasn't given me anything I don't have already
and don't enjoy doing.
>The browserware doesn't care either way.
I know that. I mentioned that. It is a mostly irrational choice, but the
CGI is something I know and understand so I don't need the module. I use
IO::Sockets and LWP because I don't know, understand and enjoy mangling
those interfaces like I like CGI.
>hth
>tony
--
Dave Jacoby I wish I could give brother Bill his big thrill
jacoby at ecn.purdue.edu I would set him in chains at the top of the hill
http://purdue.org/~jacoby/ Then send out for some pillars and Cecil B. Demille
Father. Guitarist. Geek. He could die happily ever after - Bob Dylan
------------------------------
Date: Tue, 03 Nov 1998 12:05:12 -0600
From: Alexander Bibighaus <alexb@sig.net>
Subject: Re: CGI, common text question
Message-Id: <363F45D8.DDC3C0EF@sig.net>
> at which point do i do wrong?
You're calling a function when you say $cgi->start_html(..)
You shouldn't do that with the <<EOHTML technique.
Instead, why don't you just
sub my_start_html{
my ($title) = @_;
return $cgi->start_html(....);
}
You can use the <<EOHTML like this
my($html) = <<EOHTML;
<html>
<body bgcolor=FFFFFF>
EOHTML
Variable interpolation will work but f(x) calls won't.
-alexander
------------------------------
Date: Tue, 03 Nov 1998 17:55:01 GMT
From: "Anthony F. Sanchez" <anthony@nova-creations.com>
Subject: Check this out...
Message-Id: <363F41D5.18FA2C63@nova-creations.com>
Hi!
Does anyone know how I can reformat an in coming variable by replacing
blank spaces with + signs?
example: (test1 test2 test3) would become (test1+test2+test3)
Thanks!
Anthony
------------------------------
Date: 3 Nov 1998 19:08:28 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Check this out...
Message-Id: <71nkbc$kut$1@marina.cinenet.net>
You might want to choose better 'Subject' lines.
Anthony F. Sanchez (anthony@nova-creations.com) wrote:
: Does anyone know how I can reformat an in coming variable by replacing
: blank spaces with + signs?
:
: example: (test1 test2 test3) would become (test1+test2+test3)
$incoming =~ tr/ /+/;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 3 Nov 1998 19:07:28 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Check this out...
Message-Id: <71nk9g$bh112@mercury.adc.com>
In article <363F41D5.18FA2C63@nova-creations.com>,
Anthony F. Sanchez <anthony@nova-creations.com> wrote:
>Hi!
>
>Does anyone know how I can reformat an in coming variable by replacing
>blank spaces with + signs?
>
>example: (test1 test2 test3) would become (test1+test2+test3)
$var =~ s/ /+/g;
This is a really, really, really basic question. If you're going to
do any real programming in Perl on a regular basis, you should read
the basic documentation that comes with Perl ("man perl" or "perldoc
perl" to get started) or buy a good beginning book on Perl, such as
Learning Perl by Randal Schwartz.
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Tue, 03 Nov 1998 18:59:11 GMT
From: burtj@my-dejanews.com
Subject: Copy of AutoLoader.pm??
Message-Id: <71njpv$tt8$1@nnrp1.dejanews.com>
For one reason (or another), our AutoLoader.pm file got hosed! Can
someone e-mail me a copy of the standard version of this file. We are
running Perl 5.004_04. Also, if you know of a website that I can get
this file at, please let me know (although I have looked for hours and I
have not found one!).
thanks,
Burt J
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 3 Nov 1998 18:42:48 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: FAQ question.
Message-Id: <1dhxih9.ijzwl2u13v0wN@host034-210.seicom.net>
Kjetil Svendsberget <kjetil@balder.no> wrote:
> I have a question which i didnt find at language.perl.com/faq
> which MUST be a faq.
>
> How do i remove carrige returns from a file copied from winblows to
> unix?
>
> i did a
>
> 1,$s/^M//g
>
> in VI, but apperently that didnt help.
>
> it still says there carriage returns (015) in the file.
>
> How do i easy do this?
Set $/ (the $INPUT_RECORD_SEPARATOR) to whatever you need. And then use
chomp() (perldoc -f chomp) on each line:
Try the following example:
#!/usr/bin/perl -w
@lines = ("line1\012\015", "line2\012\015", "line3\012\015");
print @lines, "\n"; # <CR><LF> still intact.
$/ = "\012\15"; # set $/ to a carriage return and a linefeed
foreach $line (@lines) {
chomp $line; # remove whatever $/ is from end of line.
print $line; # show us what happened.
};
__END__
hth, HANW,
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Tue, 3 Nov 1998 11:50:09 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: FAQ question.
Message-Id: <1dhx1ca.opnb7sl8pf78N@dcepf5.harvard.edu>
perl -p -i -e s/\r//g yourfilename
on the unix machine.
If you did perl -p -i -e s/\n//g, that would remove the *unix* 'carriage
return' (end of line character to be exact). Windows uses
^M^J and Unix uses ^J. (A ^M is \r).
-James
Kjetil Svendsberget <kjetil@balder.no> wrote:
> I have a question which i didnt find at language.perl.com/faq
> which MUST be a faq.
>
> How do i remove carrige returns from a file copied from winblows to
> unix?
>
> i did a
>
> 1,$s/^M//g
>
> in VI, but apperently that didnt help.
>
> it still says there carriage returns (015) in the file.
>
> How do i easy do this?
--
James Peregrino (617)496-6288 (v)
Manager of Comp. Services (617)495-5685 (f)
Harvard Div. Cont. Ed.
james_peregrino@harvard.edu
------------------------------
Date: Tue, 03 Nov 1998 11:01:02 +0000
From: mikej <mikej@1185design.com>
Subject: find and replace
Message-Id: <363EE26B.15642836@1185design.com>
Hi everyone,
Im trying to open an html file and replace parts of it. I basically open
the file and try to do a substitute command on keywords already in the
file, which should get replaced. Say I want to change where it says
<!--replace me--> to <!--it worked--> in an html page. I call this
subroutine:
sub replace_text {
open (MYFILEHANDLE, ">>files/index.html");
while ($content = <MYFILEHANDLE> {
$content =~ s/<!--replace me-->/<!--it worked-->/i;
}
close MYFILEHANDLE;
}
It is supposed to go through my html file and replace where it says
"<!--replace me-->" with "<!--it worked-->", but it doesn't do anything.
Anyone know what is wrong with it? Any examples of find and replace
scripts that are easy to understand would be a good help too. Thanks for
your help.
-Mike
------------------------------
Date: Tue, 3 Nov 1998 11:50:03 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: find and replace
Message-Id: <MPG.10a8fe4a327e492989860@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <363EE26B.15642836@1185design.com> on Tue, 03 Nov 1998
11:01:02 +0000, mikej <mikej@1185design.com> says...
...
> open (MYFILEHANDLE, ">>files/index.html");
Where, oh where, is the check on whether the 'open' was successful? Of
course, in this case, you tried to open the file to append, so whether
it succeeded or not is irrelevant, because:
> while ($content = <MYFILEHANDLE> {
here you are trying to *read* from a file that was opened only to append
(i.e., write) to.
> Anyone know what is wrong with it? Any examples of find and replace
> scripts that are easy to understand would be a good help too. Thanks for
> your help.
You certainly should read perlfaq5: "How do I change one line in a
file/delete a line in a file/insert a line in the middle of a
file/append to the beginning of a file?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 3 Nov 1998 10:25:33 -0700
From: fozz@xmission.xmission.com (Doran L. Barton)
Subject: Re: HELP: Parsing
Message-Id: <71nead$15p$1@xmission.xmission.com>
jforsyth@islandactive.com (J.L. Forsyth) writes:
>Here's my problem:
>A user will make some choices from an HTML form and then hit "submit"
>This results in an outside company (not me) passing back some results
>based on the user's choices, in an ASCII text file. I need to parse
>this file and return the user with a nicely formatted HTML page.
>Can anyone point me in the right direction of where to find
>information on how to do this?
Read up on the CGI.pm Perl module.
>Also, this is probably a ridiculous question but,
>I need to print a % sign in a form option, and I've never needed to
>do this before, how do I get % to print.
You do this by escaping or back-slashing the % character:
print "Profit Margin: $margin \%\n";
print "Profit Margin: ", $margin, '%', "\n";
-=Fozz
--
Doran L. Barton = fozz@xmission.com && http://www.xmission.com/~fozz/;
"Where do you want Microsoft to go today?" --Ron Barry <ronb@cc.usu.edu>
"This may seem a bit weird, but that's okay, because it is weird."
-- Larry Wall <lwall@sems.com> in the Perl v5 man page
------------------------------
Date: Mon, 02 Nov 1998 00:08:31 +0100
From: Francois Desarmenien <desar@club-internet.fr>
To: newuser@anonymouce.net
Subject: Re: How to pipe a file
Message-Id: <363CE9EF.24CE619@club-internet.fr>
If you're using any U*ix flavor: use cron.
If you're not, you're on your own...
Francois
anonymous wrote:
> Hello,
> I was wondering if anyone can help me write a perl script that can
> do the following:
> Lets say a file is in the following directory http://www.2123.com/
> ~username/test/. Now after 7 days I want this file to be moved automat-
> ically to a new directory(http://www.2123.com/~username/test/archives
> and after 30 days I want this file to be deleted automatically.
> Any help would be appreciated
------------------------------
Date: Tue, 03 Nov 1998 13:12:37 -0500
From: Shane Baker <shane_baker@merck.com>
Subject: Re: How to run Perl/CGI under NT?
Message-Id: <363F4795.45E8E05C@merck.com>
I realize that many of you take offense at questions on this subject here,
but there doesn't seem to be anything in any of the related FAQs about
this. I have the same problem and I think I have narrowed it down to the
way Windows handles file associations.
This isn't really a perl problem, just hoping someone here will be able to
help. Working from a command prompt, I got the following results (the
contents of the script are not relavant, let's say that it just prints
Hello World):
<prompt>perl test.pl --- this is fine.
<prompt>test.pl --- fine
<prompt>perl test.pl > out.txt --- fine
<prompt>test.pl > out.txt --- NOT FINE - out.txt is 0 bytes.
I setup a test file association with the same results, so it is not perl
specific (again, I know I might be inviting flames here). I am guessing
that this is the reason Java WebServer and Netscape SuiteSpot both fail to
produce any output when I try to use perl for my cgi programs (I rewrote
in C and it worked fine).
Reading through this newsgroup, it appears that everyone who is running
perl/cgi on NT is using IIS and it looks as though IIS has its own file
association stuff built in. I would like to stay as far away from MS
products as possible (I'm writing on NT because it is mandated at work).
I haven't installed IIS because it requires that I install IE.
If there is anyone who has anything to offer on this subject, it would be
greatly appreciated.
Shane Baker
David J. Topper wrote:
> Hey there folks,
>
> I'm a Unix Perl dude. But now I have to run some code off MSIS under
> NT. So I've set up things with the NT Explorer to associate all files
> with .pl and .cgi to launch perl. But unfortunately, I can't seem to
> get stuff to launch. Here's a test script that simply prompts my
> Netscape to download:
>
> #!D:/Perl/bin/perl
>
> print "Content-type: text/html\n\n";
> print "<FONT SIZE = +1><CENTER>Perl Works!</CENTER></FONT>";
>
> Anybody?
>
> Thanks y'all,
>
> Dave Topper
> --
> David Topper
> Technical Director - Virginia Center for Computer Music
> Programmer Analyst - School of Arts and Sciences
> http://www.panix.com/~topper
> (804) 924-6887
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
------------------------------
Date: Tue, 03 Nov 1998 17:28:08 GMT
From: mgrabens@my-dejanews.com
Subject: illegitimate data types ?
Message-Id: <71nef7$ls0$1@nnrp1.dejanews.com>
In the following code snigglet, does this create an illegitimate data type?
$myhash{key1} = 'Person';
$myhash{key1}{fname} = 'Mike';
$myhash{key1}{lname} = 'Grabenstein';
$myhash{key2} = 'Class';
... etc ...
I have used this before and not had a problem, but wonder if I am exploting
some bug in Perl that will eventually disappear, or is this another wonderful
feature of Perl ??
Please CC me on your response. TIA
Thanks,
Mike
mgrabens@popd.isinet.com
#include <std.disclaimers>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 02 Nov 1998 00:06:16 +0100
From: Francois Desarmenien <desar@club-internet.fr>
To: Leo Schalkwyk <schalkwy@minnie.RZ-Berlin.MPG.DE>
Subject: Re: module interface design
Message-Id: <363CE968.2ED2F80@club-internet.fr>
Yes, use a hash, like in Perl/Tk ie:
&foo(param_1 => 1, param_8 => 8, param_2=>2)
and then check params in your sub.
Maybe have a look at Parse-Yapp too, I use this technique too...
Leo Schalkwyk wrote:
> =head1 SYNOPSIS
>
> use MapDraw3 qw( &ps_top &ps_draw &ps_tail );
>
> &ps_top(fh,width_cm,height,top_margin,left_margin_cm,
> font, paper_format, no_of_maps,length_1 .. length_n);
>
> &ps_draw(fh,map_no,lcolor,tcolor,broke,int,top_end,marker, tonext);
>
> &ps_tail(fh);
>
> # fh : filehandle. Must be qualified (eg main::OUTFILE)
> # map_no: count from 0!
> # length_1 etc are in maps4 own units (eg cM)
> # int: interval lengths displayed if 1, not if 0 or "".
------------------------------
Date: Tue, 03 Nov 1998 19:26:01 GMT
From: Morten Knudsen <mk@control.auc.dk>
Subject: Re: Newbie: files in different directories.
Message-Id: <363F596A.73147E19@control.auc.dk>
dave@mag-sol.com wrote:
> [email copy of usenet posting copied to cited author]
>
> [by the way Christian, please try to fix tyour line wrapping - it's seriously
> broken.]
>
> In article <363EF167.397A3A59@control.auc.dk>,
> Morten Knudsen <mk@control.auc.dk> wrote:
> > Here's my problem...
> >
> > I'm trying to build a virtual shopping cart for use in a small on-line
> > store. Each user is assigned a
> > file with a filename equal to the users ip address. This file will then
> > contain information about the
> > user's purchases. But, I can't seem to get the script to find the file
> > ($ip). When I place the file in
> > the same directory as the script, there's no problems at all, but I just
> > can't find the file in another
> > directory! Help!
>
> [snipped to the relevant statement]
>
> > open (CARTFILE, "<$cart");
>
> If your file is in another directory, you need to prepend that directory's
> name to the file name when opening it. Something like:
>
> open(CARTFILE, "<$dir/$cart") or die "Can't open $dir/$cart: $!\n";
>
> You should also bear in mind that your web server user (who owns the CGI
> process) may well only have access to the web documents directory tree. You
> might need to find out where that is by using $ENV{DOCUMENT_ROOT}.
>
> > Any help would be really appreciated!
>
> Hope this helped.
>
> > Please e-mail me at: chrknudsen@hotmail.com
>
> Done, but it's usually considered to ask for a emailed copy, or better to read
> the reply in the newsgroup.
>
> Dave...
>
> --
> dave@mag-sol.com
> London Perl M[ou]ngers: <http://london.pm.org/>
> [Note Changed URL]
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Thank you for your help, but I'm still at a loss. I've prepended(?) the
path to the file when defining $cart and I've also chmoded the /carts
directory to 766, so the user should be able to read/write the cart file.
I'm also pretty sure that it _is_ the correct path to the cart file, so
I just can't figure out where the problem is...
/Christian H. Knudsen
P.S. I'll read the posts in the newsgroup in the future. :)
------------------------------
Date: 03 Nov 1998 12:27:35 -0500
From: Uri Guttman <uri@fastengines.com>
To: Russ Allbery <rra@stanford.edu>
Subject: Re: Not to start a language war but..
Message-Id: <sarbtmovg8o.fsf@camel.fastserv.com>
>>>>> "RA" == Russ Allbery <rra@stanford.edu> writes:
RA> To me, Python vs. Perl has always struck me as just the latest
RA> incarnation of the standard fight between "clean" and "dirty"
RA> languages. Python, at least as it's been described to me, has a
RA> clean and consistent core language, and proceeds consistently from
RA> a set of basic axioms. In other words, it's likely nearly all
RA> programming languages.
RA> Perl isn't. Perl is dirty and ugly and proud of it. And the fact
RA> that that's the primary objection to Perl emphasizes that this
RA> really isn't a case of one language or the other being better, but
RA> rather a case of how the programmer wants to think.
this is just what i said a few days ago in my psychology of programming
thread.
RA> See, the one thing that I'll never argue is that Perl is for
RA> everyone. Because I don't believe that it is. Perl is for people
RA> who think like Perl thinks. Now Perl knows a lot of different
RA> ways of thinking, and a lot of people from very different
RA> backgrounds can be happy thinking in Perl, unless they expect Perl
RA> to *only* think they way they think. And provided they don't mind
RA> the weird corners where Perl's thinking like someone else. In
RA> order to really love Perl, you have to happily embrace a language
RA> that has lots of odd little corners and is proud of it.
i couldn't agree more. i look at python and my brain says too many
suffix words and . notations. not wrong, but my brain doesn't like to
think in long textual expressions. almost cobolish in its verbosity. btu
that is MY opinion, not dogma.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 03 Nov 1998 12:58:24 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: Re: Not to start a language war but..
Message-Id: <363F4440.24BB@mail.delcoelect.com>
Richard Smol wrote:
>
< snip >
> I always found the
> Perl-code much harder to maintain than the code in Python.
>
1. Doesn't ease of maintenance arise from several
factors that have nothing to do with the language ?
For instance, if the design is truly modular and
abstractions are chosen wisely and named judiciously
i.e., English-like, and 'a driver style of programming'
the first few levels of routines merely call other
routines, it is at the lowest few levels one finds
programese) is used, and good English descriptions
are given,then,
. Even a programmer who does not know the specific
language well (but who knows at least one other language
well), can figure out (mostly from the subroutine names
and the English descriptions) what is being done and how
(i.e., by the use of what subroutines)
. It is only at the lowest few (one or two) levels that
one encounters programese. However, these perform a very
limited task, what the task is being known clearly, from
the documentation. Also, at this time, one is looking at
a small number of lines of code (say under 50). Curly
braces or whatever should not present much difficulty
here. Even here by judicious use of white space and
comments, one can make the code rapidly comprehendable.
(I have been interested for quite a while now on writing
an article on Rapid Comprehendability of Computer Programs
or some such thing. Whether I do this or not, as far as I
know, I am the first to use this term in this context. I
think that this is a useful term. Perhaps the term can be
improved.) The point is: To give up a language because one
does not like '{' or '&', seems to me to throw away a
treasure because some dust is attached to it.
. With perl, I can 'embed' the code in the middle of
documentation very nicely. The whole thing looks like a
(published) technical paper. (This is of course the goal
of Literate Programming.)
. I have never used Python. However, I have not had
trouble writing rapidly comprehendable programs with
Perl. In fact, Perl is so pwerful that I can get the
coding done quickly, and use the time documenting.
V. Chandrasekhar
------------------------------
Date: 3 Nov 1998 19:29:07 GMT
From: verscw@rpi.edu (Wendy Allison Verschoor)
Subject: Output to parallel port
Message-Id: <71nli3$pgg$1@newsfeeds.rpi.edu>
Hello,
For a project in one of my classes, I am trying to output data (almost
certainly just binary data) to individual pins on the parallel port of
a PC running Linux using a Perl script.
I have pinouts on the parallel port, etc. But I don't know any way to
use the parallel port in this way.
Is there a command with which I can do this?
I'd appreciate any help.
Please email me back.
Thanks,
Wendy
----------------
Wendy Verschoor
verscw@rpi.edu
------------------------------
Date: Sun, 01 Nov 1998 17:46:09 +0100
From: Francois Desarmenien <desar@club-internet.fr>
To: jlafosse@my-dejanews.com
Subject: Re: parsing email address problem
Message-Id: <363C9051.9EDB85F3@club-internet.fr>
Try
/<a href="mailto:([^@"\s]+\@[^"\s]+)">/
Should be *much* more efficient too!
jlafosse@my-dejanews.com wrote:
> #! /usr/local/bin/perl
>
> open(FILE, "guestbook.html");
> while (<FILE>){
> if (/<a href="mailto:(.*\@.*)">/){
> $email = $1;
> open(OUT, ">>guestbook.txt");
> print OUT "$email\n";
> close (OUT);
> }
> }
> close (FILE);
------------------------------
Date: Tue, 3 Nov 1998 11:50:09 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: PERL is TOO flexible
Message-Id: <1dhx1t9.h2ydoo12ssikgN@dcepf5.harvard.edu>
PERL ROCKS! <emills@harris.com> wrote:
[chomp]
> In fact, why have "&" at all, when mysub() does just fine? It seems to
> me, Computer Scientist that I am, that a language developer would have
> as an objective, a minimal grammar. Additional complexity adds nothing
> to the language's capabilities or power; conversely it diminishes its
> practicality by making it harder to write and apply a parser-generator,
> and even more significant- it makes it harder for programmers to learn
> and apply the language.
>
[chomp]
Perl wasn't designed with an "objective, minimal grammar". It was
designed more like the english language - to be expressive and flexible.
The benefit of expressiveness is self-documentation (in the right
hands). The downside is sloppiness (like reading a 6th graders first
term paper).
I agree it is hard to teach programmers the complete language (like you
could with Pascal, or C (minus the libraries)). It's more like teaching
a foreign language. First you learn enough to get you started (like
asking how to find the bathroom, for your bill at dinner, where is the
library, etc.), then you start getting more sophisticated. It helps to
read other peoples work in the language, and eventually you develop your
own style.
--
James Peregrino (617)496-6288 (v)
Manager of Comp. Services (617)495-5685 (f)
Harvard Div. Cont. Ed.
james_peregrino@harvard.edu
------------------------------
Date: 03 Nov 1998 08:11:20 -0900
From: Chris Lott <fncll@aurora.alaska.edu>
Subject: Re: PERL is TOO flexible
Message-Id: <ypnyaps8zwn.fsf@aurora.alaska.edu>
That's like saying that one's wife is too flexible.
--
Chris Lott <fncll@uaf.edu>
IT Specialist
University of Alaska Fairbanks
p907.474.6350 f907.474.6841
------------------------------
Date: Tue, 03 Nov 1998 15:30:25 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: PERL is TOO flexible
Message-Id: <alecler-0311981530250001@dialup-733.hip.cam.org>
In article <3638676E.F980FC4A@harris.com>, "PERL ROCKS!"
<emills@harris.com> wrote:
[...]
> This is but one example I've found that seems redundant. Another:
>
> print "stuff\n";
> print ("stuff\n");
>
> What does this add?
Well, the second one causes a compiler warning if you use -w, which you should.
Andre
------------------------------
Date: Tue, 03 Nov 1998 18:43:31 GMT
From: dturley@pobox.com
Subject: Re: Perl Upload Script Needed Badly
Message-Id: <71nisj$s3h$1@nnrp1.dejanews.com>
In article <363e9928.48982376@news.doit.wisc.edu>,
taschaab@students.wisc.edu (Tim Schaab) wrote:
> Hi
> I'm in need of a perl script to ulpoad binary files via the web.
> I'm running the Pi3 Web server and am using Perl on windows. Any and
> all help anyone can give me would be greatly appreciated. Please email
> me at schaab@cs.wisc.edu if you have any information that can help me
> out. Thank you very much.
Well, I 'd hate to point you somewhere you've already looked. Where have you
looked for an example script? Examples can be found on just about every cgi
script archive on the net, in the cgi.pm book, and on the cgi.pm web site.
Since none of the dozens out there will help you, what exactly do you need to
know?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 3 Nov 1998 14:08:43 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <MPG.10a91ecb30ffcca29896fa@news.scescape.net>
In article <<363F22BF.A8460110@min.net>>, jdporter@min.net (John
Porter) pounded the following:
=> Docs in the distribution : 37
=> Programming Perl v.2 (Blue Camel) : 21
=> Programming Perl v.1 (Pink Camel) : 20
=> Newsgroup : 19
=> Studying code in the distribution : 17
=> Tutorial on the WWW : 15
=> Studying code NOT in the distribution : 12
=> Learning Perl v.1 (Pink Llama) : 11
=> Learning Perl v.2 (Blue Llama) : 8
=> Mastering Regular Expressions : 6
=> Teaching or Writing about it : 4
=> Advanced Perl Programming : 3
=> The Perl Cookbook : 3
=> Effective Perl Programming : 2
=> Studying the perl source code : 2
=> Learn Perl in 21 Days (Till) : 2
=> Perl 5 Quick Reference : 1
=> Perl 5 Interactive Course (Orwant) : 1
=> Commercial class : 1
=> Personal tutor : 1
=> University class : 0
You forgot:
Intuition : 1
...
I dunno how I learned it. Perl just seemed intuitively obvious to me.
-- Larry Wall in <6ubeee$m64@kiev.wall.org>
...
:)
--Matthew
------------------------------
Date: 3 Nov 1998 17:06:54 GMT
From: etherl@io.com (etherl)
Subject: POSIX::tmpnam uniqueness
Message-Id: <slrn73ue3m.bsr.etherl@dillinger.io.com>
Is the filename returned by the tmpnam function in POSIX guaranteed to be
unique only in the /tmp directory or across the filesystem? I need to be
able to generate a unique filename in another part of the filesystem and
want to know whether I can use this and trim the pathname or if I need to
get cracking on generating my own.
Thanks for any assistance.
--
etherl@io.com
------------------------------
Date: Tue, 03 Nov 1998 18:32:59 GMT
From: mpeppler@mbay.net
To: nguyen.van@imvi.bls.com
Subject: Re: Problem with installing modules sybperl & Data-Dumper
Message-Id: <71ni8r$r8a$1@nnrp1.dejanews.com>
In article <71ctb5$440$1@nnrp1.dejanews.com>,
nguyen.van@imvi.bls.com wrote:
> Hi guys,
>
> I tried to install these two mudules but got some errors; so please help
> me:
>
> for module sybperl, I got the following errors:
> ________________________________________________________________________
>
> acc -c -I/opt/net/solaris/sybase/include -O -DVERSION=\"2.09\"
> -DXS_VERSION=\"2.09\" -Kpic -I/opt/lib/perl5/sun4-solaris/5.00404/CORE
> -DCTLIBVS=100 -DSYBPLVER='"2.09"' -DDO_TIE CTlib.c
> sh: acc: not found
Either the acc compiler is not installed on your system, or your PATH is
not set correctly. Talk to your SysAdmin to find out where acc is installed,
and set your PATH accordingly.
Michael
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 03 Nov 1998 09:17:07 -0800
From: Greg Coit <gbc1@axe.humboldt.edu>
Subject: Re: Question regarding CGI.pm
Message-Id: <363F3A93.B5BB659A@axe.humboldt.edu>
I appreciate all the responses to my question. This short snippet:
$query=new CGI;
print "<H2>Current Values</H2> $query\n<P>";
*did* work with 5.003_2 (I got it straight from the CGI.pm man page - oh,
and yes is did require start_html and end_html stuff too), but Lincoln Stein
indicated in his email reply that this was broken in Perl 5.004, so it's
been removed. I also tried $query->dump with no success, it gave me "can't
call method "dump" on an undefined value". A friend of mine sent me his
version of dumping params, and it works just fine (I'd include it here, but
I haven't had a chance to ask his permission to share his code). But I do
appreciate the help from everybody who responded, and especially to Lincoln
for writting CGI.pm
Greg Coit
gbc1@axe.humboldt.edu
------------------------------
Date: Tue, 3 Nov 1998 11:21:48 -0800
From: "Alistair Calder" <webmaster@topproducer.com>
Subject: Reading multiple lines
Message-Id: <71nl40$cpv$1@supernews.com>
I am trying to parse an HTML document (used for current news), which
contains the following:
An href to a document, the text link (or anchor) on one line
The by-line, or main subject, on the next line and finally, a few <BR>'s a
few lines down to denote the end of this headline.
Here is an example:
<a href="story.asp?ID=11236">Chase Manhattan gets real</a>
<br>Mortgage Corp. division has real time loan status reports
<br><br>
Now, what I have done is taken the first line, stripped off everything but
the reference to the story.asp?ID={number} so that I can write the file to
my local server and include the anchor.
The way I am doing it is using
foreach $item(@NEWS){
if ($item =~ [matching the beginning of the <a href]) {
...[copy the file to my local server]...
}
What I would like to do is, instead of reading each line seperately, I'd
like to read in the whole chunk of data and deal with it as a group. I have
tried a number of different ways, but I just can't get it to work properly.
Is this going to be possible?
Thanks for any help...
------------------------------
Date: Tue, 03 Nov 1998 19:55:54 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Reading multiple lines
Message-Id: <edJ%1.47542$ZF.8547178@news3.voicenet.com>
Alistair Calder <webmaster@topproducer.com> wrote:
>I am trying to parse an HTML document
>
> I have
>tried a number of different ways, but I just can't get it to work properly.
>
>Is this going to be possible?
Quite easily! Just use HTML::Parser. You should be able to find it at
<URL:http://www.perl.com/CPAN-local/modules/by-module/HTML/>
It would proabably be wise to grab the entire libwww bundle.
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: Mon, 2 Nov 1998 17:18:36 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reference Safety
Message-Id: <MPG.10a7f9c535e307c698985f@nntp.hpl.hp.com>
In article <MPG.10a7a9fc7709954e989856@nntp.hpl.hp.com> on Mon, 2 Nov
1998 11:38:05 -0800, Larry Rosler <lr@hpl.hp.com> says...
> In article <363DF59F.BEC2C46B@atrieva.com> on Mon, 02 Nov 1998 10:10:39
> -0800, Jerome O'Neil <jeromeo@atrieva.com> says...
> > I have been working with large hashes, and am concerned about scoping
> > issues when passing their references arround. If one sub returns a hash
> > reference for use in another sub, at what point does the reference fall
> > out of scope? Or am I just being paranoid?
>
> Never. Yes.
>
> Perl is not C/C++.
>
> As long as the reference is live, so will the data referred to be live.
There is one more point that differentiates Perl from C/C++.
Each time a subroutine is invoked and a reference to a lexically scoped
variable is returned, it refers to *different* storage. Similarly,
references to lexical variables created in a loop are different. This
was certainly a pleasant surprise compared to my C expectations of how
'automatic' storage works (off a stack). It is more like 'malloc' in C,
or 'new' in C++.
#!/usr/local/bin/perl -w
use strict;
sub Scalar { my $x = shift; \$x }
print ${Scalar('foo')}, ${Scalar('bar')}, "\n";
sub Array { map { my $x = $_; \$x } @_ }
print map $$_, Array('foo', 'bar');
print "\n";
__END__
prints
foobar
foobar
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 03 Nov 1998 02:14:22 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Reference Safety
Message-Id: <910059311.649468@thrush.omix.com>
Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:
>snip<
: I don't think it is a scoping issue as much as it is a reference count
: issue. When the reference count goes to zero, it ought to go away. At
: least, that's been my experience. And it seems to jive with all ther
: Perl docs I read on the topic at the time.
Yep. This only bites you with circular references such as a linked
list would use because the ref count will likely never go to zero
by itself (you have to destruct it manually). Luckily perl's
builtin dynamic types make such container structures rarely if
ever needed as well as an easy object destruction system for when
it is.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 3 Nov 1998 10:36:31 -0700
From: fozz@xmission.xmission.com (Doran L. Barton)
Subject: Re: regexp and date, help
Message-Id: <71neuv$36r$1@xmission.xmission.com>
Jay Moore <shjmoore@sprynet.com> writes:
>I'm trying to break up a date variable into several fields. However, my
>string match is not matching anything. There must be a cleaner way of
>doing this as well. Any help would be appreciated.
>The following code:
>....
>$date = $smtp{"DATE"};
>print $date;
>($dow,$day, $month, $year, $hour, $min, $sec, $timezone) = $date =~
>/(^\w\w\w\s), (\d\d\s) (\w\w\w\s)(\d\d\d\d\s) (\d\d):(\d\d):(\d\d)
>(.*)$/;
>print ("\nThe date is: $dow $day $month $year $hour $min $sec
>$timezone\n");
Your regular expression is not matching. Here's my proposed change:
($dow,$day, $month, $year, $hour, $min, $sec, $timezone) = $date =~
/^(\w{3}),\s(\d\d)\s(\w{3})\s(\d{4})\s(\d\d):(\d\d):(\d\d)\s(.*)$/;
The reason your original expression was not working is because you were
testing for two consecutive whitespace characters when there was only one:
(\d\d\s) (\w\w\w\s)
^^ ^
See? I would replace that with:
(\d\d)\s(\w{3})\s
I'm assuming you don't really want the spaces to be captured into the
scalars- so I put the the \s characters outside the parentheses.
-=Fozz
--
Doran L. Barton = fozz@xmission.com && http://www.xmission.com/~fozz/;
"Where do you want Microsoft to go today?" --Ron Barry <ronb@cc.usu.edu>
"This may seem a bit weird, but that's okay, because it is weird."
-- Larry Wall <lwall@sems.com> in the Perl v5 man page
------------------------------
Date: Tue, 03 Nov 1998 11:25:40 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Jay Moore <shjmoore@sprynet.com>
Subject: Re: regexp and date, help
Message-Id: <363F3C94.538B62F2@email.sps.mot.com>
[posted to comp.lang.perl.misc and copy emailed]
Jay Moore wrote:
[snip]
> Fri, 07 Aug 1998 13:33:22 -0400
if you date format is as consistent, try this:
($dow, $day, $month, $year,
$hour, $min, $sec, $timezone) = split /[:\s,]+/,$date;
-tk
------------------------------
Date: Tue, 3 Nov 1998 09:19:16 -0800
From: "Diana Clarke" <dwclarke@earthlink.net>
Subject: Sambar Server
Message-Id: <71neci$ikp$1@oak.prod.itd.earthlink.net>
Hello,
Does anyone know if the Perl Interpreter packaged with the
Sambar Server works with Windows 95? The author of Perl writes that he
thinks it works but hasn't tested it.
Diana Clarke
------------------------------
Date: 3 Nov 1998 19:00:54 GMT
From: bibeks@wv.mentorg.com (Bibek Shrestha)
Subject: Unable to load Shared libs in PERL
Message-Id: <71njt6$r3h@hpbab.wv.mentorg.com>
Hi
I am writing some extensions for Perl.
I had created a shared lib(libpdbperl.sl) in a HP machine. However,
I just cannot load this in a different HP machine.
The shared lib was built with a dependency on another lib.
So I have placed this dependent lib on the SHLIB_PATH, and made sure
the SHLIB_PATH is enabled in the libpsbperl.sl. But still no success.
A simple code is as follows:
**************************
use DynaLoader;
my $lib=&DynaLoader::dl_load_file("libpdbperl.sl");
if(!$lib){
my $mess=&DynaLoader::dl_error();
print $mess;
}else{
print "success\n";
}
********************************
And some info on the lib
chatr libpdbperl.sl
libpdbperl.sl:
shared library
shared library dynamic path search:
SHLIB_PATH enabled first
embedded path enabled second Not Defined
shared library list:
dynamic /net/gman/scratch1/IC/IC_ENG/ic/ic_superpro
j/hpu/Mgc_home/pkgs/cxx_inhouse/cygnus/H-hppa1.1-hp-hpux9.05
/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7-mentor-96q1p48/../../..
/libstdc++.sl
dynamic /lib/libm.sl
**************************
I looked into the code and found out that the dl_load_file actually uses
the shl_load() function of C. I wrote a code in C and the lib did get
loaded. Ofcourse I had to enable the SHLIB_PATH in the output file a.out.
So I think the problem is with that dependency in the lib. If anyone
know the solution to this problem it would be really great. It would
be greatly appreciatd.
Thanks .
--
Bibek Shrestha
------------------------------
Date: Tue, 03 Nov 1998 11:18:12 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: volunteers needed to test javascript database
Message-Id: <363F3AD4.90EF8E16@email.sps.mot.com>
kush@dircon.co.uk wrote:
>
> Hi there information pros
>
> I am currently seeking volunteers to carry out a beta test of a new
> search engine called Advanced Sniffer.
>
> Advanced Sniffer is a Javascript based database developed to aid in the
I will test it if you write it in Perl. Java?????
-tk
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4141
**************************************