[12982] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 392 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 5 21:47:23 1999

Date: Thu, 5 Aug 1999 18:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 5 Aug 1999     Volume: 9 Number: 392

Today's topics:
    Re: Activestate Perl/Dos? Question <cassell@mail.cor.epa.gov>
        Anyone know how to use perl to parse data and generate  <wing.k.tang@intel.com>
    Re: Complex data structure <derek@dstc.com>
    Re: editing pdf files via perl (Filip M. Gieszczykiewicz)
    Re: FAQ doesn't work in this case! (Matthew Bafford)
    Re: Help with a more elegant solution to common problem <ltl@rgsun5.viasystems.com>
    Re: how can I write an e-mail in an perl prg? (Michael Wang)
    Re: how can I write an e-mail in an perl prg? <cassell@mail.cor.epa.gov>
    Re: how can I write an e-mail in an perl prg? (Abigail)
    Re: How do I replace a "space" character? (Abigail)
    Re: How do I replace a "space" character? <cassell@mail.cor.epa.gov>
    Re: how to match this pattern? (elephant)
    Re: How to uninstall Perl on Unix ? (Abigail)
    Re: Is there any way to get user name <flavell@mail.cern.ch>
    Re: Is there any way to get user name (Michael Wang)
    Re: Is there any way to get user name <cassell@mail.cor.epa.gov>
    Re: Nastiness contrary to the spirit of perl? (elephant)
    Re: Nastiness contrary to the spirit of perl? why@invite.spam
    Re: Nastiness contrary to the spirit of perl? <llornkcor@llornkcor.com>
    Re: newbie question: splitting hairs <cassell@mail.cor.epa.gov>
    Re: Perl is Not Opening a file (Abigail)
    Re: Perl is Not Opening a file (Abigail)
    Re: Perl seems to be LAME! <cassell@mail.cor.epa.gov>
        Perl/CGI problem: Getting Web Documents from within my  <m.seringhaus@utoronto.ca>
    Re: Problem reading forms with perl (elephant)
    Re: read, write and sysread, syswrite? <dan@tuatha.sidhe.org>
    Re: Skipping . and .. with readdir <rick.delaney@home.com>
        union semun error <dkubilo@oxnardsd.org>
    Re: Why is it.... [REPOST] (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 05 Aug 1999 16:56:31 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Activestate Perl/Dos? Question
Message-Id: <37AA24AF.74215CA@mail.cor.epa.gov>

mknickelbein@my-deja.com wrote:
> 
> Hi,
> I'm sorry if this is offtopic, but I'm not sure if it applies to Perl
> or to DOS.

Well, actually it's a DOS problem.  But your only solutions are non-DOS.

> When I type in at the dos prompt:
> perl myperlfile.pl > myoutputfile.dat
> If there were no errors in the PL file, myoutputfile.dat will contain
> the output of my Perl file, and nothing will be printed to the screen.

Right, because the '>' redirected STDOUT to your file.

> But if there were errors, if will print to the screen and not to the

And this is because errors go to STDERR instead, and '>' doesn't
redirect them.  There's no nice way aorund this if you insist on
sticking to a strictly-DOS solution.

> file.  How can I make it -always- print to the file?

If you read about open() in the perlfunc manpage [type this:
perldoc -f open ] and then read TomC's perlopentut page [you'll have
to open your HTML docs, walk down the left-hand frame until you get to
the 'POD' section, and then read the perlopentut section, you'll
be on your way.  Note that you can use open() in your perl program
to do the redirection of both STDOUT and STDERR to an output file,
even though you can't do it in COMMAND.COM .

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist
mathematical statistician


------------------------------

Date: Thu, 5 Aug 1999 15:25:09 -0700
From: "Wing Tang" <wing.k.tang@intel.com>
Subject: Anyone know how to use perl to parse data and generate excel reports automatically?
Message-Id: <7od2sb$ci2$1@news.fm.intel.com>

Hello all,

    I want to know if it is possible to write a perl script that will parse
throught data from a file and port extracted data into MS Excel spreadsheet.

Thanks,

Wing




------------------------------

Date: Fri, 06 Aug 1999 10:58:57 +1000
From: Derek Thomson <derek@dstc.com>
Subject: Re: Complex data structure
Message-Id: <37AA3351.E522E2E0@dstc.com>

julmajuha@my-deja.com wrote:
> 
> In article <FFzL6I.1yH@csc.liv.ac.uk>,
>   ijg@connect.org.uk (I.J. Garlick) wrote:
> > Why?
> >       $Codes{$Comp} = [123, 321, 345, 543];
> >
> > does what you want. (don't know about the speed difference but gut
> feeling
> > is that this should be faster.)
> 
> The the real program the data is read from a file.
> This example was made just to point the problem.
> 
> I realize it was a newbie question. I did read the ... document,
> but I missed the point that {...} is a dereference operator.
> Just before I learned it was for blocks of code...
> So here it means same as * in C, am I right?

perldoc perlref

But quickly: { ... } is indeed a block of code. A code block returns the
value of the last statement in the block. In the case of @{$hash{$key}}
the block is just being used to get the precedence right.

Once you've read the perlref page, ask yourself what @$hash{$key} is
saying. Then, consider @hash{$key} (your original expression).

> >
> >       map {print "Code = $_\n"} @{$Codes{$Comp}};

Map in a void context. Why build a list that you're going to throw away?


------------------------------

Date: 6 Aug 1999 00:30:33 GMT
From: fmgst+@pitt.edu (Filip M. Gieszczykiewicz)
Subject: Re: editing pdf files via perl
Message-Id: <7odab9$kme$1@usenet01.srv.cis.pitt.edu>

In Article <MPG.12114b7ebb508df989daf@nntp.hpl.hp.com>, through puissant locution, lr@hpl.hp.com (Larry Rosler) soliloquized:
>In article <slrn7qf7a0.s67.abigail@alexandra.delanet.com> on 3 Aug 1999 
>20:54:44 -0500, Abigail <abigail@delanet.com> says...
>> soumitra557@my-deja.com (soumitra557@my-deja.com) wrote on MMCLXIII
>> September MCMXCIII in <URL:news:7o6glf$85b$1@nnrp1.deja.com>:
>> !! Hello.
>> !! I have a pdf file .
>> !! I want to change some string within the file.
>> !! i.e. say the text in the pdf file has "abc woke up at 09 a.m."
>> !! I want to make it
>> !! "abc woke up at 11 a.m."
>> !! Is there a perl program which can do this for me.
>> 
>> perl -pi -we 's/abc woke up at 09 a\.m\./abc woke up at 11 a.m./' file.pdf
>
>Would it were so!  Any text in .pdf files is encoded in some arcane 
>binary format, and not retrieval by the 'strings' command, for example.

All readers herein should beat their way to:

ftp://ftp.foolabs.com/pub/xpdf

and download the full source tree. Then, build "pdftotext".

[regeneration of test back into pdf is left as an excercise to the reader]

;-)
-- 
Filip "I'll buy a vowel" Gieszczykiewicz  |  http://www.repairfaq.org/

                   Always and everything for the better!
 Now exploring whatever, life, and the meaning of it all... and 'not' :-)


------------------------------

Date: Thu, 05 Aug 1999 23:11:29 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: FAQ doesn't work in this case!
Message-Id: <slrn7qk5uo.qsc.*@dragons.duesouth.net>

[Caution!  Shocking snipping ahead!]

And so it came to be that CLH tapped out this message:
: <IMG SRC="/directory/directory.fds/image/somewhere/$somevar/file.gif"
: BORDER="0" WIDTH="47" HEIGHT="24" ALT="Search">
: 
: The above HTML tag is not removed when using LWP's HTML::Parser and I

HTML::Parser does not remove anything.
 
: Basically, I have a script that fetches URLs, reads in the text using
: LWP::UserAgent, removes all HTML and only displays the text (that would
: normally be visible to the viewer).

lynx works pretty well for this.

: I would like to challenge our Perl Gurus out there to come up with a

Gurus?  Why not the Hackers and Experts?  They could probably do it, as
well.

: I don't want to use HTML::Parser for this.

Based on your severe lack of code demonstrating the problem with
HTML::Parser, I tend to doubt you've written any code at all.

September is not here yet, be gone!

True, HTML::Parser doesn't parse HTML, but if the problem happens to be
with some valid HTML that is confusing HTML::Parser, Abigail has offered
ideas for alternatives.
 
: Thanks,

HTH,

: CLH

--Matthew


------------------------------

Date: 5 Aug 1999 23:05:07 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Help with a more elegant solution to common problem
Message-Id: <7od5b3$53l$1@rguxd.viasystems.com>

lt lindley <ltl@rgsun5.viasystems.com> wrote:

:>#!/usr/lib/lprgs/perl -w
:>use strict;
:>my (@fields) = qw/
:>                UCB.rank
:>                DC.identifier
:>                DC.subject
:>                DC.title
:>               /;
:>my %slots;

:>my $find_fields = join('|', @fields);

Better make that

my $find_fields = join('|', map(quotemeta($_), @fields));

To be safe.  The other way would have matched on UCBxrank.

:>my $find_fields_re = qr{<META NAME="($find_fields)" CONTENT="(.+)">/I}o;
:># whatever looping you do here for getting values
:># I'm not sure about the '/I' in that string above, but am faithfully
:># reproducing it in my test cases.
:>my (@test_strings) = (
:>	'<META NAME="DC.identifier" CONTENT="this is content">/I',
:>	'<META NAME="DC.title" CONTENT="this is identifier content">/I',
:>	'<META NAME="bogus" CONTENT="this is title content">/I',
:>);
:>foreach my $test_string (@test_strings) {
:>	if ($test_string =~ $find_fields_re) {
:>		$slots{$1} = $2;
:>	}
:>}
:># At whatever point that you need to see what you have

:>foreach my $key (@fields) {
:>	if (exists $slots{$key}) {
:>		# whatever you do with it
:>		print "Found '$slots{$key}' for $key\n";
:>	} else {
:>		# whatever you do when it isn't in the data
:>		print "Did not find $key\n";
:>	}
:>}

:>####### ###########
:>On my system the above produces:
:>Did not find UCB.rank
:>Found 'this is content' for DC.identifier
:>Did not find DC.subject
:>Found 'this is identifier content' for DC.title
:> 



:>-- 
:>// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
:>// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
:>////////////////////    50 cent beers are in short supply too.

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


------------------------------

Date: 5 Aug 1999 23:17:56 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Re: how can I write an e-mail in an perl prg?
Message-Id: <7od634$9nh$3@news.ml.com>

>there is an article in "The Perl Journal" on how to 
>send e-mail (with 3 methods) - please see the source code at 
>http://www.itknowledge.com/tpj/programs/Issue_14/Sending_Mail/
>
system("mailx -s \"put subject here\" user\@host < file");
system("echo \"put message here\" | mailx -s \"put subject here\" user\@host");

I wonder why this often pops up in perl group, but there never a question
"how do I send email in shell"? Thanks. 

-- 
Michael Wang
http://www.mindspring.com/~mwang


------------------------------

Date: Thu, 05 Aug 1999 17:27:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how can I write an e-mail in an perl prg?
Message-Id: <37AA2BFA.25C189A7@mail.cor.epa.gov>

Michael Wang wrote:
> 
> >there is an article in "The Perl Journal" on how to
> >send e-mail (with 3 methods) - please see the source code at
> >http://www.itknowledge.com/tpj/programs/Issue_14/Sending_Mail/
> >
> system("mailx -s \"put subject here\" user\@host < file");
> system("echo \"put message here\" | mailx -s \"put subject here\" user\@host");
> 
> I wonder why this often pops up in perl group, but there never a question
> "how do I send email in shell"? Thanks.

A good question.  Probably because there are so many cargo-cult webmail
Perl programs floating around.  And they're mostly deficient, if not 
downright defective.  And they're not portable, so as soon as someone
tries that webmail code on their win98 box using PWS, it fails.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist       
mathematical statistician


------------------------------

Date: 5 Aug 1999 19:33:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: how can I write an e-mail in an perl prg?
Message-Id: <slrn7qkb90.uij.abigail@alexandra.delanet.com>

Christian WIese (knigge@garnix.unix-ag.uni-hannover.de) wrote on MMCLXV
September MCMXCIII in <URL:news:37A9A912.BAE8AC8A@garnix.unix-ag.uni-hannover.de>:
~~ in an Variable I habe an text. These text I like to sende to an person.
~~ I work whith unix.
~~ 
~~ how can I do this
~~ like system(mail,"xyz@gmx.com",$text);
~~ or `echo $text|mail "xyz@gmx.com"'
~~ 
~~ what is the correct way?

There's no such thing as "the correct way". There are various alternatives,
all having their advantages and disadvantages.

I suggest you do the following:

1) Read the manual of your mail agents.
2) Read about open, and system.
3) Go to CPAN, and check out the Mail:: modules.

Then you should me able to make a decision.


Abigail
-- 
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??) 
             {s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 5 Aug 1999 18:56:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do I replace a "space" character?
Message-Id: <slrn7qk93u.uij.abigail@alexandra.delanet.com>

perdrix@my-deja.com (perdrix@my-deja.com) wrote on MMCLXV September
MCMXCIII in <URL:news:7ocgit$j9t$1@nnrp1.deja.com>:
~~ 
~~ I'm a newbie to Perl programming, so excuse me if this is a simplistic
~~ question. I need to replace all " " characters with "" in a variable
~~ called $CRITERIA. effectively I need to rid the variable of any spaces
~~ that might be present. Any assistance with this problem would be
~~ appreciated.


It's trivial. A quick look in the manual will tell you how.
It's also a question that's asked here over and over again.

Do some research, will you?



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Thu, 05 Aug 1999 17:13:04 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do I replace a "space" character?
Message-Id: <37AA2890.16CDF40B@mail.cor.epa.gov>

Biju Abraham wrote:
> 
> Try
> $ch = "try this word";
> $ch =~ s/\s*//g;

As Larry Rosler has already pointed out in this thread, s/// is not
your best option here.  tr/// [or y/// if you insist] is faster for
something like single-character replacement or removal.

Also, \s is not the same as 'a space', but is a character class.

And \s* may not be as good a choice as \s+ anyway.  Why match
null strings too?

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist  
mathematical statistician


------------------------------

Date: Fri, 6 Aug 1999 10:19:20 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: how to match this pattern?
Message-Id: <MPG.1214d513aa7073bb989bec@news-server>

Gary O'Keefe writes ..
>By the way, before posting to the group, be sure to scrutinise (and I
>mean really scrutinise) the documentation with your perl installation
>(either perldoc or man) before you post a question.

but then he stumbles on to say...

>Have you tried
>
>	@words = split /[\_|\.]/, $filename;

you advice goes doubly so for posting answers - so perhaps you might want 
to take your own advice and lookup perlre in regards to the Character 
Class metacharacters and work out what'll happen above if

  $filename = 'some|word_some|other|word_1.gif';

and why you didn't just write

  @words = split /[_.]/, $filename;

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: 5 Aug 1999 19:36:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to uninstall Perl on Unix ?
Message-Id: <slrn7qkbfb.uij.abigail@alexandra.delanet.com>

Tom Phoenix (rootbeer@redcat.com) wrote on MMCLXV September MCMXCIII in
<URL:news:Pine.GSO.4.10.9908051144160.9452-100000@user2.teleport.com>:
<> On Thu, 5 Aug 1999, mizote wrote:
<> 
<> > I just want to completely uninstall Perl on HP-UX10.20 before
<> > reinstalling it with different options.
<> 
<> You don't need to do that; it's not from Microsoft!


If my different options included a different directory layout than
the currently installation has, I would uninstall Perl first as well.

That's why I prefer installing perl in /opt/perl, and have everything
in there. Then uninstalling is easy: rm -rf /opt/perl.


Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Fri, 6 Aug 1999 00:43:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Is there any way to get user name
Message-Id: <Pine.HPP.3.95a.990806004002.24753B-100000@hpplus03.cern.ch>

On Thu, 5 Aug 1999, Ala Qumsieh wrote:

> Note: You can get the login name in $ENV{USER}.

Seems to me that in $ENV{USER} you can get whatever was placed into the
USER environment variable before the Perl script was called. 

If you believe that to be the login name, then you're a very trusting
fellow.

Actually on my PC I noticed that it returned the LAN name of the PC
itself, until I set it to something else.  I tried "root", just for the
purposes of this discussion.  ;-)




------------------------------

Date: 5 Aug 1999 23:10:45 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Re: Is there any way to get user name
Message-Id: <7od5ll$9nh$2@news.ml.com>

if user "foo" swicthed to root with su, which user
name you want to get?

getlogin()           => foo
( getpwuid($<) ) [0] => root
-- 
Michael Wang
http://www.mindspring.com/~mwang


------------------------------

Date: Thu, 05 Aug 1999 17:22:24 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Is there any way to get user name
Message-Id: <37AA2AC0.5EA363CD@mail.cor.epa.gov>

Alan J. Flavell wrote:
> 
> On Thu, 5 Aug 1999, Ala Qumsieh wrote:
> 
> > Note: You can get the login name in $ENV{USER}.
> 
> Seems to me that in $ENV{USER} you can get whatever was placed into the
> USER environment variable before the Perl script was called.
> 
> If you believe that to be the login name, then you're a very trusting
> fellow.
> 
> Actually on my PC I noticed that it returned the LAN name of the PC
> itself, until I set it to something else.  I tried "root", just for the
> purposes of this discussion.  ;-)

For more fun, change it to 'tchrist'.  Then visit those sites.  :-)

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist   
mathematical statistician


------------------------------

Date: Fri, 6 Aug 1999 09:49:38 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <MPG.1214ce2074ecc0d6989beb@news-server>

why@invite.flames writes ..
>Actually, I have found this group to be the most intolerant in all of
>the "professional computing" (comp.data.*,comp.lang.*,sybase.*,etc.)
>groups I monitor. EVERY group has questions from people who do not
>invest time in reading README.1ST, it is the nature of a "bulletin
>board" - a lot of junk, and some useful gems.

IMHO there are several reasons why so many novice posts receive RTFM 
responses so brutally in this newsgroup

1) perl is inextricably tied to CGI programming for reasons beyond my 
understanding .. and that means that the perl newsgroups get their fair 
share of the "I own FrontPage so I can create web pages and build a 
business on it." riff-raff that pervades the web design industry

these people are often completely ignorant of internet standards 
(including usenet posting standards) .. and almost always don't want to 
learn more than the bare minimum to get by

2) perl (far more than any language I know) has an enormous resource of 
free documentation/tutorials/articles ALREADY WRITTEN .. and written 
often times by the very same people who give the RTFM answers in here

you need to ask yourself - why would someone spend many hours writing a 
FAQ document or a manual page or a web tutorial/article/etc. and NOT 
direct a question to that documentation when they see it asked ? .. why 
would that author take the time to re-answer the question (possibly 
making a typo or other mistake) instead of just directing the asker to 
the pre-tested pre-prepared answer ???

then ask yourself .. if you answer the same question three times in a day 
 .. even though your answers were just steering the asker to the 
documentation .. don't you think you'd get a little annoyed .. not ONLY 
do these people ignore all the free documentation on their own machines 
 .. but they ignore the questions and answers in the newsgroup

3) perl is too easy .. just about anyone - with a little example - could 
hack about and make it do what they want .. this encourages novices to 
get cracking - instead of actually learning

to stomp this out (as quickly as possible) the answer to questions in 
here is intentionally harsh .. basically because it's tough love .. the 
novice would do far better getting into the documentation and reading 
about the language .. they'll learn more and will be able to write better 
code

if the answer was just given to them .. then tomorrow they'll have 
another question .. and the next day .. and even when all the answers 
have been given to them - their code will still be buggy and crap

it's so easy to write shite in perl .. but it'll work .. sometimes - or 
even most of the time .. and without understanding the documentation - 
there's no hope of getting it right

>Those who seem to get overly upset over questions answered with RTFM,
>to me are like those who want to censor everything in modern media.
>Instead of ignoring what they do not want to see, they feel empowered
>to tell everyone else what that can post. For me, "if you do not want
>to see it, change the channel" works just fine.

so who's side are you on .. you say that this group is intolerant .. but 
at the same time those who find it intolerant should just switch off ?

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Fri, 06 Aug 1999 00:39:48 GMT
From: why@invite.spam
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37b92b8c.28213659@news.iag.net>

On Fri, 6 Aug 1999 09:49:38 +1000, elephant@squirrelgroup.com
(elephant) wrote:

>so who's side are you on .. you say that this group is intolerant .. but 
>at the same time those who find it intolerant should just switch off ?

I am suggesting that individuals take less offense to the constant
presence of the "technically challenged." They are everywhere in our
world. Most of us work with, and for, them. 

I am not choosing a side. I am simply stating my opinion that the
usefulness of this group is adversely affected by all of the
"unplesantness". Personally, I ignore lazy people, and let them
flounder - on usenet, and in the office. Flaming them only gives me
high blood pressure, and gives the group (c.l.p.m. or Information
Services) a bad image by association. 

I am a new Perl user. I come from an xBase background, and I have come
to Perl as a solution to administrative tasks that batch files and
Visual Basic simply did not fulfill. I found the language, and it's
culture appealing - through the myriad of books and supporting web
pages available.

But for me, and obviously others, this newsgroup actually removes some
of the joy that can come from (re)discovering what cooperative/open
source computing can bring - a tool supported by a community, not a
corporation with a profit/loss ratio. Other usenet groups have brought
me some invaluable knowledge, just like this one, but without the
agnst.

Let me restate as a concept: Let the defective users drown (nature's
way). Help those who deserve it - those who help themselves, to a
reasonable degree. If you can't stand to hear the cries for help, plug
your ears.

I am not suggesting anyone who has ability and knowledge leave because
of the mindless ramble of the point-and-click types. But, geeze,
relax! If nothing else, take some pleasure in watching idiots to
stupid things. It is like watching COPS on TV. Most of the guest stars
are morons, and I would hate to be their neighbors. But from a
distance, their ignorance is somewhat amusing.





------------------------------

Date: 05 Aug 1999 18:33:47 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <lnbppx1w.fsf@wind.localdomain>

>Those who seem to get overly upset over questions answered with RTFM,
>to me are like those who want to censor everything in modern media.
>Instead of ignoring what they do not want to see, they feel empowered
>to tell everyone else what that can post. For me, "if you do not want
>to see it, change the channel" works just fine.

ditto...

>This statement is a perfect example of what, IMHO, is truly wrong with
>this group (Is anyone requiring this person to do someone else's
>work?). Not the line noise, but the noisy lines. After all, when one
>"How can I do this" post generates several "RTFM dummy" replies, where
>is the bulk of the wasted bandwidth generated? Not by the newbies.

ditto....

>P.S. For any of the UseNazi's who would like to comment on my
>responding to 2 posts at once, my ordering or message/reply, or my
>general disdain for their whining, I say with a smile - "If you don't
>like it, don't read it - Otherwise, blow it out your ... " 

ditto....
I came here to learn some things about perl, and found exactly
this. Thank you for being of like-minded. I almost thought it a lost
cause.

LP 

-- 
 - "Peace cannot be kept by force. It can only be achieved by
    understanding."
 - "Whoever undertakes to set himself up as judge in the
 field of truth and knowledge is shipwrecked by the
 laughter of the Gods."        -A. Einstein



------------------------------

Date: Thu, 05 Aug 1999 17:07:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: newbie question: splitting hairs
Message-Id: <37AA275B.7221D4DD@mail.cor.epa.gov>

Boris Klimovitsky wrote:
[snip]
>         #!/usr/local/bin/perl -w

Good!  Now you can learn about 'use strict;' and you will be moving
toward perl enlightenment.

>         $file = "list";
>         open (LIST, $file) or die "Cannot open $file: $!";

And you checked the return on open() .  Good.

>         while (<LIST>) {
>                 @line = split;
>                 print "$line[1], $line[2]\n";
>         }
> 
>         My question is: since the split uses a reg.exp to parse $_ (namely,
> split(/\s+/,$_) )
>         why are $1, $2 ... $n not set?

Okay, you're confusing a couple things.  One, 'using' a regex is not
at all the same as 'being parsed within a regex'.  And even if you do
use a regex in a construction such as m// or s/// you still won't have
$1 and $2 set unless you use capturing parentheses.
 
>         Also, a second question:
> 
>         would it be bad to have something like the following?
> 
>         while (<LIST>) {
>                 split; print "$_[1], $_[2]\n";
>         }

Yes, unless you know that you really want to do that with @_ .  You
are not working with pieces of $_ in that print() statement, but
elements
of the array @_ which is very different.  And as your error message 
says, the Perl gurus prefer that you not do an implicit split() to
@_ .

>         when I tried this, I got a message that using split to @_ is
> deprecated... though it says on the split perlfunc page that split
> without any arguments implicitly puts the values in @_. Why am I being
> warned that the use is deprecated? And what should I use instead, to not
> generate those warnings?

How about what you had before?
 
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist         
mathematical statistician


------------------------------

Date: 5 Aug 1999 19:40:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl is Not Opening a file
Message-Id: <slrn7qkbmp.uij.abigail@alexandra.delanet.com>

craig_davids@my-deja.com (craig_davids@my-deja.com) wrote on MMCLXV
September MCMXCIII in <URL:news:7ocnc8$p08$1@nnrp1.deja.com>:
"" 
"" open(USER_DATA,"test.txt") || die("can't open datafile: $!");


Did your chdir() succeed?

What? You didn't do a chdir()? Perhaps you should....



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 5 Aug 1999 19:41:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl is Not Opening a file
Message-Id: <slrn7qkbop.uij.abigail@alexandra.delanet.com>

Makarand Kulkarni (makarand_kulkarni@my-deja.com) wrote on MMCLXV
September MCMXCIII in <URL:news:7ocnnp$pci$1@nnrp1.deja.com>:
[] [In article <7ocnc8$p08$1@nnrp1.deja.com>,
[]   craig_davids@my-deja.com wrote:]
[] > can't open datafile: No such file or directory at
[] > C:\Inetpub\wwwroot\~Kaf\secure\com_fin\data\read.cgi line 4.
[] 
[] I see that you have a ~Kaf in the path.
[] I am not a NT expert. But are you sure that NT supports
[] the meaning of ~ inside pathnames like UNIX.


Apparently, it does understand what it means, as the program is
executed. Otherwise, you wouldn't have had this message.



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Thu, 05 Aug 1999 17:20:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl seems to be LAME!
Message-Id: <37AA2A49.77A1CA3B@mail.cor.epa.gov>

Michael Wang wrote:
> 
> Kai Henningsen <kaih=7MHv$LfXw-B@khms.westfalen.de> wrote:
> >Just like a real programmer can program FORTRAN in any language.
> 
> I do not think you can program FORTRAN in Postscript, for example.

Ooh.  Be afraid.  Be very afraid.

My friend Jeremy Smith has actually written Postscript code that
I would put in this category.  Loops and all.  It generates within
Postscript the days of the month for all 12 months of the year, for 
any given year going back to the switch from the Julian to the
Gregorian calendar.. then outputs results.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist   
mathematical statistician


------------------------------

Date: Thu, 5 Aug 1999 23:35:15 GMT
From: "Michael R. Seringhaus" <m.seringhaus@utoronto.ca>
Subject: Perl/CGI problem: Getting Web Documents from within my CGI!
Message-Id: <FG0Mq4.67K@campus-news-reading.utoronto.ca>

Can anyone help me with this CGI hurdle?

I haven't been programming Perl all too long, although I'm relatively
competent with the basics... I've written some cgi scripts to handle HTML
forms and send mail, etc, but I have a crippling problem:

I can't access HTML documents from inside my script!

I've looked everywhere -- CPAN, many open source developer locations, and
all the examples I've found seem to fall into one of two categories:

1) Simply redirects browser to proper URL with print "Location:
http://....";

2) Makes a terribly complex series of calls to modules that I don't have
(LibWWWPerl, URI, etc; and even if I get them from CPAN, I don't think my
webserver has them, and there's not much I can do about that!)

What I want to do seems easy in principle. I want to have my perl script (a
CGI) take user input and query a series of web pages, then grab all the HTML
that these HTTP requests generated, parse it, pick out the useful bits and
slam it all into a file or e-mail.

Thus, I do not want the user's browser to jump to the page I'm querying, and
as I said before I want to try to avoid all those modules if possible.

Anyone have any insight here? All I want to do is find a way to query
websites (without involveing the client's browser), receive the text/html,
so I can search it and save it. Help!

Michael R. Seringhaus
Department of Biochemistry
University of Toronto





------------------------------

Date: Fri, 6 Aug 1999 09:12:25 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Problem reading forms with perl
Message-Id: <MPG.1214c56761d8d041989bea@news-server>

genelong@my-deja.com writes ..
>elephant, you said:
>> this is WHY PEOPLE
>> ARE CONSTANTLY TOLD TO USE THE CGI MODULE !!!!
>
>Being a newbie, I don't know what that means.  Here is my html code:

<looks skyward>
there are these things called modules .. they are code that's been 
written and tested by a bunch of perl non-newbies .. and they're 
available for free

mostly they're housed at www.cpan.org .. but some of them come with the 
standard perl distribution

the CGI.pm module is on of the ones that comes with the standard perl 
distribution

for more information .. look up the documentation - first start with the 
FAQ

  perldoc -q "How do I decode a CGI form"

then move on to the documentation for the CGI module

  perldoc CGI

then you'll know everything about CGI programming in perl that you have 
to

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Fri, 06 Aug 1999 00:10:11 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: read, write and sysread, syswrite?
Message-Id: <DJpq3.173$Ic.441@news.rdc1.ct.home.com>

Steve Manes <smanes@nospam.heremagpie.com> wrote:
> On Thu, 05 Aug 1999 11:39:30 +0800, Sunny Yeung <sunyueng@scmp.com>
> wrote:
>>     I don't understand what is the different
>>     between read & sysread, write & syswrite.
>>     If they do have difference, when,why and where
>>     to use them.

> On Unix boxes, 'read' is implemented with 'fread', which employs the
> higher level stdio layer.  'sysread' uses the 'read' system call which
> is bound closer to the operating system.  Same diff with 'syswrite'.
> The main reason to use 'sysread' or 'syswrite' is for lower-level
> programming where buffering or software interrupts might be
> problematic.

You're almost, but not quite, correct. The difference you speak of is
between print and syswrite, not write and syswrite.

write does formatted output.

				Dan


------------------------------

Date: Thu, 05 Aug 1999 23:11:41 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Skipping . and .. with readdir
Message-Id: <37AA1A0A.9561DAD7@home.com>

[posted & mailed]

Tom Phoenix wrote:
> 
> On Thu, 5 Aug 1999, Del Kennedy wrote:
> 
> >         next if $next_c =~ /^\.\.?$/; # skip . and ..
> 
> Yes, we all write that. Someday soon, someone who wants to hide files is
> going to sneak them into a directory named ".\n" or "..\n" and we'll all
> repent! :-)

That's why we now have

    /^\.\.?\z/;

which has more style anyway, even if it is a bogey in Perl Golf.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Thu, 5 Aug 1999 17:02:39 -0700
From: "Dan Kubilos" <dkubilo@oxnardsd.org>
Subject: union semun error
Message-Id: <37aa2899.0@news.vcss.k12.ca.us>

Running a RH 5.2 intel box.

Couldn't run majordomo with RH out of the box perl so I installed new perl.
Didn't use rh pachage manager.

majordomo works great but now I get the following errors whenever I try to
install a module.

**  module specific stuff like
In file included from GD.xs:2:
then I get this 'union semun error'

/usr/lib/perl5/5.00503/i386-linux/CORE/perl.h:2546: redefinition of `union
semun
'

Besides,  "start over dude,"  any suggestions?

make: *** [GD.o] Error 1

--
Dan Kubilos, Technology Coordinator
Oxnard School District
805-487-3918  ext. 467
http://www.oxnardsd.org




------------------------------

Date: 5 Aug 1999 18:52:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why is it.... [REPOST]
Message-Id: <slrn7qk8s6.uij.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXV September
MCMXCIII in <URL:news:37a9f8af@cs.colorado.edu>:
[] 
[] Ignorance can be cured, as you have so capably demonstrated through your
[] own researches.  Stupidity, however, is a crippling disability which is
[] both congenital and incurable.  Fortunately, we always seem to need people
[] to pick up trash or give out fries at the drive-in window.  Unfortunately,
[] many of these people get the idea in their heads that they're going
[] to become "HTML programmers".  And as yourself have doubtless noticed,
[] many of these come here in desperation with their hands outstretched,
[] begging for alms.  One does what one can for such supplicants, but too
[] often one can in the long run do nothing.

Oh, and I guess lots of them get the idea they will become actors, hair
dressers, dog groomers, police officers or tree surgeons. And I bet most
of them are able to learn enough skills to become an actor, hair dresser,
dog groomer, police officer, tree surgeon or programmer. But most of them
won't want to spend the effort, or quickly realize it isn't all glamour.

[] There's this dirty little secret that nobody likes to talk about in
[] public today, for it is phenomenally politically incorrect to do so--as
[] I predict the ensuing followups to this posting shall presently prove.
[] That dirty little secret is that there exists a thing called "talent",
[] and that either you have it, or you don't.

Sure. Everyone has an idea what talent is, although many will be hard
pressed if asked to define it properly. But talent isn't a requirement
to become a programmer.

[] Some people have a knack for programming, but most people don't.

Yep. So, most people just have to work harder than the lucky few.

[] Talent cannot be instilled.  
[] Talent cannot be learned.
[] Talent cannot be taught.
[] Talent cannot be bought.
[] Talent cannot be created.  

True. Talent isn't required though.

[] Very few are born gifted, but that's the only way you get it--which
[] is why, after all, it's called a gift.  Seldom does a brilliant
[] mathematician, physicist, composer, or computer programmer spontaneously
[] appear late in life, having just spent their previous three or four
[] decades flipping burgers.  The gifted and the talented amongst us are
[] noticed early.  They are a light that burns too brightly to ignore.
[] Their natural gifts cannot be hidden from the world, their talents
[] suppressed.  They can be nurtured or they can be starved, yet genius
[] remains something born and not made.

This suddenly dramatically decreases the set we are talking about. Where
we first discussing "programmers", now it's suddenly "brilliant
programmers".  Not everyone is brilliant. Not everyone needs to be. I
am not a brilliant cook, but I sure can make a tasty meal. I am not a
brilliant driver, but I've never gotten an accident, people don't get
scared, and I seldomly get lost.

[] Great programmers are artists, coding artisans if you would, whose
[] insights and inspirations are irreproducible and irreplaceable.
[] You can't just fire one great programmer in and then turn around and hire
[] yourself another.  Even if you managed to find another great programmer,
[] it wouldn't be the same.

Certainly. That's holds for the great sales guy too. And if you go from
one great dentist to another, it wouldn't be the same either. People are
unique. Programmers are people.

[] The traditional engineering techniques and orderly production schedules
[] that old-style managers try to apply to programming are not always
[] well-suited to that discipline, for it is often more one of inspiration
[] than it is of perspiration.

I don't believe that. Inspiration might help, but the bulk will remain
perspiration. And for most cases, inspiration can be replaced with
perspiration. Doing something totally new, or radically different might
be the result of a flash of inspiration. But how often does that happen?
I cannot remember anything totally new or radically different presented
in a Perl news group, nor do I find any such thing in any of the Perl
books I know.

[]                              This drives profit-minded businessmen with
[] concrete deadlines completely crazy with frustration, because they are
[] unable to predict those flashes of brilliance from gifted individuals
[] that may be critical to their venture.

It's an unworkable situation. If you can't code something because you
haven't had your flash of brilliance yet, you're plain stupid. The smarter
person would make use of the resources available and look up how to do it.

[] The quality and quantity of work created by a great programmer are
[] immeasurably superior to that produced by any possible number of poor
[] programmers combined.

But there's a huge range between a 'great programmer' and a 'poor
programmer'.  And most people can certainly become a programmer writing
quality programs.  Just like most people can learn how to cook, repair
shoes and drive a car.  But it takes effort. And many don't realize they
can learn how to program.

[]                        No number of accountants and tax preparers can add
[] up to another Gauss or Einstein, nor can any quantity of house painters
[] be combined to create a Leonardo or Rembrandt.

Certainly. But Rembrandt and Leonardo together can't do the painting
jobs here in this town either - Rembrandts and Leonardos are just too
rare. You find one every couple of centuries. But maybe we should just
be content with the fact there are no programmers; after all, we had Ada
Lovelace last century, and Jon von Neumann this century. We're spoiled!

[]                                                 And no matter how many
[] script kiddies and "HTML programmers" you care to gather together, you
[] will never in that aggregate mass arrive at the equivalent of Donald
[] Knuth or Ken Thompson.

No. But you don't go yelling "There are no mathematicians here!" at
Caltechs math department either, just because they don't have a Gauss
on their current employee list.

If one has to be an equivalent of D. E. Knuth or K. Thompson to be a
programmer, then I can claim I don't know any Perl programmers.

[] Fine, so not everyone is cut out to become a great programmer.  So what?
[] Can't anyone be at least a regular programmer?  
[] 
[] Well no, I'm afraid not.  Not everyone is cut out to be any sort
[] of programmer whatsoever.  They just don't have the gift it takes.

On what do you base that? What "gift" is required? I don't think any
gift is required.

[] The explosion of the net and the disparagement of formal education have
[] combined to generate a popular but perilous myth that anyone can be
[] a programmer.  They can't.

Not everyone. But most.

[] This doesn't mean that the merely average person cannot ever be
[] educated, nor that in them cannot be instilled an abiding sense of
[] hard work and an honest desire for achievement.  Certainly these are
[] worthy goals for anyone; there is no dishonor in hard work, whether it
[] be in house-keeping or in chemistry.  These people can still lead happy
[] and fulfilling and productive lives--just perhaps not in programming.

You think programming is something special? It's just a job....

[] Sometimes you'll find that there are people who just don't "have it"
[] and never will; you can usually see this in a person pretty early on.
[] You should no more try to entice these people into a career in rocket
[] science or computer programming than should you attempt to teach a pig
[] to sing.  The appropriate biological hardware just isn't there, and all
[] you'll end up with is a lot of frustrated and unhappy people.  And pigs.

Could you point out which brain lobe is required for programming? ;-)




Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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 V9 Issue 392
*************************************


home help back first fref pref prev next nref lref last post