[16401] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3813 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 26 18:15:38 2000

Date: Wed, 26 Jul 2000 15:15:26 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964649726-v9-i3813@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 26 Jul 2000     Volume: 9 Number: 3813

Today's topics:
        Simple Newbie Question <mouimet@direct.ca>
    Re: Simple Newbie Question <lauren_smith13@hotmail.com>
    Re: Simple Newbie Question (Craig Berry)
    Re: Simple Newbie Question <sumus@aut.dk>
    Re: Some security questions? <gellyfish@gellyfish.com>
    Re: Some security questions? jdimov@cis.clarion.edu
        Split Help mwhaley@my-deja.com
    Re: Split Help <uri@sysarch.com>
    Re: SSI <lauren_smith13@hotmail.com>
    Re: SSI <user@domain.com>
        strict and subroutine variables <pdmos23@geocities.com>
    Re: This is driving me crazy!! ivolla@my-deja.com
    Re: thread support <dan@tuatha.sidhe.org>
    Re: Was Why won't  "use strict;"  work? <lr@hpl.hp.com>
    Re: When to use for and foreach? (Tim)
        WHOIS not standart query HELP!!! ilbot@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Jul 2000 19:38:06 GMT
From: "Marcus Ouimet" <mouimet@direct.ca>
Subject: Simple Newbie Question
Message-Id: <y6Hf5.70029$8u4.713601@news1.rdc1.bc.home.com>

I am trying to use my script to automatically go to a url depending on a
variable. Is there a way to use something like:

$in{URl} .= "whatever.com"

A long shot but maybe someone can point me in the right direction.




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

Date: Wed, 26 Jul 2000 12:49:48 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Simple Newbie Question
Message-Id: <8lnfb4$7i4$1@brokaw.wa.com>


Marcus Ouimet <mouimet@direct.ca> wrote in message
news:y6Hf5.70029$8u4.713601@news1.rdc1.bc.home.com...
> I am trying to use my script to automatically go to a url depending on a
> variable. Is there a way to use something like:
>
> $in{URl} .= "whatever.com"
>
> A long shot but maybe someone can point me in the right direction.

The above code doesn't do very much (well, it appends "whatever.com" to
$in{URI}, but nothing fancy).

You may want to take a look at the LWP modules.

Lauren





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

Date: Wed, 26 Jul 2000 20:29:24 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Simple Newbie Question
Message-Id: <snuih46q3j1160@corp.supernews.com>

Marcus Ouimet (mouimet@direct.ca) wrote:
: I am trying to use my script to automatically go to a url depending on a
: variable. Is there a way to use something like:
: 
: $in{URl} .= "whatever.com"
: 
: A long shot but maybe someone can point me in the right direction.

Not entirely clear what you're trying to do.  If you mean you want to
fetch the contents found at a URL into a variable, then the LWP::Simple
module should be a winner for you.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: 26 Jul 2000 22:42:26 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Simple Newbie Question
Message-Id: <og3k7he5.fsf@macforce.sumus.dk>

"Marcus Ouimet" <mouimet@direct.ca> writes:

> point me in the right direction.

That would be comp.infosystems.www.authoring.cgi, I think.

HTH

-- 
Jakob


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

Date: 26 Jul 2000 09:39:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Some security questions?
Message-Id: <8lm84b$11m$1@orpheus.gellyfish.com>

On Sat, 22 Jul 2000 21:22:16 -0400 Drew Simonis wrote:
> Pasquale wrote:
>> 
>> I've just finished some of my first scripts and added the -T switch to
>> the #! line. I would like to make them as secure as I can.  I've
>> untainted what taint was having a problem with, through reg.
>> expression.  Some of my questions I have are:
>> 
>> 1. Is taint mode being happy with the script enough?
> 
> No.  Taint mode is a reminder to the programmer.  You can do silly
> things with regular expressions and taint will be pleased.  Examples 
> I've seen include matching (.*) and replacing the value with $1.

There are times when you need to do this where your input data is such
that a regex wont cut it - you just have to be more careful when you
use the values of the variables you have treated this way.   There are
also times when the tainting mechanism is being too picky over certain
variables and you really just want to shut it up.  Sensible comments
in the code are probably a good idea if the program might be maintained
by someone else ...

> You didn't change the string, but taint is happy.  I've also read that
> taint doesn't consider input from CGI.pm's param() function tainted,
> but I've not tested that.

I think it does from memory but I cant be arsed to test it out right now.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Wed, 26 Jul 2000 20:35:42 GMT
From: jdimov@cis.clarion.edu
Subject: Re: Some security questions?
Message-Id: <8lni2u$5ie$1@nnrp1.deja.com>

In article <slrn8nkmm6.48s.tadmc@magna.metronet.com>,
  tadmc@metronet.com (Tad McClellan) wrote:
>
> If you are concerned with security, it is probably easier
> to avoid magic open() (use sysopen() instead) than to
> remember how to use it safely.
>

Taint mode doesn't complain about sysopen() with a tainted filename
though.  Along the same line...  taint mode is cool with something like
open (FH, "<$filename"); , and a couple of other things.




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 26 Jul 2000 21:30:10 GMT
From: mwhaley@my-deja.com
Subject: Split Help
Message-Id: <8lnl92$88e$1@nnrp1.deja.com>

I'm trying to split a scalar read in from a file into parts based on a
\r (Carriage Return) located within the input line.

For some reason it seems like split isn't able to handle this.  It
returns the whole string with the \r's stripped out in the array
position [0].

Code:
open INFILE, "ad046922.001";
open OUTFILE, ">ad046922.out";

while (<INFILE>) {
	chop;
	@fields = split /\r/;
	printf OUTFILE "%s\n", $fields[0];
}

close INFILE;
close OUTFILE;

Any suggestions or can this even be done?

TIA
Morgan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 26 Jul 2000 21:53:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Split Help
Message-Id: <x7k8e87e2x.fsf@home.sysarch.com>

>>>>> "m" == mwhaley  <mwhaley@my-deja.com> writes:

  m> I'm trying to split a scalar read in from a file into parts based on a
  m> \r (Carriage Return) located within the input line.

and this is running on what platform? \r (or \015 for nit pickers) is
the line separator for mac files. and it will be in the cr/lf of
winblows files as well. it is a poor choice for a field separator.

  m> For some reason it seems like split isn't able to handle this.  It
  m> returns the whole string with the \r's stripped out in the array
  m> position [0].

where is some sample input data? make sure it is cut and pasted
cleanly.

  m> open INFILE, "ad046922.001";
  m> open OUTFILE, ">ad046922.out";

always check the return of open calls.


  m> while (<INFILE>) {

depending on $/ that could be eating the \r.

  m> 	chop;

chomp is better.

  m> 	@fields = split /\r/;
  m> 	printf OUTFILE "%s\n", $fields[0];

why the printf? just print "$fields[0]\n" ;

a better test is to print all the fields with a very visible separator:

	print OUTFILE "Record\n", map "[$_]\n", @fields ;

then you can see exactly what was split (or not).

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 26 Jul 2000 11:51:25 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: SSI
Message-Id: <8lnbtc$5ui$1@brokaw.wa.com>


Aaron Andersen <kc7gza@yahoo.com> wrote in message
news:397EF6BC.BA0AFECA@domain.com...
>
> On my web site my pages use SSIs to pull in some information.  However,
> my search cgi generates its own output, so even if I put SSIs in that
> output they are never processed.
>
> I need to figure out how to put the equivlent of a #include SSI and a
> #exec SSI in a perl script.  If I could have the file from the #include
> and the output from the #exec end up two variables (e.g., $include and
> $exec) that would be perfect.
>

Head over to CPAN and do a search for 'SSI'.

www.cpan.org

You're bound to end up with something.

Lauren





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

Date: Wed, 26 Jul 2000 14:37:51 -0600
From: Aaron Andersen <user@domain.com>
Subject: Re: SSI
Message-Id: <397F4C1F.D1FEE9D6@domain.com>

Lauren Smith wrote:

> Aaron Andersen <kc7gza@yahoo.com> wrote in message
> news:397EF6BC.BA0AFECA@domain.com...
> >
> > On my web site my pages use SSIs to pull in some information.  However,
> > my search cgi generates its own output, so even if I put SSIs in that
> > output they are never processed.
> >
> > I need to figure out how to put the equivlent of a #include SSI and a
> > #exec SSI in a perl script.  If I could have the file from the #include
> > and the output from the #exec end up two variables (e.g., $include and
> > $exec) that would be perfect.
> >
>
> Head over to CPAN and do a search for 'SSI'.
>
> www.cpan.org
>
> You're bound to end up with something.
>
> Lauren

I found something that I think should work at
http://search.cpan.org/search?dist=CGI-SSI but I have no idea what to do
now.  Can anybody tell me how to set it up?

Aaron




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

Date: Wed, 26 Jul 2000 18:20:52 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: strict and subroutine variables
Message-Id: <397F2DCC.3AA8339E@geocities.com>

I have some code(below) in a subroutine, that assigns a number.  I need
that number/variable to be passed to another subroutine further down for
use.  I read strict, subroutine & variable articles, but they don't seem
to have what I'm asking (or I don't see it).  The closest I've come,
with the code below, is the number is incremented by 2, i.e.: 2, 4, 6,
etc.,  not by one.  Why?  However, the number is displayed.
I was finished my scripts, but after reading what some of you had to say
about "use strict" and how it is an important part of a script, I added
it in.
If there are any suggestions or articles I can read, please advise.
Thanks,
Pasquale
code:
sub Number {
my $num;
open(CNT, "count.log") || &CantOpen("Cannot read conuter log.");
flock(CNT, 2);
$num = <CNT>;
flock(CNT, 8);
close(CNT);
if ($num <= 99) {
$num++;
} else {
$num = 1;
}
open(CNT, "> count.log") || &CantOpen("Cannot write to counter log.");
flock(CNT, 2);
print CNT $num;
flock(CNT, 8);
close(CNT);
return $num;   #without this I get nothing & with this the $num
increments by 2
}

sub Form {
my $num = Number;
my $pic = $num . "pic.gif";
open(FORM, "> blah/blah/form.htm") || &CantOpen("Cannot open form.");
flock(FORM, 2);
print FORM <<HTMLform;
<html>
<head>
<title></title>
</head>
<body bgcolor="#FFFFFF">
<form method="POST" action="/blah/blah/thescript.pl">
  <input type="text" size="3" value="$num" name="numform" >




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

Date: Wed, 26 Jul 2000 20:18:46 GMT
From: ivolla@my-deja.com
Subject: Re: This is driving me crazy!!
Message-Id: <8lnh30$4lh$1@nnrp1.deja.com>

Thank You everyone for your help!!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 26 Jul 2000 20:59:17 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: thread support
Message-Id: <FiIf5.6991$f_5.29300@news1.rdc1.ct.home.com>

Bobby de Vos <bobby@devos.org> wrote:

> So, anyone have any experience with how well threads work in Perl,
> either 5.6.0 or 5.005? Is one of these versions prefered over the
> other, wrt thread support and stability? I rather not do this project
> in C, using pthreads.

They work pretty well, though there are some gotchas that can bite. Use
perl 5.6.0 and, when it comes out, upgrade to 5.6.1.

					Dan


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

Date: Wed, 26 Jul 2000 11:53:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Was Why won't  "use strict;"  work?
Message-Id: <MPG.13e8d3a1d4149ced98abec@nntp.hpl.hp.com>

In article <22696-397F163D-18@storefull-248.iap.bryant.webtv.net> on 
Wed, 26 Jul 2000 11:47:57 -0500 (CDT), BUCK NAKED1 <dennis100@webtv.net> 
says...
> I sent a lengthy post from my whataman@home.com addy with 5 questions,
> and I don't see the post. Did I do the unthinkable, and accidentally
> email it to one of you? Hard to tell, my isp @home really has problems
> with their mail servers being out alot.

Your questions were posted, but were difficult to read, so people 
responded to the form, not the content.  I tried to reply to the 
questions, but got bogged down in the mess.

As you have five questions, I would suggest you separate them out into 
one question per post, formatted in plain text and with descriptive 
ubjects.  You are far more likely to receive answers that way.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 26 Jul 2000 20:37:02 GMT
From: SPAM+indigo@dimensional.com (Tim)
Subject: Re: When to use for and foreach?
Message-Id: <8F7D9BB3Findigodimcom@166.93.207.145>

cberry@cinenet.net (Craig Berry) wrote in 
<snu8atp3j128@corp.supernews.com>:

>Steven May (stevenjm@telisphere.com) wrote:
>: Abigail wrote:
>: > 'for' is more than twice as fast [1] as 'foreach'.
>: > 
>: > [1] to type
>: 
>: Ahhh... when????... 
>: I always thought they were pretty close to the same, given
>: the same basic operation.  This one got me going a bit, so
>: I ran some benchmarks on it...
>
>Um, dude?  She was *joking*.  Read her footnote again.  'for' and
>'foreach' are literally synonyms, which compile into utterly identical
>code.  The presence of both in the language is pure syntactic sugar, like
>the y/tr thing.

That's not exactly true.  Back in the bad old days, for and foreach 
behaved differently.  for was used with C-style indexed loops, where 
foreach worked like Bourne shell list traversals.  perlsyn explains
the difference in detail.  

There was some confusion over the two, and eventually they were merged.
So the presence of both is more of a historically artifact, where y/tr 
was syntactic sugar to give sed people a warm fuzzy.

-T



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

Date: Wed, 26 Jul 2000 19:41:36 GMT
From: ilbot@my-deja.com
Subject: WHOIS not standart query HELP!!!
Message-Id: <8lnetf$31o$1@nnrp1.deja.com>

is there any way to get the list of the Domain Names wich were
registred by some Persons?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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


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