[8406] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2023 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 4 17:16:34 1998

Date: Wed, 4 Mar 98 14:00:25 -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           Wed, 4 Mar 1998     Volume: 8 Number: 2023

Today's topics:
    Re: "Learning Perl" or "Programming Perl" (Greg Bacon)
    Re: "Learning Perl" or "Programming Perl" <keithmur@mindspring.com>
    Re: "Learning Perl" or "Programming Perl" (Jeff Yoak)
    Re: A perl question <jdporter@min.net>
    Re: A perl question (Craig Berry)
    Re: A perl question (Andrew M. Langmead)
    Re: A perl question (Mike Stok)
    Re: A specific regular expression... (Correction) <object01@cc.gatech.edu>
        A specific regular expression... <object01@cc.gatech.edu>
    Re: A specific regular expression... <jdporter@min.net>
        Change Unix environment variable using Perl <zzhu@scl.ameslab.gov>
    Re: Follow up to "PERL" puzzle (Greg Bacon)
        maintaining state (Alen S Bubic)
        Need help on script nathan@cyberservices.com
    Re: Need help to setup Perl win32 in IIS4 <Sebastian_Probst@hp.com>
        overreached my grasp of references kevin@cmhcsys.com
    Re: Perl Scripts for NT server <media@organizedmedia.com>
    Re: QUESTION ! how to fill out referer variable in LWP: <jdporter@min.net>
    Re: Stripping (Most) HTML tags <jsd@hudsucker.gamespot.com>
    Re: Summing Up Array Values - How Do I? (Tom Rokicki)
    Re: The -w switch (was Re: better way to do this?) <dballing@speedchoice.com>
    Re: The -w switch (was Re: better way to do this?) <jsd@hudsucker.gamespot.com>
    Re: What is PERL? Learn JAVA instead? (Frank)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 4 Mar 1998 21:17:42 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <6dkgdm$5gh$2@info.uah.edu>

In article <34fdae32.15620144@news.ionet.net>,
	benbean@mail.ionet.net (Benjamin Smith) writes:
: On 4 Mar 1998 18:56:24 GMT, gbacon@cs.uah.edu (Greg Bacon) wrote:
: : If it weren't for ``Tom Christiansen's behaviour on this newsgroup''
: : it would be in a much sorrier state than it already is. 
: 
: My rebuttal to this would be that sure, there is plenty of online
: documentation supplied with Perl, all of which I'm sure covers just
: about everything one needs to know about the language.

We agree on this point.

: But, for the
: sake of argument, apply the same logic to learning C entirely based on
: a definition of the language, its syntax and constructs.

Tread lightly; I've spotted two errors.  The first is that Perl's docs
are not strictly a language definition.  Consider perltoot or perldsc.
These are rendered in tutorial English.  You don't find such in formal
language definitions.  Second, the C core language is very small as
compared to many other languages (and not very difficult to learn).
It's the standard C library that usually trips people up.  I know that
the standard library is part of the C language, but your point seems
to focus more on language syntax which is part of the language core.

: Sure, all the
: information is there in the compiler help and man pages but without a
: guide of some sort to present the information in a logical and
: straight-forward manner it doesn't do the beginner any good.

There are tutorials in Perl's docset.  There's _Learning Perl_.

: My point is this: if it were possible to learn Perl entirely from the
: supplied documentation alone there would be no market for books such
: as Mr Christiansen's.

What do you think everyone did before we had the Camel and the Llama?

: If you already have a basic working knowledge of
: the language, referring to the man pages and FAQs may be of help, but
: if you're just starting out in a language, sometimes it's just easier
: to ask a peer who has been through this learning process themselves.

It's also easier to rob a bank than to hold down a steady job.

: Whilst I agree that it's perfectly adequate to assist an asker of a
: frequently asked question by pointing them to an FAQ list or article
: somewhere that answers their question, I don't think it necessary to
: ridicule or abuse them in the process.

No, not necessary, but the unfortunate fact is that it happens.  We're
humans.  We get exasperated and go off on the next unlucky person to
cross our path.  I would have a hard time criticizing someone for being
human.  Some of us are cut out for front line tech support, and others
of us aren't.  Tom is simply in the ``have not'' category in this case.
This is neither good nor bad.  Consider that advanced users can benefit
from Tom's knowledge much more than a beginner could, but there are
surely those who are much more proficient at helping the neophytes.

I'm sick of seeing so much venom directed at Tom from the very people
he works (without monetary compensation) so hard to try to help.  If
you're looking for a butler, you know where to find one.

    http://www.m-w.com/cgi-bin/netdict?gratitude

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Wed, 04 Mar 1998 16:53:27 -0600
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <34FDDB67.C245CDB5@mindspring.com>

Andrew Johnson wrote:
> 
> Benjamin Smith wrote:
> !
> ! Thanks for your opinions everyone... I guess I'm gonna have to
> ! shell out for more than one book... The Camel and one more basic
> ! level. I'll have to hit the store and read through your
> ! suggestions.
> !
> ! I have to say though, Tom Christiansen's behaviour on this
> ! newsgroup has put me off putting money in his pocket. I love my
> ! other O'Reilly books... it's a pity he's causing me to debate
> ! purchasing another.
> 
> while you're debating, please keep in mind---your money would not
> be paying him for his contributions to this group (no one is getting
> paid for that)...it would be paying him... and larry, and randal,
> and the publishers (and not likely in that order) for producing a
> book of exceptional quality which could be an invaluable resource
> for your future perl programming. I wouldn't want to see anyone
> short-change themselves out of a Llama and/or a camel :-)
> 
Or a gecko, considering he's a Windows developer...


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

Date: Wed, 04 Mar 1998 21:42:56 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <6dki8u$ra9@dfw-ixnews10.ix.netcom.com>

gbacon@cs.uah.edu (Greg Bacon) wrote:

>If it weren't for ``Tom Christiansen's behaviour on this newsgroup''
>it would be in a much sorrier state than it already is.  I like when
>I see Tom pointing out that someone's excuse for a newsreader really
>maimed the quoting, that munging the From: address is Bad, Evil, and
>Wrong

I agree with the position several people here, including Tom, have
taken regarding valid email addresses.  I'm personally bothered by
people who munge email addresses, particularly when I try to reply by
mail and my mail bounces.  Recently I attempted to send to Tom's valid
email address a "Thank you" note for something he posted that I
personally found interesting and my mail bounced because it was sent
from a Netcom account.  I tried to resend it via a different SMTP
server and that also failed due to Netcom headers.  Third, I tried
sending it directly from a UNIX box at Clever Computer ( clever.net )
and Tom's filtering didn't like that server either.  My fourth attempt
was sending it through a regional ISP through a borrowed account.
That one finally got through.

Now I certainly realize there is a difference between mangling
addresses in the group and using programs to help decide what mail you
do and don't want to read and I'm not laboring under the impression
that Tom is under any obligation to read anything I send him.  I don't
know whether to Tom notes like mine are baby or bathwater, given his
feelings about unrepliable addresses it did strike me as rather
ironic.

(And Greg... while Tom's bounced mail was definately intentional, I'm
not 100% sure that the following, part of a bounced cc of a Usenet
post,  was equally so, but it looks like it.)

The original message was received at Tue, 3 Mar 1998 20:51:23 -0600
from pluto.cs.uah.edu [146.229.2.78]

   ----- The following addresses had delivery problems -----
"|/shared2/people/gbacon/.filter_mail gbacon"  (unrecoverable error)
    (expanded from: <gbacon@mickey.cs.uah.edu>)

   ----- Transcript of session follows -----
Message rejected: Mail from unauthorized host
554 "|/shared2/people/gbacon/.filter_mail gbacon"... Service
unavailable

Cheers,
Jeff

-------------------------------
Jeff Yoak         jeff@yoak.com



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

Date: Wed, 04 Mar 1998 16:01:21 -0500
From: John Porter <jdporter@min.net>
Subject: Re: A perl question
Message-Id: <34FDC121.4630@min.net>

demarcao@sysadm.suny.edu wrote:
> 
> I have a variable that I need to check for a space and replace the space with
> %20, Can anyone give me an example on how to do this??

Step 1: learn perl.

Step 2: use URI::Escape;
	$s = uri_escape( $s );

hth,
John Porter


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

Date: 4 Mar 1998 20:54:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: A perl question
Message-Id: <6dkf1m$pbt$1@marina.cinenet.net>

demarcao@sysadm.suny.edu wrote:
: I have a problem that I need some help on.

Yes, you do...you need help choosing better subject lines.  A subject like
'A perl question' in c.l.p.m is equivalent to walking into a shopping 
mall and saying 'I want to buy something' at the info kiosk. :-)

: I have a variable that I need to check for a space and replace the space with
: %20, Can anyone give me an example on how to do this??

perldoc perlop
perldoc perlre

See also _Learning Perl_.

HTH...

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 4 Mar 1998 21:15:20 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: A perl question
Message-Id: <EpBCDK.EJq@world.std.com>

demarcao@sysadm.suny.edu writes:


Subject: Re: A perl question

In the future, you might be better of using a subject line that
describes your post in a little more detail. There are some wonderful
suggestions on how to create a good subject line at 
<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>

>I have a variable that I need to check for a space and replace the space with
>%20, Can anyone give me an example on how to do this??

Try the substitution operator, as described in the perlop man page. 
<URL:http://www.perl.com/CPAN/doc/manual/html/pod/
perlop.html#Regexp_Quote_Like_Operators>

Since the substitution operator is such a frequently used part of the
perl language, I hope you don't mind if I make the assumption that you
are just starting to learn perl. If the book that you are using as a
tutorial either omits or glosses over the substitution operator, you
might consider chucking it and getting a different one. One
recomendation would be "Learning Perl."

<URL:http://www.oreilly.com/catalog/lperl2/>

-- 
Andrew Langmead


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

Date: 4 Mar 1998 21:27:41 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: A perl question
Message-Id: <6dkh0d$ol9@news-central.tiac.net>

In article <6dkctf$sno$1@nnrp1.dejanews.com>,
 <demarcao@sysadm.suny.edu> wrote:
>I have aproblem that I need some help on.
>
>I have a variable that I need to check for a space and replace the space with
>%20, Can anyone give me an example on how to do this??

If you want to just do that then something like

  $variable =~ s/ /%20/g;

would convert all the space characters in $variable to %20.  If you're
encoding URIs for web work you might consider the libwww bundle from CPAN
which contains a module whose documentation starts like this:

NAME
       URI::Escape - Escape and unescape unsafe characters

SYNOPSIS
        use URI::Escape;
        $safe = uri_escape("10% is enough\n");
        $verysafe = uri_escape("foo", "\0-\377");
        $str  = uri_unescape($safe);


DESCRIPTION
       This module provide functions to escape and unescape URI
       strings.  Some characters are regarded as "unsafe" and
       must be escaped in accordance with RFC 1738.  Escaped
       characters are represented by a triplet consisting of the
       character "%" followed by two hexadecimal digits.
       [...]

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Wed, 04 Mar 1998 14:32:56 -0600
From: Jeff Stewart <object01@cc.gatech.edu>
Subject: Re: A specific regular expression... (Correction)
Message-Id: <34FDBA78.3043@cc.gatech.edu>

> Is this regular expression looking to match something/something/ at the
> end of $dir?

Sorry, I meant $target_dir

--
Jeff S.


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

Date: Wed, 04 Mar 1998 14:31:12 -0600
From: Jeff Stewart <object01@cc.gatech.edu>
Subject: A specific regular expression...
Message-Id: <34FDBA10.4900@cc.gatech.edu>

What does the following line evaluate to?  Or, what does this change
$target_dir to?

$target_dir =~ /(.+)\/(.+)\/$/

Is this regular expression looking to match something/something/ at the
end of $dir?  Does it populate $1?  It's being used in an uploading
script by Kevin Meltzer, and his comment beside it is "find out upper
level"

I'm a Perl newbie, I'm lost, and I'd -really- appreciate any pointers
here...

Thanks,

--
Jeff S.


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

Date: Wed, 04 Mar 1998 16:50:06 -0500
From: John Porter <jdporter@min.net>
Subject: Re: A specific regular expression...
Message-Id: <34FDCC8E.250C@min.net>

Jeff Stewart wrote:
> 
> What does the following line evaluate to? 
> Or, what does this change $target_dir to?
> 
>   $dir =~ /(.+)\/(.+)\/$/
> 
> Is this regular expression looking to match something/something/
> at the end of $dir? 
> Does it populate $1? 
> comment beside it is "find out upper level"

First, to make it more readable, lets change those default
slashes to something else, so we can un-backslash the slashes
inside:

  $dir =~ m,(.+)/(.+)/$,;

As you can see, this is the m// operator, so $dir is not
being modified.  But this statement does have side effects,
namely, all the usual ones for the m// operator.

What is not especially obvious is that the two occurences of
(.+) in this regex -- each of which would like to eat as much
as possible -- are getting different stuff.  That is, the
first (.+) is being allowed to eat as much of the string as
it can, which is everything up to the next-to-last slash. The 
second (.+) gets whatever is between that slash and the last one.

Keep in mind that if $dir does not contain a slash in the last
position, and another slash before that, the match fails
entirely.  There should be an if() around this operation.

Because there are two parenthesized groups, $1 and $2 are set.

If $dir = '/usr/local/lib/perl5/', then
$1 gets '/usr/local/lib', and $2 gets 'perl5'.

hth,
John Porter


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

Date: Wed, 04 Mar 1998 15:47:55 -0600
From: Zhaobin Zhu <zzhu@scl.ameslab.gov>
Subject: Change Unix environment variable using Perl
Message-Id: <34FDCC0B.70C08351@scl.ameslab.gov>

Hi,

two questions,

1) Why I can not run in Perl
    system ("setenv MY_EV  anyvalue");

2) I can use
    $ENV{"SHELL"}="anyvalue" to set
   SHELL a new string within Perl. But
  SHELL remains the same as before after exit
  of my Perl program.

  Any method to modify environment vatiables
  in perl and make them permenant ?

Thanks in advance ,

Zhaobin Zhu
zzhu@iastate.edu
---



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

Date: 4 Mar 1998 21:20:38 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Follow up to "PERL" puzzle
Message-Id: <6dkgj6$5gh$3@info.uah.edu>

In article <34FDAAED.797BDBA0@wx3.com>,
	"Kevin J. Lin" <kevin@wx3.com> writes:
: As promised, the solution to that "PERL" puzzle.  
[snip]

That is quite possibly one of the most sick and twisted perversions I've
ever come across in my entire life.  Keep it up. :-)

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 4 Mar 1998 19:42:54 GMT
From: abubic@uoguelph.ca (Alen S Bubic)
Subject: maintaining state
Message-Id: <6dkaru$95j@ccshst05.uoguelph.ca>

I was wondering if anybody knew a slick way to maintain state in perl 
(between scripts).  I've tried several different techniques some of them 
work but they are all clumbersome.  All suggestions are welcome!

Thanks in advance

alen bubic
bubic@ocas.on.ca


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

Date: Wed, 04 Mar 1998 15:24:40 -0600
From: nathan@cyberservices.com
Subject: Need help on script
Message-Id: <6dkgph$d2$1@nnrp1.dejanews.com>



#################################################################
# Script 1 "updatetxt1.pl"
#################################################################

#################################################################
# Assgining the variables
#################################################################
$beginform='<FORM METHOD="POST"
ACTION="http://nathans/scripts/branches.pl"><STRONG><SELECT name="user">';

$endform='</SELECT><P><INPUT TYPE="SUBMIT" NAME="Submit" VALUE=" OK
"></FORM>';

$datafile="c:\\webshare\\wwwroot\\java\\nas.data";

$background='<BODY TEXT="#FFFFFF" BGCOLOR="#000000" LINK="#3333FF"
VLINK="#FF6600" ALINK="#000099" >';

#################################################################
# Begin html page
#################################################################
print "Content-type: text/html\n\n";
print '
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Nathan Stanford">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (Win95; I) [Netscape]">
   <TITLE>Update</TITLE>
</HEAD>
<BODY>
<CENTER><B><FONT SIZE=+4>Update</FONT></B><FORM METHOD=POST
ACTION="/scripts/updatetxt2.pl">
<TEXTAREA NAME=notepadtxt ROWS=20 COLS=75>';

open (USERS, $datafile);
	undef $/;
       	$file=<USERS>;
	$/="\n";
	print "$file";

print '</TEXTAREA><BR>
<INPUT TYPE=hidden NAME=datafile VALUE="';
print $datafile;
print'">
<INPUT TYPE=submit VALUE="Update">
</FORM></CENTER>
</BODY>
</HTML>';
close USERS;
exit;

#################################################################
# Second script "updatetxt2.pl"
#################################################################
$datafile="c:\\webshare\\wwwroot\\java\\nas.data";
# content
print "Content-type: text/html\n\n";
#get info
if ($ENV{'REQUEST_METHOD'} EQ 'POST') {
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        @pairs=split(/&/, $buffer);
	}
# split info
        foreach $pair (@pairs)
	{

                ($name,$value)=split(/=/,$pair);
                $value=~tr/+/ s/;
                $value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
                $FORM{$name}=$value;
	}

        $newdatafiletxt=$FORM{notepadtxt};
        $newdatafile=$FORM{datafile};

print '
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Nathan Stanford">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (Win95; I) [Netscape]">
   <TITLE>Update</TITLE>
</HEAD>
<BODY>
<CENTER><B><FONT SIZE=+4>Update</FONT></B><FORM METHOD=POST
ACTION="/scripts/updatetxt2.pl">
<TEXTAREA NAME=notepadtxt ROWS=20 COLS=75 >';

print $newdatafiletxt;

print '</TEXTAREA><BR>
<INPUT TYPE=hidden NAME=datafile VALUE="';
print $newdatafile;
print'">
<INPUT TYPE=submit VALUE="Update">
</FORM></CENTER></BODY></HTML>';

open(USERS, ">$datafile")
	print USERS "$newdatafiletxt";
close USERS;

exit;
####################

Pardon the messy programming but I am throwing these together.
The above open statement when remarked out I get no error but when I put it in
I get "Document contains no data"

The script is supposed to take a text file "nas.data" and then make it where I
can edit it from a webpage then after I edit it I want to be able to hit the
update button and it update the file and bring me back to the update page with
the updated text.



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 04 Mar 1998 13:32:47 -0600
From: Sebastian Probst <Sebastian_Probst@hp.com>
To: James Lin <james@l-i-n.com>
Subject: Re: Need help to setup Perl win32 in IIS4
Message-Id: <34FDAC5F.80E39FD7@hp.com>

Hi James,

running PERL with IIS is not such a problem.

Start the IIS Management Console and call the Properties of the Default
Web Site.

Click on the Tab "Home Directory".

In the Application Setting area you will find a button "Configuration".

In the next window click on "Add".

In the line "Executable" write the following:

PATH\perl.exe "%s" "%s" (The full path to the perl.exe is needed!)

In the "Extension" line enter the extension you are using for PERL
files.(I use .pl)

Then click ok and that's all.

If your virtual directory has executable permission you should be able
to run PERL programs from your Web browser now.

Have fun!

Sebastian Probst
WLD Marketing
Hewlett Packard

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


James Lin wrote:
> 
> Hi all
>     I need help to setup perl for Win32 in IIS4. If you have experience of
> setup Perl in IIS4, please send me a e-mail and show me how to do it. Thank
> you
> 
> James


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

Date: Wed, 04 Mar 1998 14:58:16 -0600
From: kevin@cmhcsys.com
Subject: overreached my grasp of references
Message-Id: <6dkf7v$v2t$1@nnrp1.dejanews.com>

i'm trying to create an array of arrays, each of the baby arrays containing
an array and a scalar.	my first impulse would be to use anonymous arrays all
the way thru the data structure, but it turns out that i needed to have a
named array at one point in the construction of this thing.  (i had to split
something, and needed someplace to put it.)

so, i pulled out the black leopard book, and tried my hand at references, as
discussed in the first chapter.  my problem comes from a line in which i try
to dereference a reference to an array and push the resultant stuff onto
another array.

@element1 = split(' ', $collocation);
$relement1 = \@element1; # reference to a named array
$relement2 = (\@$relement1, \$category); # reference to a list
push (@ArrayOfCollocations, @$relement2);

the complaint comes from the final line, and looks like this:

Not an ARRAY reference at my_script_name_here line etc.

having failed to apply the black leopard correctly, i turned to "perl5 for
dummies," which seemed to suggest that it might work if i rewrote the last
line as

push (@ArrayOfCollocations, [ @$relement2 ]);

alas, that didn't do it either.  so, given the error text, i'm guessing that
my problem is with the line where i create $relement2.	it appears to me to
be identical to p. 6 of the black leopard, although i'll be the first to
admit that i don't get the first couple of paragraphs on that page.

AHAH!  i finally figured out those damn paragraphs,which i now understand to
be saying that BOTH of the examples within them are bogus (contra what i'm
used to, which is first example bad, second example good.)  having
enlightened me, said paragraphs pointed me towards the section on "references
to anonymous storage," and having read same, my line now reads

$relement2 = [\@$relement1, \$category]; # referance to an anonymous array

 ...which works.

in the course of putting my perl problems down in writing, the stupidity of
my code sometimes just jumps right off the page at me in a way that it never
does when i'm coding it.  couldn't say how many messages like this i've
started, and then trashed after finding the answer while trying to figure out
just exactly what my problem was.....

kevin

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 04 Mar 1998 14:25:20 -0600
From: Thomas Lockney <media@organizedmedia.com>
To: NT connection <nhscott@enternet.com.au>
Subject: Re: Perl Scripts for NT server
Message-Id: <34FDB8B0.8EB38C13@organizedmedia.com>

Check out "Essential Windows NT System Administration" from O'Reilly

-Thomas


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

Date: Wed, 04 Mar 1998 16:10:21 -0500
From: John Porter <jdporter@min.net>
Subject: Re: QUESTION ! how to fill out referer variable in LWP::USERAGENT
Message-Id: <34FDC33D.3C75@min.net>

lufan@cheerful.com wrote:
> 
> I wrote a spider in PERL 5.003 using LWP::UserAgent, to
> fetch a page from WWW.
> 
> I want to make the HTTP server take my request as click from a
> specific page, so I want to know whether LWP::useragent or HTTP has a
> variable that can be filled out with an URL emulating just it comes
> from, which used to be logged in httpd server's \logs\referer.log file

If you know about LWP, surely you know about HTTP, right?
And about HTTP::Headers, right?
And about HTTP::Headers::referer() specifically, right?

hth,
John Porter


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

Date: 4 Mar 1998 21:35:55 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: Stripping (Most) HTML tags
Message-Id: <6dkhfr$e4p$1@its.hooked.net>

Abigail <abigail@fnx.com> wrote:
: Kari Marttila (Kari.Marttila.@tietogroup.com) wrote on 1645 September
: 1993 in <URL: news:34FC25F1.4B23@tietogroup.com>:
: ++ 
: ++ I have the same problem. I should write a perl script that parses all
: ++ html tags away from the text. Could someone tell us a simple example how
: ++ to use HTML::Parser (to make a subclass and override one method).

: Which part of the manual didn't you understand?

Geez, do you have to be snotty about it?  I RTFM and didn't understand
any of it -- at first.  Fortunately some kind soul on c.l.p.m helped
me out, and now I will return the favor.

This parser prints out any tag that has "cgi" or "perl" in it.


#!/usr/local/bin/perl -wl

use HTML::Parser;

# pay attention Karl, this is the part that confused you (and me, at
# first):

######################################
package myParser;

# this line is the magic one: it tells perl that myParser is a (ISA,
# get it?) HTML::Parser.

@ISA = qw/HTML::Parser/;  # myParser is a subclass of HTML::Parser

# here you override one of the original HTML::Parser methods.
# read the HTML::Parser manpage to see which methods are available.
# "start" is called when a html start tag is encountered.

sub start {
  my ($this,$tag,$attref,$attrary,$code) = @_;
# the previous line could have been written as my ($code) = $_[4] but
# what the hell, let's list all the parameters...
  if ($code =~ /cgi|perl/) { print "     $code"; }
}
######################################

package main;

# create a parser. since myParser is a (ISA) HTML::Parser, it will
# call the HTML::Parser "new" method if myParser doesn't specifically
# provide one of its own.

$p = myParser->new;

# this loops through all the files provided on the command line,
# slurps in their contents in one swell foop and then invokes $p's
# parse method on the html.

for (@ARGV) {
  open(FILE,"<$_") or die "Can't read $_: $!";
  {
    local $/=undef;
    $html=<FILE>;
  }
  close(FILE);
  print "$_";
  $p->parse($html);
}


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

Date: 4 Mar 1998 12:33:20 -0800
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <6dkdqg$gkv@cello.hpl.hp.com>


Here's my entry for an array summer:

#!/usr/local/bin/perl -w
use strict ;
print &{
#   Note:  no eval, map, foreach, or names visible outside the expression!
#   Our array summation function expression:
          &{sub{my($x)=$_[0];
             &{sub{my($p)=$_[0];&{$x}(sub{&{&{$p}($p)}(@_)})}}
              (sub{my($p)=$_[0];&{$x}(sub{&{&{$p}($p)}(@_)})})}}
         (sub {my($f)=$_[0];sub{@_?(shift @_)+(&{$f}(@_)):0}})
#  applied to:
   } (99, 34, 110, 33) , "\n" ;

For maximum clarity, instead of using function names, I recommend
simply placing the function expression at each call site, as
illustrated by this example.

-tom



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

Date: Wed, 04 Mar 1998 15:06:13 -0600
From: Derek Balling <dballing@speedchoice.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <965ADB2C9E4E1A1D.7B464E1F3C74A50B.D814DE74E376AFA7@library-proxy.airnews.net>

Tom Christiansen wrote:
> 
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, Zenin <zenin@best.com> writes more
> :       I suggest Apache as well, however I often have to use whatever
> :       the client uses.
> 
> I am *really* tired of reading "the client made me do it" whinings.
> 
> Does nothing but money matter?  What happened to technical training?
> Has it fallen prey to money-grubbing lackeys without honor or standards?
> Why do you take jobs in brain-dead environments?  Do you just not care,
> or are you that desperate?
> 
> A surgeon who's told by his client that he must cure a minor headache
> by operating using dirty stone tools has the obligation to explain that
> this is a stupid idea from the start to the finish.
> 
> To the professional, the customer is *not* always right.  It is your
> duty to provide sound technical advice.   Why do programming slaves
> just say "Yes, Master, whatever you say, Master" to their managers or
> clients or whatnot?  Why can't technical training count for anything?
> Where have professional integrity and standards gone?
> 
> Maybe some people like being mindless slaves, but it's a terrible life.

<clap> <clap> <clap>

I got into much the same discussion with a former employer of mine.

I was building a "time-sheet" style interface where employees would log
what time they worked on what projects doing specifically what, and then
that info would get passed on to accounting for billing.

I designed it so that when accounting billed it, they also noted in the
accounting system "what invoice #" they billed each "block" of time on.
(Accounting only had to enter it once, and it propograted out to
everything
it needed to, nice and simple).

The boneheaded VP of the company (great sales guy, asshole when it came
to 
dealing with technical people.. never managed anything but blue-collar
people
in his history, you know the type) decided that it was too much to
expect of
accounting to enter that data. They had enough to do. I suggested to him
the
possibility that "ya know, if you DON'T have them enter that data, and
then
a client comes to us a month from now and says 'what's this invoice
cover', 
and the work-periods aren't linked to the accounting invoice, you've got
no fsckin idea, and you're boned, right?"  His answer of course, because
he
has never dealt with this type of situation is "That's never happened
yet, 
and it never will, so code it this way, blah blah blah".  (He says
'Code'
cuz he heard the tech guys say it and it makes him sound technohip)
Now said PHB also has a predominant ability to completely forget history
and re-remember it in whatever manner suits him, so I told him that some
day
that conversation would come back to haunt him with VLC (our client)
screamed
at him about bad invoices, but his signature was on my paycheck so if he 
wanted me to do it, I would, but be warned, I'm putting in the comments 
exactly why its coded in this brain-dead fashion, and that the coder
[me]
had said that was a silly-ass way of doing things.

He shut up and left (but still insisted I do it his way).

Luckily, I've moved on to a Company-With-A-Clue. :)


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

Date: 4 Mar 1998 20:48:44 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <6dkenc$cd1$1@its.hooked.net>

Abigail <abigail@fnx.com> wrote:
: Jon Drukman (jsd@hudsucker.gamespot.com) wrote on 1645 September 1993 in
: <URL: news:6dhru6$hdk$1@its.hooked.net>:
: ++ note that the book "effective perl programming" by joseph hall and
: ++ randal schwartz says you should probably turn -w off for production
: ++ programs.  (-w is a speed hit and also you don't want your end users
: ++ seeing your warnings.)

: I read that too, and I disagree. As for the speed hit, I hardly believe
: the hit is significant (show me extended Benchmark results to prove me
: wrong). And if an insignificant speed hit is important for your users,
: you probably shouldn't write Perl anyway.

i haven't benchmarked it, but even if it's only .001% we get enough
traffic per day that that would be a worthwhile thing to eliminate.

: I very much prefer a useful error message than a "it produced the wrong
: results" report from the users. 

if i got even "it produced the wrong results" from our users, i would
be in 7th heaven.  ours often mail us with such insightful requests as
"can you tell me my email address?"  no, sorry, that should be "CAN U
TEL ME MY E MAIL ADRES DUDE?!!!??  HURRY!!!"

put it this way -- any "useful error message" will be lost on them.  i
have other ways of finding out what's going wrong.

anyway, to date, i have never had a problem in a production script
that would have been diagnosed with -w.  the -w'able ones are caught
in development.

-jsd-


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

Date: Wed, 04 Mar 1998 20:45:17 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: What is PERL? Learn JAVA instead?
Message-Id: <34fdbc61.4729093@news.halcyon.com>

On Wed, 04 Mar 1998 12:09:57 -0500, John Porter <jdporter@min.net>
wrote:

>Frank wrote:
>> 
>> There's stuff you can do in PERL that would be difficult, or
>> impossible, to do with JAVA.  And vice versa.
>
>(I bet you knew this was coming:)
>Name two things that you can do in Java, which would be
>impossible, or even difficult (by general agreement), to
>do in Perl.
>
Being an expert in neither, I will plead ignorance and give you half
an answer:

1. Try running a perl script in your user's web browser.

Is this an advantage?  Seems to me that it could be, especially if you
are running a web site with a lot of traffic that could burden your
server with operations that might be better performed elsewhere.

>These languages are not really distinguished by what they
>are capable of doing.
>
>John Porter

But then, I'm not an expert.

Frank


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

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 2023
**************************************

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