[6676] in Perl-Users-Digest
Perl-Users Digest, Issue: 301 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 14 20:17:30 1997
Date: Mon, 14 Apr 97 17:00:27 -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 Mon, 14 Apr 1997 Volume: 8 Number: 301
Today's topics:
A Program to List All Dirs/SubDirs (wayne t. watson)
Re: Can you index multiple files (David Crawford)
Cannot call method "import" in empty package.... <ting@platinum.com>
CGI Encryption <randy@webodyssey.com>
Re: Grabbing links from html pages? <tchrist@mox.perl.com>
Re: Grabbing links from html pages? <tchrist@mox.perl.com>
Re: Installing Perl5.003 (Matthew Cravit)
Interactive HTML forms - NO CGI! (Robert Evans)
mail an attached file from perl? (Apple-O)
Re: mail an attached file from perl? (Nathan V. Patwardhan)
Module naming question: Net::Rcmd? <petew@lexis-nexis.com>
Re: my love/hate relationship the period! (Andrew M. Langmead)
Re: my love/hate relationship the period! (Nathan V. Patwardhan)
Re: my love/hate relationship the period! <rra@stanford.edu>
Re: my love/hate relationship the period! (Matthew Cravit)
Re: No GUI environment for Perl? <david@jemez.kellogg.nwu.edu>
Pattern Matching Multiple Times. (Digital Psychosis)
Re: Pattern Matching Multiple Times. (Tad McClellan)
Perl -e switch <earl@bell.us>
Re: perl pattern matching <usenet-tag@qz.little-neck.ny.us>
Re: perl pattern matching (David Alan Black)
Re: Perl-Books. (I R A Aggie)
Re: Perl2awk or Perl2sed translators < hansm@icgned.nl>
PerlIS - Where can I get it? <lonewolf@driveway1.com>
Re: QUESTION: hidden traps if blessing into container c <tchrist@mox.perl.com>
removing first 2 characters from scalar value. <jmscott@ainet.com>
Re: removing first 2 characters from scalar value. (Jason Kohles)
Re: removing first 2 characters from scalar value. (Tad McClellan)
Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Jon S Anthony)
Re: sockets.pl library module for CGI <tchrist@mox.perl.com>
Re: Strange warning about split, without a split being < hansm@icgned.nl>
Re: Unix and ease of use (WAS: Who makes more ...) (Peter Seebach)
Re: Why is $Line=~ s///; erasing = (David Alan Black)
Win32::Spawn() <hoffmank@plaza.ds.adp.com>
Re: Win32::Spawn() (Nathan V. Patwardhan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Apr 1997 19:40:05 GMT
From: wayne@netcom.com (wayne t. watson)
Subject: A Program to List All Dirs/SubDirs
Message-Id: <wayneE8n7yu.L9H@netcom.com>
Anyone have a simple program to list all
the directories and subdirectories below a given
directory? Maybe something like:
A
A1
A2
A2.1
A2.2
B
B1
B2
C
D
D1
--
Wayne T. Watson | | / *
The Software Hill | Consulting in C, UNIX, C++ | / . *
Mountain View, CA | Motif, X-Windows, Graphics | // *
(415) 969-4233 | Statistics, Science, | o * .
wayne@netcom.com | Space Sciences, Astronomy | . *
NOTE: As of late 3/97 Comet Hale-Bopp is easily visible
in the morning sky around 4:30am low in the NE,
or in the evening around 7:30pm in the NW.
------------------------------
Date: 14 Apr 1997 20:03:29 GMT
From: crawford@jedi.cis.temple.edu (David Crawford)
Subject: Re: Can you index multiple files
Message-Id: <5iu2ih$9m4@cronkite.ocis.temple.edu>
Try Glimpse from a CPAN near you! http://www.perl.com
Good Luck,
--
===========================================================================
David Crawford crawford@jedi.cis.temple.edu
http://jedi.cis.temple.edu:8080/ http://snowhite.cis.temple.edu:8080
My Name is my address 8-P
\\\\\\\\/////////
===========================================================================
------------------------------
Date: 14 Apr 1997 19:43:45 GMT
From: "Wen Ting" <ting@platinum.com>
Subject: Cannot call method "import" in empty package....
Message-Id: <01bc490c$602872b0$1e2611ac@tingw>
I built a Perl module on Window 95/NT and received following message during
execution time:
Can't call method "import" in empty package "Mypackage".....
Does anybody on net have experienced this message?
wen
------------------------------
Date: Mon, 14 Apr 1997 19:27:08 -0400
From: Randy Carbone <randy@webodyssey.com>
Subject: CGI Encryption
Message-Id: <3352BD4C.2B42@webodyssey.com>
Hello everyone,
A long time ago in internet terms about 8 months in real time, we were
looking for a program or system to encrypt cgi's. It would allow the
program to run of course but the code would not be visible if viewed on
the server or other access. We kind of liken it to compiling a cgi but
we know that is not a possibility, or is it by now? We had made contact
with a person who had written such a program for Unix but lost touch.
We need it for NT. Can anyone make any suggestions? Please email the
response also!
Thanks in advance.
--
Randy Carbone
WebOdyssey, LLC
http://www.webodyssey.com/cigars
http://www.free-golf.com/excel.htm
------------------------------
Date: 14 Apr 1997 22:44:32 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Grabbing links from html pages?
Message-Id: <5iuc0g$22k$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
David_D._Jones@hud.gov writes:
:I want to be get every link from an HTML document. Actually what I really
:want is everything between the <A HREF> and </A> tags. I can get this to
:work if there is only one link per line, but I'm not sure how to do this
:if there is more than one link per line or it the link spans more then
:one line. Any suggestions?
My sugggestion is to consult the FAQ. From part 9:
=head2 How do I extract URLs?
A quick but imperfect approach is
#!/usr/bin/perl -n00
# qxurl - tchrist@perl.com
print "$2\n" while m{
< \s*
A \s+ HREF \s* = \s* (["']) (.*?) \1
\s* >
}gsix;
This version does not adjust relative URLs, understand
alternate bases, deal with HTML comments, deal with HREF and
NAME attributes in the same tag, or accept URLs themselves
as arguments. It also runs about 100x faster than a more
"complete" solution using the LWP suite of modules, such as the
http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/xurl.gz
program.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Can you sum up plan 9 in layman's terms? It does everything
Unix does only less reliably --Ken Thompson
------------------------------
Date: 14 Apr 1997 23:19:29 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Grabbing links from html pages?
Message-Id: <5iue21$5fa$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
friedman@medusa.acs.uci.edu (Eric D. Friedman) writes:
:my @links = ($file =~ m,<\s*a\s+href\s*=\s*"?(.*?)"?\s*>,gsi);
This is perfectly valid:
<A HREF='mylink.html'>gotcha</a>
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Whenever people agree with me I always feel I must be wrong.
--Oscar Wilde
------------------------------
Date: 14 Apr 1997 10:25:41 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Installing Perl5.003
Message-Id: <5itpal$d2g@shell3.ba.best.com>
In article <Pine.SOL.3.93.970414112747.13948A-100000@bmec.hscbklyn.edu>,
Sankar Mukhopadhyay <sankar@hscbklyn.edu> wrote:
> Your C compiler "cc" doesn't seem to be working!
> You'd better start hunting for one and let me know about it.
<SNIP>
>One thing though:
>gcc files are in /usr/local/bin/usr/local/bin. That's because I
>downloaded the file in /usr/local/bin and when I extracted it it made
>all those directories.
Well, the obvious thing to do would be to rm -f /usr/local/bin/usr,
download a fresh copy of gcc, and install it properly. You also need to
make sure you run the just-fixinc (I think) script, which generates the
proper gcc-private header files for your system. Then, as long as
/usr/local/bin is in your path, you shouldn't have any trouble.
There _is_ a switch you can give to Perl's Configure script to tell it
where your gcc is located, but unless you particularly enjoy grief, you
are really better off reinstalling gcc correctly.
Hope this helps.
/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: Mon, 14 Apr 1997 21:10:03 GMT
From: mail-it@web-xpress.com (Robert Evans)
Subject: Interactive HTML forms - NO CGI!
Message-Id: <33599cf0.16387289@news.earthlink.net>
If you know CGI / PERL programming, just skip this message. Sorry to
bother you.
If you are an HTML programmer struggling to learn CGI / PERL or have
just given up, and you are sick of the cryptic mailto forms, this is
for you.
http://www.web-xpress.com/mail-it/index.html
A little program I wrote that stays on our server and recieves your
HTML forms, checks for the required fields, and emails you and the
sender a message you specify. It is easy to use, and best of all, NO
CGI!
It also has lots of other cool features.
http://www.web-xpress.com/mail-it/instructions.html
I'm offering a 10 day free trial, and $5 per month afterwards (I've
got to pay my bills too!) If you really want to use it and can't
afford the $5, just email me a note. I will let the first 50 who email
me use it FREE. (To make up for this little bit of spam.)
Robert Evans
mailto:mail-it@web-xpress.com
------------------------------
Date: 14 Apr 1997 17:56:59 -0400
From: appleo@raven.cybercomm.net (Apple-O)
Subject: mail an attached file from perl?
Message-Id: <5iu97b$m4f@raven.cybercomm.net>
I know how to send a simple text mail message (calling UNIX mail) from a
perl script, but how do you send an attached file, such as a binary
picture or program?
------------------------------
Date: 14 Apr 1997 23:35:33 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: mail an attached file from perl?
Message-Id: <5iuf05$h7q@fridge-nf0.shore.net>
Apple-O (appleo@raven.cybercomm.net) wrote:
: I know how to send a simple text mail message (calling UNIX mail) from a
: perl script, but how do you send an attached file, such as a binary
: picture or program?
You'll want to look at MIME::Mime-Lite from
http://www.perl.com/CPAN/modules/by-module/MIME/
and maybe even Mail::MailTools
http://www.perl.com/CPAN/modules/by-module/Mail/
for starters.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 14 Apr 1997 16:12:53 GMT
From: Pete Williams <petew@lexis-nexis.com>
Subject: Module naming question: Net::Rcmd?
Message-Id: <5itl25$dq0@mailgate.lexis-nexis.com>
I'm finishing up a module interface to rcmd(3n) and friends. I think the
natural thing to do is call it Net::Rcmd...
Any comments on this by those who know, before I upload it to CPAN?
TIA,
Pete Williams <petew@lexis-nexis.com>
--------------------- SITUATION: New Account Creation ----------------------
TECHNICAL THUG: Writes perl script that creates home directory, copies in
incomprehensible default environment, and places entries in /etc/passwd,
/etc/shadow, and /etc/group. (By hand, NOT with passmgmt.) Slaps on
setuid bit; tells a nearby secretary to handle new accounts. Usually,
said secretary is still dithering over the difference between 'enter'
and 'return'; and so, no new accounts are ever created.
-- Stephan Zielinski "KNOW YOUR UNIX SYSTEM ADMINISTRATOR - A Field Guide"
------------------------------
Date: Mon, 14 Apr 1997 21:54:15 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: my love/hate relationship the period!
Message-Id: <E8nE6F.DI1@world.std.com>
stzydek@rs6000.cmp.ilstu.edu (Steven T. Zydek) writes:
>I am having trouble splitting a string by a period. here's what I am doing:
>example:
>-----------------------beginning--------------------------------------
>$love = "138.87.2.240";
>($hate, $hate1, $hate2, $hate3)=split(/./, $love, 4);
>print "\n$hate, $hate1, $hate2, $hate3";
>-----------------------cut here---------------------------------------
The first argument to split is a regular expression pattern. Regular
expressions have certain special "metacharacters" that stand for the
more complex elements of pattern matching. (The complete list of
metacharacters is in the perlre man page.) The period is one of those
regular expression metachacters. It matches every character except a
newline.
To split the string as you intend to, preced the period with a
backslash in your regular expression. The backslash in perl is another
metacharacter. It disables any special meaning of the following
character, meaning that the sequence /\./ will match the periods in
your string.
--
Andrew Langmead
------------------------------
Date: 14 Apr 1997 21:46:40 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: my love/hate relationship the period!
Message-Id: <5iu8k0$8b1@fridge-nf0.shore.net>
Nathan V. Patwardhan (nvp@shore.net) wrote:
: $love = "138.87.2.240";
: (@hated) = split(/\./, $hate);
: foreach (@hated) {
: print $_,"\n";
: }
What I meant to say was:
$love = "138.87.2.240";
(@hated) = split(/\./, $love);
foreach (@hated) {
print $_,"\n";
}
*thud*
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 14 Apr 1997 15:02:18 -0700
From: Russ Allbery <rra@stanford.edu>
To: stzydek@rs6000.cmp.ilstu.edu (Steven T. Zydek)
Subject: Re: my love/hate relationship the period!
Message-Id: <qumg1wtgt5h.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
Steven T Zydek <stzydek@rs6000.cmp.ilstu.edu> writes:
> I am having trouble splitting a string by a period. here's what I am
> doing:
> ($hate, $hate1, $hate2, $hate3)=split(/./, $love, 4);
. is a regex metacharacter which matches any character. That's not what
you want; you want a literal period. You therefore need to escape it.
Try:
($hate, $hate1, $hate2, $hate3) = split (/\./, $love, 4);
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 14 Apr 1997 14:48:03 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: my love/hate relationship the period!
Message-Id: <5iu8mj$gtg@shell3.ba.best.com>
In article <5iu3pq$ktf@thor.cmp.ilstu.edu>,
Steven T. Zydek <stzydek@rs6000.cmp.ilstu.edu> wrote:
>
>This has not worked for me. I have tried different characters (i.e.,
>I replace the periods in $love with "+" or "=" or " " and it has worked.)
The period has special meaning within regular expressions. Try:
($item1, $item2, $item3, $item4) = split(/\./, $whatever, 4);
instead.
/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: Mon, 14 Apr 1997 16:46:16 -0500
From: david <david@jemez.kellogg.nwu.edu>
Subject: Re: No GUI environment for Perl?
Message-Id: <Pine.HPP.3.95.970414161809.4527A-100000@jemez.kellogg.nwu.edu>
> : I'm no linux supporter (never used it) but Win95's multitasking
> : is about as bad as you could get.
>
> That hasn't been my experience. I regularly run an incredible number of
> applications at once. I generally have a DB2 database, Emacs, and run
> the compiler from Emacs to do software development. I usually have the
> MSDN viewer open and maybe other language documentation open. I have
> one or more command prompt windows open. Usually I have Word open to
> work on the manual for the product I'm developing, and I often have PFE
> open to print out source files. I almost always have a web browser and
> one or more telnet sessions open, and Organizer. And usually Paint Shop
> Pro too if I'm working on my web site. This is all simultaneously.
Having a lot of applications open simultaneously is not really the same
thing as multi-tasking, as most of the open applications aren't doing
anything.
For example: my machine at work (pentium 166, 32meg ram, WindowsNT
Workstation v4) also has many apps open at once and is generally pretty
responsive switching between them. But if I start Excel off on a huge
re-calculation, minimize Excel, and then switch to something else, my
machine is unusably slow. Same thing with a large perl script or database
rebuild or whatever. When the same machine is running Linux (or any other
x86 Unix, I would imagine), I can be compiling a kernel and running a
large perl script and not notice any performance hit in my foreground
jobs. _That_ is multi-tasking.
--david
------------------------------
Date: 14 Apr 1997 21:26:58 GMT
From: omard@widget.seas.upenn.edu (Digital Psychosis)
Subject: Pattern Matching Multiple Times.
Message-Id: <5iu7f2$uij@netnews.upenn.edu>
Question:
I want to pattern match multiple times using a *PARAGRAPH* format.
e.g. read in an html-text paragraph and strip out *all* a href
comments. omard@eniac.seas.upenn.edu
--
Never take a strangers advice, Never let a friend fool you twice,
Never be the first to believe, never be the last to deceive...
____________The City of Suffering_____________ omard@eniac.seas.upenn.edu
http://www.seas.upenn.edu/~omard/welcome.shtml shade@resurrection.com
------------------------------
Date: Mon, 14 Apr 1997 16:13:16 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Pattern Matching Multiple Times.
Message-Id: <cl6ui5.k95.ln@localhost>
Digital Psychosis (omard@widget.seas.upenn.edu) wrote:
: Question:
^^^^^^^^
^^^^^^^^
Where's a question?
Looks like a statement and an example to me.
Got a question?
: I want to pattern match multiple times using a *PARAGRAPH* format.
That would be a useful thing to do. Show us the code you have so
far, and describe what is not working right with it...
You're likely going to have to do a better job of describing what
you mean by paragraph format (you don't really need to shout at us either)
: e.g. read in an html-text paragraph and strip out *all* a href
: comments. omard@eniac.seas.upenn.edu
I'll guess that the answer to your unstated question is to use
the 'g' modifier:
print "$1\n" while /(something)/g;
# ^
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 14 Apr 1997 10:03:19 -0700
From: Chris Andrew <earl@bell.us>
Subject: Perl -e switch
Message-Id: <33526357.3D99@bell.us>
Hello,
I have a nagging question that has been on my mind for quite some time,
but that the man pages and FAQ do not seem to address.
Where do I find *larger* examples of the use of the -e (command-line)
switch in Perl?
The most extensive explanation I have found (1 line long) is in Learning
Perl side 191 and does not help me much.
Thanks.
------------------------------
Date: 14 Apr 1997 20:05:43 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: perl pattern matching
Message-Id: <5iu2mn$siu$1@news.netusa.net>
Honza Pazdziora <adelton@fi.muni.cz> wrote:
>> $a =
>> "<ARTTIT>title-1</ARTTIT><LID>text1<LIST>listelement</LIST>text-continued</LID><ARTTIT>title-2</ARTTIT><LID>text2</LID><ARTTIT>title-3</ARTTIT><LID>text3</LID>";
>>
>> the result must be:
>>
>> <ARTTIT>title-1</ARTTIT>
>> <ARTTIT>title-2</ARTTIT>
>> <ARTTIT>title-3</ARTTIT>
>> So, what's the best solution?
That depends on a lot of things. How about "what works"? It is much easier
to answer.
>Use non-greedy matching:
>s|<LID>[\W\w]+?</LID>||g;
>or maybe s|<LID>.+?</LID>||g;
The second one is probably better. Myself, I like:
s:<LID>([^<]*|<(?!/LID>))+</LID>::g;
Elijah
------
if I read _MRE_ right, mine is probably faster
------------------------------
Date: 14 Apr 1997 22:12:07 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: perl pattern matching
Message-Id: <5iua3n$4pr@pirate.shu.edu>
Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:
>Honza Pazdziora <adelton@fi.muni.cz> wrote:
>>Use non-greedy matching:
>>s|<LID>[\W\w]+?</LID>||g;
>>or maybe s|<LID>.+?</LID>||g;
>The second one is probably better. Myself, I like:
>s:<LID>([^<]*|<(?!/LID>))+</LID>::g;
>Elijah
>------
>if I read _MRE_ right, mine is probably faster
I think the non-greedy quantifier is faster in this case:
use Benchmark;
sub string { "<ARTTIT>title-1</ARTTIT><LID>text1<LIST>listelement</LIST>text-continued</LID><ARTTIT>
timethese ( 100000,
{'one' => '$a = &string; $a =~ s|<LID>.+?</LID>||g;',
'two' => '$a = &string; $a =~ s:<LID>([^<]*|<(?!/LID>))+</LID>::g;'}
);
__END__
Output:
Benchmark: timing 100000 iterations of one, two...
one: 50 secs (49.16 usr 0.02 sys = 49.18 cpu)
([^<]*|<(?!/LID>))+ matches null string many times at (eval 4) line 1.
two: 91 secs (89.03 usr 0.07 sys = 89.10 cpu)
I think the alternation and lookahead are reversing any advantages that
avoiding the non-greedy ? might have.
David Black
dblack@icarus.shu.edu
------------------------------
Date: Mon, 14 Apr 1997 09:16:36 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl-Books.
Message-Id: <fl_aggie-ya02408000R1404970916360001@news.fsu.edu>
In article <8csp0thmwy.fsf@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:
+ Perl is a powerful tool in the hand of an expert. A beginner might
+ have some difficulty. Best to stay for a while with some toy
+ language, like Visual Basic or TCL. :-)
Or even pascal.
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 14 Apr 1997 22:25:03 GMT
From: Hans Mulder< hansm@icgned.nl>
Subject: Re: Perl2awk or Perl2sed translators
Message-Id: <5iuarv$o9j@news.euro.net>
Randal Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "Harsha" == Harsha Krishnamurthy <hxk1076@cacs.usl.edu> writes:
> Harsha> I am aware of the availability of awk2Perl translator. But could
> Harsha> anyone please let me know if there are Perl2awk or Perl2sed translators
> Harsha> available somewhere ?
> That'd be about as difficult as "english2perl". :-)
Actually, Tom Christiansen once wrote an english2perl translator:
print "What problem do you want to solve? ";
$problem = <STDIN>;
open( POST, "|inews -h" ) or die "horribly ";
print POST "Newsgroups: comp.lang.perl.misc\n";
print POST "Followups-to: poster\n";
print POST "Subject: I don't think perl can $problem\n";
print POST "
I can easily write a program in C which $problem,
but I don't think it can be done easily in perl.
";
--
HansM eval (q-print q:Hope this helps, :-)
------------------------------
Date: Mon, 14 Apr 1997 18:18:51 -0400
From: Larry Honig <lonewolf@driveway1.com>
Subject: PerlIS - Where can I get it?
Message-Id: <3352AD4B.4F5C@driveway1.com>
I can't find the PerlIS.dll in either the NT ResKit or in the downloaded
version of perl 5.003 (only perl100.dll)
Does anyone have a direct link to this file? I can't find it on the
Microsoft site either.
Thanks in advance.
Larry Honig
larhonig@hdex.com
------------------------------
Date: 14 Apr 1997 22:24:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: QUESTION: hidden traps if blessing into container class?
Message-Id: <5iuar3$du$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
brannon@bufo.usc.edu (Terrence M. Brannon) writes:
:1- Is there a module which allows for creating a has-relationship so
:that the contained class knows it's container?
How can something know that it's a container? Or do you
mean know its container? :-) "it's" ne "its"
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
I just hate to be pushed around by some fucking machine. - Ken Thompson, on the i960
------------------------------
Date: Mon, 14 Apr 1997 14:57:11 -0700
From: "Joseph M. Scott" <jmscott@ainet.com>
Subject: removing first 2 characters from scalar value.
Message-Id: <3352A837.5372@ainet.com>
To the point : is/what there an easy way to remove the first 2
characters from a scalar value ( in this case it's just a file name )?
I've dug through the Camel book, but I didn't find anything that would
accomplish this. If I over looked please feel free to list a page
number ( and I will have to seek the forgiveness of Larry, Tom, and
Randal :-) ).
-=joseph
jmscott@ainet.com=-
------------------------------
Date: 14 Apr 1997 16:08:34 -0600
From: robobob@xmission.xmission.com (Jason Kohles)
Subject: Re: removing first 2 characters from scalar value.
Message-Id: <5iu9t2$hq3@xmission.xmission.com>
"Joseph M. Scott" <jmscott@ainet.com> writes:
>To the point : is/what there an easy way to remove the first 2
>characters from a scalar value ( in this case it's just a file name )?
>I've dug through the Camel book, but I didn't find anything that would
>accomplish this. If I over looked please feel free to list a page
>number ( and I will have to seek the forgiveness of Larry, Tom, and
>Randal :-) ).
$file = substr($file,2);
Page 227 of the new camel...
------------------------------
Date: Mon, 14 Apr 1997 16:19:15 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: removing first 2 characters from scalar value.
Message-Id: <j07ui5.kc5.ln@localhost>
Joseph M. Scott (jmscott@ainet.com) wrote:
: To the point : is/what there an easy way to remove the first 2
: characters from a scalar value ( in this case it's just a file name )?
------------
#! /usr/bin/perl -w
$_ = "foobar\n";
substr($_, 0, 2) = ''; # substr() as an lvalue
print;
$_ = "foobar\n";
$_ = substr($_, 2); # substr() as an EXPR
print;
$_ = "foobar\n";
s/..//; # match the first two
print;
$_ = "foobar\n";
s/^..//; # anchored
print;
------------
: I've dug through the Camel book, but I didn't find anything that would
: accomplish this. If I over looked please feel free to list a page
: number ( and I will have to seek the forgiveness of Larry, Tom, and
: Randal :-) ).
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 14 Apr 1997 21:01:39 GMT
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <JSA.97Apr14170139@alexandria>
In article <MPG.dbaa4deac2b5dc8989767@news.demon.co.uk> cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer) writes:
> If I had the time, I'd write a "Lisp for Dummies" book. At least, I'd
> attempt it. The result probably wouldn't get published, as I doubt
Isn't this basically what the "Little Lisper" is?
/Jon
--
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com
------------------------------
Date: 14 Apr 1997 22:48:20 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: sockets.pl library module for CGI
Message-Id: <5iuc7k$22k$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Mark.Grimshaw@ucsalf.ac.uk writes:
:Hi all,
:
:Does anyone know the whereabouts of the Perl module 'sockets.pl' or
:similar referred to in the CGI Programming on the World Wide Web book by
:Shishir Gundavaram?
use Socket;
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"I have many friends who question authority. For some reason most of 'em
limit themselves to rhetorical questions."
--Larry Wall
------------------------------
Date: 14 Apr 1997 21:50:25 GMT
From: Hans Mulder< hansm@icgned.nl>
Subject: Re: Strange warning about split, without a split being used.
Message-Id: <5iu8r1$o9j@news.euro.net>
Devin Ben-Hur <dbenhur@egames.com> wrote:
> What Eike didn't point out to Abigail is that she
> has a space between the 'qw' and the opening '('.
> The list/string delimiter must be the next character
> after q, qq, or qw.
That's the rule in perl version 4.
Abigail uses version 5, which skips white space after q, qq,
qw and qx. She didn't actually say that, but it folows from
the fact that she uses 'qw', which was a new feature in 5.000.
> Apparently at some time in Perl's murky past, the bareword
> 'qw' implied @_ as its argument. This is what the error
> is complaining about (deprecated behavior of bare qw
> -> split(' ',@_)).
In the murky past, perl didn't have 'qw' and bare words were
not allowed. The default second argument to 'split' is $_,
not @_. The deprecated behaviour is that, when not given an
array to store the parts into, 'split' stores them into @_.
Hope this helps,
-- HansM
------------------------------
Date: 14 Apr 1997 17:56:30 -0500
From: seebs@solutions.solon.com (Peter Seebach)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5iucmu$k6n@solutions.solon.com>
In article <01bc4835$513314e0$87ee6fce@timpent.a-sis.com>,
Tim Behrendsen <tim@a-sis.com> wrote:
>[seebs wrote]
>> 1. You cannot correctly assume that human motivations are a global
>> constant. There are differences. Some people are more motivated by money,
>> some more motivated by a desire to do the right thing.
>I agree, which is why I state that anecdotal evidence tells you
>nothing. I base this on history.
But anecdotal evidence *does* tell you something; it tells you that
there exist people who are not like other peuople, and thus, that the
*trends*, too, are not necessarily meaningful.
>I agree, but again anecdotal evidence doesn't tell us much. History
>does tell us that capitalistic countries clearly produce the most
>innovation.
Or perhaps it tells us that relatively liberal countries produce the most
innovation; barring a test using a fairly open government and socialism, we
can't tell.
I can tell you that socialism works much *better* on a small scale; I
personally believe it doesn't scale up well, but I have no evidence.
>> Name one *commercial* product that is "*clearly* better than *any*
>> commercial product, regardless of price." (assume "any other ...)
>We just had a thread on this not too long ago comparing gcc with
>several other compilers as far as optimization! And gcc clearly
>did not produce the best code.
It clearly beats many compilers much of the time. Does *any* of those
compilers always produce the best code? No.
>Is gcc an excellent compiler? Yes. Does it have a few bells and
>whistles that other compilers may not have? Yes.
>Is it the best compiler in the world bar none? No.
Is *any* compiler the best in the world bar none? No. I would say that gcc
has at least as good a claim as *any* other compiler I've ever seen.
Honestly, faults and all, yes, I'd say it's the best in the world, bar none.
It generates better code *FOR MORE TARGETS* than *anything* else I've ever
heard of. It has the best warnings and diagnostics of any compiler I've ever
seen. Yes, it misses a few points; so do all of the others. I think gcc
misses fewer things than any other compiler I've seen.
>> How many *C* compilers can you name that will automatically inline smallish
>> functions? Ever wonder why there are still compilers that never do tail
>> recursion elimination?
>Well, I don't know about inlining (although some compilers do have it),
>but other compilers don't have tail recursion elimination because it's
>a useless feature. IMO depending on a compiler feature to protect
>yourself from bad engineering is a bad idea. I can't think of *any*
>subroutine that is better off using tail recursion over iteration.
Efficiency is not, or at least, shouldn't be, the sole consideration when
expressing an algorithm. I would prefer a recursive quicksort over a
non-recursive one in terms of clarity any day.
A compiler that translates a common idiom efficiently is superior to one that
does not, no matter what you, I, or anyone else thinks of that idiom.
>> *average* human behavior is not a driving force in the best of the best.
>> We're talking about what makes the *best* software, not what makes vaguely
>> acceptable software.
>Correct. And the *best* software is generally commercial.
I see no evidence here. Can you name *any* commercial operating system which
provides better cross-platform support than NetBSD or OpenBSD? No. None of
the commercial OS's even come *CLOSE*.
>You can
>find a temporary blip here and there where a free product is good,
>but what about the 1000s of product categories where commercial
>software is clearly the best?
What about the billions of people who are still doing manual labor on farms?
The world does *NOT* change instantly; we are seeing the first signs of a
much more efficient economic system.
>Anyway, average human behavior is what we're talking about here,
>because there are only so many brilliant people in the world. The
>people who *really* make the innovative extremely complex products
>are the people who can take teams of average people and lead them to
>doing extraordinary work. One guy cannot do it all, which is why
>the examples of excellent free software are usually done by one or
>a few brilliant guys.
No. Brilliant *designs* are all the work of small groups. I defy you to show
even *one* example of a geniunely brilliant design done by more than five
people. Now, groups can make a reasonable *implementation* of that brilliant
design; but only small groups produce elegant designs, and no non-elegant
design is ever brilliant.
>But money is a powerful motivation. Look at the history of
>capitalistic countries. Brilliant people like doing brilliant
>things, but they like it even more when they get direct rewards.
No, they like it *LESS* when they get direct rewards. Look at the
history of the MIT AI lab... In general, brilliant people like to
do brilliant things because they're allowed to, and will put up with
some amount of nonsense if it'll help them work more.
Ken Thompson could probably make an order of magnitude more money than he does
now; to do so, he would have to waste time on things other than research.
(More time than he already does; I'm sure even he has to waste *some* time.)
Why does he not start his own company based on his raw brilliance? Because
he'd rather stick with a position where he can invent things and have fun, and
where the corporation apparently stays out of the way. (I derive this from
descriptions I've gotten, from people who work there, of how Bell Labs works.)
>The only area that free software of any complexity will succeed
>is programmer tools, because programmers will do them for themselves.
>We will never see "average user" level applications that beat
>commercial offerings, because making something simple enough to
>use for the masses is "not the fun part".
It's far, far too early to be saying that. I betcha that, in another 50
years, we'll be seeing free end user applications.
If anyone had claimed, in 1970, that there would someday be millions of
people using a free operating system for which the source code was freely
and publically available, which was more robust than many of the commercial
offerings, no one would have believed it. It's simply too different...
Market predictions are mostly useless in this field, but you can generally bet
on efficiency. Free software is *definitionally* more efficient than
proprietary software.
For that matter, you've overlooked the growing market for *paying work* on
free software. There are people who make a living writing free software;
obviously, you *can* have that cake and eat it too.
-s
--
Copyright 1997 Peter Seebach - seebs at solon.com - C/Unix Wizard
I am not actually gladys@nancynet.com but junk mail is accepted there.
The *other* C FAQ, the hacker FAQ, et al. http://www.solon.com/~seebs
Unsolicited email (junk mail and ads) is unwelcome, and will be billed for.
------------------------------
Date: 14 Apr 1997 22:21:21 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Why is $Line=~ s///; erasing =
Message-Id: <5iual1$5om@pirate.shu.edu>
Hello -
obsidian@shore.net (Kevin Swope) writes:
>hello,
>why does:
>$Blank_var="";
>$Tag=~ s/$Blank_var//;
>occasionally erase the = from variable $Tag when it contains a =
>the line:
>$Tag=~ s///;
>does the same thing.
For what value of $Tag? Or, to put it less deferentially, there
must be something else wrong. Can you post some more code?
David Black
dblack@icarus.shu.edu
------------------------------
Date: 14 Apr 1997 23:01:41 GMT
From: "Kevin S Hoffman" <hoffmank@plaza.ds.adp.com>
Subject: Win32::Spawn()
Message-Id: <01bc4927$8893a1a0$dfc07e8b@scoobysnak>
Why is it that I cannot get this function to spawn or execute anything?
I've tried the following (among others):
Win32::Spawn("D:\path\filename.exe", "arg string", $PID);
Win32::Spawn("batchfile.bat", "", $PID);
...
...
etc..
nothing I"ve done seems to work.
I'm actually trying to run c:\blat\blat.exe with several arguments
Any ideas? Please e-mail me. Thanks.
------------------------------
Date: 14 Apr 1997 23:38:33 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Win32::Spawn()
Message-Id: <5iuf5p$h7q@fridge-nf0.shore.net>
Kevin S Hoffman (hoffmank@plaza.ds.adp.com) wrote:
: Win32::Spawn("D:\path\filename.exe", "arg string", $PID);
: Win32::Spawn("batchfile.bat", "", $PID);
How about:
$program = 'D:/path/filename.exe';
Win32::Spawn($program, "arg string", $PID) || die("spawn error: $!");
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
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 301
*************************************