[9194] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2813 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 5 02:09:03 1998

Date: Thu, 4 Jun 98 23:00:23 -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           Thu, 4 Jun 1998     Volume: 8 Number: 2813

Today's topics:
        (a simple) array problem ames0009@tc.umn.edu
    Re: (a simple) array problem (Tad McClellan)
    Re: -d ? 3 : 7 is ambiguous, how comes? (Ronald J Kimball)
    Re: anybody installed perl in VMS? (Martin Vorlaender)
    Re: Foreach Efficiency <metcher@spider.herston.uq.edu.au>
    Re: Foreach Efficiency <dformosa@st.nepean.uws.edu.au>
    Re: GNU attacks on the open software community rjk@greenend.org.uk
        How do I test MacPerl CGI scrips using my local Browser david.clark@snet.net
    Re: Is it possible to post/read newsgroup articles usin (Michael J Gebis)
    Re: Is PERL case sensitive? (Ronald J Kimball)
    Re: Is PERL case sensitive? (Tad McClellan)
    Re: newbie: trying to remove unwanted data from an arra <danboo@negia.net>
        Perl/DBI/MS Access <outrun@antispam.mediaone.net>
    Re: Problems with FORK/Sun-Solaris (Matt Knecht)
    Re: Reading whole file into a scalar (Philip)
    Re: regexp: Validating UPC Codes (Ronald J Kimball)
    Re: regexp: Validating UPC Codes (Tad McClellan)
        Server Redirection (Chua Boon Yiang)
    Re: Sourcing Unix environment file? <quillan@doitnow.com>
    Re: Spider programms in PERL (Michael J Gebis)
    Re: Spider programms in PERL <tchrist@mox.perl.com>
    Re: Use of HTML, POD, etc in Usenet (was: Re: map in vo (Ronald J Kimball)
        Web Error Log Analysis (NO#!%&SPAM)csu.edu.au (Geoff Deering)
    Re: Why is there no "in" operator in Perl? <dformosa@st.nepean.uws.edu.au>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 05 Jun 1998 02:44:07 GMT
From: ames0009@tc.umn.edu
Subject: (a simple) array problem
Message-Id: <35775669.14893361@news.tc.umn.edu>

I am writing a script that will search an html file for list items and
prices, etc.  I am then having the script write the extracted
information to a database file.  That is no problem.  

The problem:  I want to store each occurence of a string match as an
element in an array so that it will be easier to manipulate the
information before it is printed to the database.

Here is an example:

if (open(MYFILE, "$f")) {
	$line = <MYFILE>;
	while ($line ne "") {
		if ($line =~ /\<li\>/) {	
		@words = split(/.*\<li\>|\<\/li\>.*/gi, $line);
		print @words;		
		}
$line = <MYFILE>;

	}
}

This extracts the information I want and then prints it to STDOUT.
The trouble with this is that the array is written over with each
iteration.  I thought the obvious solution to this was something like
this:

@line = <MYFILE>;  
$count = 1;
while ($count < @line) {
	if ($line =~ /\<li\>/) {	
	   $words[$count -1] = split(/.*\<li\>|\<\/li\>.*/gi, $line);

or this last line could use =~ instead of split.  Neither of these
attempts worked - the value stored in $word[$count -1] was always
equal to the number of succesful matches ("3" or "4" for example).

I feel I am overlooking something obvious.  Any ideas would be
helpful.  Thanks,

T. Ames


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

Date: Thu, 4 Jun 1998 23:22:01 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: (a simple) array problem
Message-Id: <9pr7l6.cug.ln@localhost>

ames0009@tc.umn.edu wrote:
: I am writing a script that will search an html file for list items and
: prices, etc.  I am then having the script write the extracted
: information to a database file.  That is no problem.  

: The problem:  I want to store each occurence of a string match as an
: element in an array so that it will be easier to manipulate the
: information before it is printed to the database.

: Here is an example:

: if (open(MYFILE, "$f")) {
: 	$line = <MYFILE>;
: 	while ($line ne "") {
: 		if ($line =~ /\<li\>/) {	
: 		@words = split(/.*\<li\>|\<\/li\>.*/gi, $line);


                push @words, split(/.*\<li\>|\<\/li\>.*/gi, $line);


[snip]

: This extracts the information I want and then prints it to STDOUT.
: The trouble with this is that the array is written over with each
: iteration.  I thought the obvious solution to this was something like
: this:

[snip]

: 	   $words[$count -1] = split(/.*\<li\>|\<\/li\>.*/gi, $line);

: or this last line could use =~ instead of split.  Neither of these
: attempts worked - the value stored in $word[$count -1] was always
: equal to the number of succesful matches ("3" or "4" for example).


Because you have given split() a scalar context, and that is what
split() is documented to do in a scalar context.

The line I added above gives split() a list context.


: I feel I am overlooking something obvious.  Any ideas would be
: helpful.  Thanks,


You have overlooked push().

Its obviousness is debatable  ;-)



Actually you have overlooked one of *the* most important things
to "get" about Perl.

Namely scalar versus list context.

Most functions return different things depending on the context
in which they are called.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 4 Jun 1998 23:34:08 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <1da4dxh.1ge7q8b1ghd3l2N@bay1-520.quincy.ziplink.net>

John Porter <jdporter@min.net> wrote:

> > So, you say that a scalar in list context is interpreted as a list
> > containing only that scalar. 
> 
> No, he didn't say that.  Only clueless newbies say that.
> It isn't true.  In fact, "there is no such thing as a scalar in a
> list context."  This has been belabored many MANY times in this
> newsgroup.

I believe the statement which has actually been belabored many MANY
times is "there is no such thing as a list in a scalar context."  Read
the text you quoted from the documentation again; it doesn't say
anything about list contexts.  I would argue that there is such a thing
as a scalar in a list context.  For example:

print $n;

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 04 Jun 1998 23:12:54 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: anybody installed perl in VMS?
Message-Id: <35770dd6.524144494f47414741@radiogaga.harz.de>

GEMINI (dennis@info4.csie.nctu.edu.tw) wrote:
:   I'd like to install perl under VMS. however,
: I am not familiar with VMS, so I didn't make it.
: I followed the readme.vms in perl source,

Really?

: got MMK(for make), and run MMK/descrip=[.vms]DESCRIP.MMS
: but... the following messages appear. so what should I do with it?
: or anybody has binary code that I can install directly? (the machine
: is DEC alpha)

You should then have read that quite a few /DEFINEs are necessary
on Alphas and DEC C. Read it again.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Fri, 05 Jun 1998 11:59:28 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Foreach Efficiency
Message-Id: <35775100.341B3248@spider.herston.uq.edu.au>

Peter A Fein wrote:
> 
> John Porter <jdporter@min.net> writes:
> 
<snip>
> > Why don't you test your hypothesis using Benchmark?
> >
> 
> Well, because I have finals in a few days and I need to get this
> working yesterday.  Although I'd like to mess around & benchmark parts
> of my code at some point, that point is not now.  
<snip>

Fair enough, but somebody should assure you that this will take you
about ten minutes.  Benchmark is not a complicated module to use.

-- 
Jaime Metcher


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

Date: 5 Jun 1998 01:18:46 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Foreach Efficiency
Message-Id: <897009526.516304@cabal>

In <35770E46.4D7D@min.net> John Porter <jdporter@min.net> writes:

>Peter A Fein wrote:
>> 
>> foreach my $i (sort article_cmp @all_pages) {
>> 
>> My inclination is that the list-generating sort only gets done once,
>> and therfore doing it outside the loop and storing it in a variable
>> which foreach then indexes would be unnecessary.  Is this correct?

>That's a good inclination to have.
>Why don't you test your hypothesis using Benchmark?

Why use benchmark,  he is testing how meany times foreach is called in a
loop, this is all that is needed.

{
  my $i=0;
  sub count {
   print "Called ",$i++," times\n";
   return (1..100);
  }
}

foreach my $x (&count) {
  print "Step $x\n";
}
__END__


--
I'm a perl programer; if you need perl programing, hire me. 
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 30 May 1998 03:03:49 +0100
From: rjk@greenend.org.uk
Subject: Re: GNU attacks on the open software community
Message-Id: <wwvemxcecqi.fsf@sfere.greenend.org.uk>

fantome/@/usa/./net (le Fanttme) writes:

> The FSF use of 'free' is an accepted meaning of the word ... when
> applied to people. Not software.

So language evolves to fit new situations.  BFD.


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

Date: Thu, 04 Jun 1998 22:54:57 -0500
From: david.clark@snet.net
Subject: How do I test MacPerl CGI scrips using my local Browser.
Message-Id: <35776C0D.60EE@snet.net>

I have just started learning Perl and I have found the MacPerl to be a
great tool.  Im very much interested in CGI scripts but I want to test
them Using my Netscape or Explorer browsers to see them work.  How do I
set them up to do this?  When I try to call a script localy from HTML
doc with a post or other type of connection, I get a "Document has no
DATA" warning. I hope Im not just missing somthing very obvious

Thanks
Dave


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

Date: 5 Jun 1998 02:08:23 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Is it possible to post/read newsgroup articles using PERL script?
Message-Id: <6l7jun$4h@mozo.cc.purdue.edu>

"Leonid A.Arcadiev" <arcadiev@usa.net> writes:

}Can anybody advice me a PERL script which will post and read newsgroup
}articles?

}Please post a reply or mail it to arcadiev@usa.net

Oh man, are you asking for trouble.  Some dude just asked this
yesterday, and you shoulda seen the number we did on that guy, the
lazy bum.  Take a look in dejanews to see.  While you're there, yo
could probably find the answer to your question too.

But take it from me, you don't really want to be asking this without
trying to find the answer for yourself, no way.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Thu, 4 Jun 1998 23:34:12 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Is PERL case sensitive?
Message-Id: <1da4edy.1avfgd71xp62m8N@bay1-520.quincy.ziplink.net>

No, but perl is.

;-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 5 Jun 1998 00:00:22 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Is PERL case sensitive?
Message-Id: <61u7l6.k1h.ln@localhost>

Tom Christiansen (tchrist@mox.perl.com) wrote:
:  [courtesy cc of this posting sent to cited author via email]

: In comp.lang.perl.misc, 
:     sowmaster@juicepigs.com (Bob Trieger) writes:
: :If I just posted the word "yes", it may seem  inadequate. So why don't you fix 
: :your script so all of you $F(orm|ORM)s are the same and find out for yourself?

: Isn't it weird how people will post something to the net rather than
: implementing the most trivial of tests on their own?


I see those type of post here quite often, and have reflected a bit
on why the might be occuring.


My theory:

Being a thinking person, the new user figures they should probably
check out this foreign society (ie. Usenet) a little before
rushing in with their Question Of The Day.

So they read some of the articles posted periodically to the

    news.announce.newusers

newsgroup. 

Following one of the suggestions there, they read (ie. lurk) 
c.l.p.m for a few days to get the lay of the land.

During that time, they notice that a lot of Pretty Good Programmers
answer questions here, and seem to be rather, uh, enthused about
the Perl FAQs and other free documentation.

They would like to be able to contribute something (as well
as get their QOTD answered), but they just don't know enough
Perl to be able to answer questions yet.

So, when confronted with a question that would take 30 seconds
of editing to answer, they decide to donate 300 seconds (on
average) of *their* time to craft a posting instead.



Perhaps they figure that asking a question yet again is actually
helping to maintain the accuracy of the Perl documentation!

(by ensuring that the "F" part of "FAQ" still applies)



It is all quite commendable really...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 04 Jun 1998 22:03:55 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <3577520B.9B5485E5@negia.net>

Larry Rosler wrote:
> 

[SNIP]

> 
> #!/usr/local/bin/perl -w
> use Benchmark;
> 
> @a = (('x' x 100) x 1000, 'xxfoo' x 20);
> 
> timethese (1 << 11, {
>     'grep' => q{ @almost_empty = grep /foo/, @a },
>     'map'  => q{ @almost_empty = map { /foo/ ? $_ : () } @a },
> } );
> __END__
> Benchmark: timing 2048 iterations of grep, map...
>       grep: 24 secs (17.52 usr  0.09 sys = 17.61 cpu)
>        map: 38 secs (30.77 usr  0.14 sys = 30.91 cpu)
> 
> I have overwritten the code I was Benchmarking yesterday, and may have
> simply mislabeled the cases.  I would appreciate it if someone can
> confirm that this new result is correct.  In which case 'grep' is still
> the best way to solve this problem.

well, one thing to be wary of is that you compared 'grep EXPR, LIST'
with 'map BLOCK, LIST' instead of 'map EXPR, LIST'. something i've
been watching for a while now is how the EXPR forms tend to be 
faster (sometimes much faster).

use your same code with block and expression forms and see what you
get. here's what i get:

win32

Benchmark: timing 2048 iterations of grep_b, grep_e, map_b, map_e...
    grep_b: 31 secs (30.11 usr  0.00 sys = 30.11 cpu)
    grep_e:  5 secs ( 5.47 usr  0.00 sys =  5.47 cpu)
     map_b:  9 secs ( 8.57 usr  0.00 sys =  8.57 cpu)
     map_e:  5 secs ( 5.90 usr  0.00 sys =  5.90 cpu)

irix

Benchmark: timing 2048 iterations of grep_b, grep_e, map_b, map_e...
    grep_b: 23 secs (23.03 usr  0.02 sys = 23.05 cpu)
    grep_e:  8 secs ( 7.94 usr  0.01 sys =  7.95 cpu)
     map_b: 15 secs (15.11 usr  0.01 sys = 15.12 cpu)
     map_e:  9 secs ( 9.36 usr  0.00 sys =  9.36 cpu)

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 4 Jun 1998 22:23:09 -0400
From: "Craig T." <outrun@antispam.mediaone.net>
Subject: Perl/DBI/MS Access
Message-Id: <6l7kv7$2pp$1@ndnws01.ne.highway1.com>

Hi,

I've read through newsgroups, FAQ, etc. and haven't found an answer to my
question.

I'm writing a Perl script on NT that inserts and fetches rows from an Access
'97 database.  The table consists of two fields: id and field1.  The id
field is autonumber.  The field1 field is text.  I can insert rows using:
(my actual code is at work, so there may be minor mistakes)

$string = "silly text";
$inserth = $dbh->prepare("insert into table (field1) values (?)");
$inserth->execute($string);

I have AutoCommit set to 0, so I do the usual $dbh->commit and
$dbh->rollback when need be.

First off, is there a way (built into DBI) that will return me the
autonumber that was created?  I need it to add into other tables.

Since I don't know if that can be done, I'm using the following:

$getmax = $dbh->prepare("select max(id) from table");
$max_num = $getmax->execute();

Now, since multiple users are going to be using this, I want to know if
there is a way to "lock" the table during this process of inserting and
selecting so other's won't be able to read the table until I'm done.  If the
table isn't locked, there is a potential for two users to obtain the same
autonumber.

Thanks for any help!

-Craig
Remove antispam if replying via email





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

Date: Fri, 05 Jun 1998 02:04:18 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Problems with FORK/Sun-Solaris
Message-Id: <CmId1.369$14.2758498@news2.voicenet.com>

Diran A. <diran@NOSPAMearthlink.net> wrote:
>I've been having a problem running a FORK process on Sun/Solaris
>platforms.  We have a user base of about 300 people using one of our
>programs with no problems, but our Sun/Solaris users are just not able
>to use this process.

How do you know it's a problem with fork?  DO you have any error
messages from the script?

>sub mailing {
>
>$pid = fork();
>print "Content-type: text/html \n\n fork failed: $!" unless defined 
>
>$pid;
>if ($pid) {
>	#parent
>
>## Here we print a response page.  Nothing exciting.
>
>	exit(0);
>	}
>else {
>	#child
>
>	close (STDOUT);

Why are you closing STDOUT here?

>##### SEND OUT EMAILS HERE ############
>       
>#&passcheck;
>
>######### Here is where we did the addition ###################
>###############################################################
>
># First, tell the script where to find your email text file
>open (FILE,"$closing/email.txt"); #### Full path name from root.

You always need to check the return values from any system call.
The problem could be that this open failed.

># Now we read in the email text 
>@closing  = <FILE>;
>
># Now that's its been read, we can close the text file
> close(FILE);
>
>open (LIST,"<$memberinfo/address.txt");

You always need to check the return values from any system call.
The problem could be that this open failed.

> if ($LOCK_EX){ 
>      flock(LIST, $LOCK_EX); #Locks the file
>	}

I assume ($LOCK_EX == 2), if not what does it equal?  I also never see
you unlocking the filehandle.  Does that happen elsewhere in your
program?

> @database_array = <LIST>;
> close (LIST);
>
>foreach $lines(@database_array) {
>         chomp($lines);
>
>open (MAIL, "|$mailprog -t")
>	            || print "Can't start mail program";

You closed STDOUT earlier.  Where is this warning going if it happens?
And, if you can't open MAIL, your code will still try to print to it.
You might want to die() here instead of print.

>			print MAIL "To: $lines\n";
>		      print MAIL  "From: $list_mail\n";
>			print MAIL  "Subject: $INPUT{'mail_subject'}\n\n";
>				
>
>                        print MAIL "$INPUT{'message'}";  
>				  
>			# Now we tell the script to read each line from your email text file
># and paste it into your actual outgoing email.
>                        
>                        foreach $line(@closing) {
>                        print MAIL "$line";
>                        }
>
># All done
>                        print MAIL"\n\n";
>                        close (MAIL);
>
>
>}
>}
>}


-- 
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"


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

Date: Fri, 05 Jun 1998 03:00:26 GMT
From: gwynp_nospam@artware.qc.ca (Philip)
Subject: Re: Reading whole file into a scalar
Message-Id: <35775f22.5914554@nntp.dsuper.net>

On Mon, 01 Jun 1998 11:03:20 GMT, in comp.lang.perl.misc you wrote:
>my ($foo) = join($\, (<STDIN>)); 
*buzz* wrong
$foo=join '', <STDIN>; 
will sufice.  the $/ is retained.

>... works for me. (Not recommended, though -- at least, not without
>doing a stat() on the file we're reading in first, to make sure it 
>isn't a raw filesystem or /dev/zero or something ;-)
-:)

-Philip



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

Date: Thu, 4 Jun 1998 23:34:19 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: regexp: Validating UPC Codes
Message-Id: <1da4f6q.ru6qw41p170h2N@bay1-520.quincy.ziplink.net>

<ionFreeman@my-dejanews.com> wrote:

> This is where I stand now as a possible solution, but typing (\d) 11 times is
> extraordinarily inelegant.

if ($UPC =~ /^[067]\d{11}$/) {
  @digits = split //, $UPC;

  my $Check;
  my $C = 1;
  my $i;
  for ($i=0; $i<$#digits; ++$i) {
    $C ^= 2;                       # alternate between 3 and 1
    $Check += $digits[$i] * $C;
  }

  $Check = 10 - $Check % 10;
  unless ($digits[11] == chop $Check) {
    die "$UPC has an invalid check digit\n";
  }

} else{
  die "$UPC is not a 12-digit string starting with 0, 6, or 7\n";
}
print "Valid UPC\!\n";

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 4 Jun 1998 23:05:02 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: regexp: Validating UPC Codes
Message-Id: <epq7l6.hpg.ln@localhost>

ionFreeman@my-dejanews.com wrote:
: This is where I stand now as a possible solution, but typing (\d) 11 times is
: extraordinarily inelegant.


Then, by all means, don't do it that way  ;-)


   /\d{11}/;   # match 11 digit characters


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 05 Jun 1998 03:53:16 GMT
From: chuaby@hotmail.com (Chua Boon Yiang)
Subject: Server Redirection
Message-Id: <35776af4.12636688@news.cyberway.com.sg>

Hi 
I have the follow code : 
My objective is to delete all items in my shopping cart stored in the
cookie then show the first page on my shopping mall. But the
redirection doesn't work if the print "Set-Cookie: $_;
expires=$expires; path=$cookie_path;\n"; is there.

May i know how can i resolve the problem ?

Thanks alot.
Boon Yiang
---------------------------------------------------------------------------------------------
if ($ENV{'HTTP_COOKIE'}) {	
	@cookies = split(/; /,$ENV{'HTTP_COOKIE'});
	foreach (@cookies) {
	 print "Set-Cookie: $_;
expires=$expires;path=$cookie_path;\n";
	      }
     
	}
	print "Location: 	 
              http://10.21.30.31/cgi-bin/sms/sms_catalog.pl\n\n"; 
              exit;



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

Date: Thu, 04 Jun 1998 21:47:08 -0700
From: "John C. Quillan" <quillan@doitnow.com>
Subject: Re: Sourcing Unix environment file?
Message-Id: <3577784C.792517F@doitnow.com>

Silvio Picano wrote:
> 
> Thuy Nguyen wrote:
> >
> > Hi,
> >
> > I am trying to source in a Unix environment file from a perl script, but
> > was unable to do so.
> >
> > Here is the problem:
> >
> > at the Unix prompt, one can type
> >
> > $ . /
> >
> > and it would read the DBSEnv file and set the appropriate environment
> > parameters.
> >
> > I have tried using the system and exec commands, but none of it works.
> > e.g
> >
> > $cmd = ". /etc/navenv.d/DBSEnv";
> > system ($cmd);
> >
> > I have tried to overwrite the special metacharater "." by preceding the
> > "." with the "\", and it still did not work.
> >
> > Have anyone run into this problem before?  And if you have, how would
> > you resolve it? Any suggestions will be appreciated.  Thank you.
> >
> > Regards,
> >
> > Thuy
> 
do the following.

require "dotsh.pl"; 



$ENV{SHELL} = "/bin/sh"; # or what ever shell you are using.

&dotsh("/etc/navenv.d/DBSEnv");


Hope this helps.

John C. Quillan

> Silvio


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

Date: 5 Jun 1998 02:17:26 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Spider programms in PERL
Message-Id: <6l7kfm$bd@mozo.cc.purdue.edu>

"Leonid A.Arcadiev" <arcadiev@usa.net> writes:

}Can anybody advice how to write a spider in perl, that would check on a
}website and read through its contents.  If the responce has been received,
}everything is fine, if no responce, generate an error message.
}	Please post a reply or send it to arcadiev@usa.net

Oh man, first the newsgroup question, now this.  If you could only see
the damage done to the last 100 people who asked this, you would just
FREAK.  No joke.  We are harsh.

It would probably be a good idea to check www.dejanews.com, or
www.perl.com, or the CPAN part of perl.com, or anything instead of
trying to ask us this question.  

P.S.  If you are trying to build a web/newsgroup e-mail harvester, which
is sometimes why people ask these questions, be aware the only faster
way to hell is to shot the pope.  God hates spammers. 


-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 5 Jun 1998 02:34:22 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Spider programms in PERL
Message-Id: <6l7lfe$4nu$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Leonid A.Arcadiev" <arcadiev@usa.net> writes:
:Can anybody advice how to write a spider in perl, that would check on a
:website and read through its contents.  If the responce has been received,
:everything is fine, if no responce, generate an error message.

Your best hope is that someone will be happy to let you hire them as a
consultant at about $150/hour or better to spend the severely nontrivial
amount time it would take to teach you all this, since your current
posting on spidering and your other one about autoposting to USENET do
not exactly inspire us to complete confidence in your ability to grasp
what we mean when we politely but succinctly suggest that you consult
the libnet and the LWP module suites on CPAN--which is likely the most
information you're liable to get, and in fact, just have.

--tom
-- 
    "It's okay to be wrong temporarily." --Larry Wall


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

Date: Thu, 4 Jun 1998 23:34:15 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Use of HTML, POD, etc in Usenet (was: Re: map in void context regarded as evil - suggestion)
Message-Id: <1da4ehp.vnxtf71bhi9pyN@bay1-520.quincy.ziplink.net>

Zenin <zenin@bawdycaste.org> wrote:

>   If you're using a format other then text/plain, by RFC 1036 it must
>   be declared as such.  Therefor, the reader would try to run whatever
>   it had mapped to handle type text/x-pod, if it had such a tool
>   available.

I guess that means posting perl code would be prohibited in the
moderated newsgroup, too.  Unless we want to allow text/perl postings,
of course.

Is B<this> any less plain text than _this_ or *this*?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Fri, 05 Jun 1998 04:16:43 GMT
From: gdeering(NO#!%&SPAM)csu.edu.au (Geoff Deering)
Subject: Web Error Log Analysis
Message-Id: <3579711c.1047696608@newsagent.csu.edu.au>

Web Error Log Analysis

There are plenty of utilities (and Perl scripts) to analyse standard
web logs, but because error logs are in a different format, the ones I
have tried cannot handle them.  Does anyone have any perl scripts or
utilities for this purpose  (using Apache Servers)?


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

Date: 5 Jun 1998 02:00:40 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <897012037.890112@cabal>

In <3576f315.106536561@news.mindspring.com> glengk@mindspring.com (Glen Koundry) writes:

>Am I missing something or does Perl lack the ability to check if
>something is part of a list,  something like this:

>@l1=("ab","abc","bc");

>if("ab" in @l1) {
>     print "found ab\n";
>}


>Is there some other language construct which serves this purpose?

grep

>(grep doesn't seem to be a good choice since the "ab" in the above
>example would match "abc" as well).

Your just not using it right.

if (grep /^ab$/,@l1) {
    print "Found ab\n";
}

Anougher alternative is doing something like this.

%l1=map {($_,1)} @l1;

if ($l1{ab}) {
  print "Found ab\n";
}

There may be other ways.


--
I'm a perl programer; if you need perl programing, hire me. 
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

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

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