[12448] in Perl-Users-Digest
Perl-Users Digest, Issue: 6048 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 18 16:07:19 1999
Date: Fri, 18 Jun 99 13:00:17 -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 Fri, 18 Jun 1999 Volume: 8 Number: 6048
Today's topics:
Re: Afraid to ask about Y2K! (Jerome O'Neil)
Re: Afraid to ask about Y2K! (Paul David Fardy)
Re: Afraid to ask about Y2K! (Markus Gyger)
Re: array problem <cbarnett@idirect.com>
Re: array problem (Brian Pontz)
Embedding perl w/Debugger <dcorbin@corvusware.com>
Re: Having trouble making this work... (Eric Bohlman)
Re: Having trouble making this work... <portboy@home.com>
Re: Losing referrer information when passing through a <martin@adoma.se>
Re: matinal musings and the madrugada (Eric Bohlman)
Re: matinal musings and the madrugada (Bart Lateur)
Re: multidimensional arrays with functions push and pop <aqumsieh@matrox.com>
Re: odd autoincrement behavior ? (M.J.T. Guy)
Re: Pattern Matching Question <mamster@mamster.net>
Re: Printing compound variables (?) <cassell@mail.cor.epa.gov>
Random Index?.... jennifer01@vei.net
Re: script to lookup phone number off website? <cassell@mail.cor.epa.gov>
Re: Using ^M within backquotes possible? <cbarnett@idirect.com>
Re: Using ^M within backquotes possible? (Alan Curry)
Re: VERY SIMPLE QUESTION. <upsetter@ziplink.net>
Re: VERY SIMPLE QUESTION. (Greg Bacon)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Jun 1999 17:05:55 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7kdu9j$o8q$1@brokaw.wa.com>
In article <376A67CF.DC414B9A@mail.uca.edu>,
Cameron Dorey <camerond@mail.uca.edu> writes:
>> She is a he.
>>
>> Strange but true...
>
> If you're listening, my apologies, Abigail.
Oh man! I was working on a serious Abigail fetish, too.
Now I'm *realy* confused...
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 18 Jun 1999 19:18:46 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7ke62m$s36$1@coranto.ucs.mun.ca>
(I think) Jocelyn Amon writes:
> Many software developers hold the belief that because a programming
> language is year 2000-compliant, then all software written in that
> language will also be free of Y2K issues.
Many Y2K alarmists hold the belief that because a programmer says
"It's a poor craftsman who blames his tools.", he must believe
that "All crafts made with good tools are flawless."
In article <7kbp4i$v46$1@nnrp1.deja.com>, finsol@ts.co.nz wrote:
>> The Y2K problem in Perl code goes beyond just the localtime booby
>> trap. The localtime issue is just the most obvious but even so
>> few Perl coders on this site acknowledge it as being a problem
>> their reasoning being that the manual states quite clearly how
>> localtime should be used.
pudge@pobox.com (Chris Nandor) writes:
> Yeah. Go figure. Rely on documentation? Never! Caveat scriptor.
> ...
> You are blaming the language, which is nonsense. That's like blaming
> English because people can incite riots using it.
Yet, wouldn't there be fewer Y2K problems in C and Perl programs
if localtime() returned the full four digit year?
I don't blame the language; I blame the author(s) of the C lib
localtime(), the ANSI C standards committee, and/or Larry. :-)
Paul Fardy
--
Paul David Fardy | pdf@morgan.ucs.mun.ca
Computing and Communications | pdf@InfoNET.st-johns.nf.ca
Memorial University of Newfoundland |
St. John's, NF A1C 5S7 |
------------------------------
Date: 18 Jun 1999 19:21:09 GMT
From: mgyger@ite.gmu.edu (Markus Gyger)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7ke675$tsd@portal.gmu.edu>
In <3766e8a3@cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
>You can't have 24:00 -- that's out of the valid range. Hours are
>guaranteed less than 24. After 11:59:59pm comes 12:00:00midnight.
Maybe in the US or in Perl. But it is common in Europe (e.g. TV
schedules) and also valid according to ISO 8601:
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
Markus
------------------------------
Date: Fri, 18 Jun 1999 15:08:47 -0400
From: "Carey Barnett" <cbarnett@idirect.com>
Subject: Re: array problem
Message-Id: <376a9945$1@diana.idirect.com>
This seems to be the offending line:
$req=newHTTP::Request'GET'=>"http://www\@servers$_domain.com/";
I think you want:
$req=newHTTP::Request'GET'=>"http://www.$_.domain.com/";
>>> CUT HERE <<<
> @servers=(1..4,6..9);
> use LWP::UserAgent;
> foreach (@servers) {
> $ua = new LWP::UserAgent;
> $ua->agent("$0/0.1 " . $ua->agent);
> $req=newHTTP::Request'GET'=>"http://www\@servers$_domain.com/";
> $req->header('Accept' => 'text/html');
>
------------------------------
Date: Fri, 18 Jun 1999 20:07:46 GMT
From: pontz@channel1.com (Brian Pontz)
Subject: Re: array problem
Message-Id: <376aa6bd.639440@news2.channel1.com>
Thanks you were right.
$req = new HTTP::Request 'GET' => "http://www$_.domain.com";
Brian Pontz
On Fri, 18 Jun 1999 15:08:47 -0400, "Carey Barnett"
<cbarnett@idirect.com> wrote:
>This seems to be the offending line:
> $req=newHTTP::Request'GET'=>"http://www\@servers$_domain.com/";
>
>I think you want:
> $req=newHTTP::Request'GET'=>"http://www.$_.domain.com/";
>
>>>> CUT HERE <<<
>> @servers=(1..4,6..9);
>> use LWP::UserAgent;
>> foreach (@servers) {
>> $ua = new LWP::UserAgent;
>> $ua->agent("$0/0.1 " . $ua->agent);
>> $req=newHTTP::Request'GET'=>"http://www\@servers$_domain.com/";
>> $req->header('Accept' => 'text/html');
>>
>
>
>
>
------------------------------
Date: Fri, 18 Jun 1999 15:22:04 -0400
From: David Corbin <dcorbin@corvusware.com>
Subject: Embedding perl w/Debugger
Message-Id: <376A9C5C.645726E@corvusware.com>
I'm developing a tool that embeds perl. I've figured out the
required behavior with -DEMBDED and "perl_destruct_level" to
allow me to invoke multiple sequential perl instances.
No Problem.
However, I've found that if the first perl invocation does NOT
include the debugger (-d), then subsequent invocations cannot.
It appears to only compile the appropriate perl (debugger) code
on the first invocation.
Now, I can work around this, but always invoking the debugger on
the first instance, and modifying the debugger, but I don't want
to have to do that. It's not elegant.
Can anyone offer me any advice on how/where to correct this
problem? Is it a perl bug, or a problem in the way I'm embedding
it?
--
David Corbin
Corvusware, Inc.
dcorbin@corvusware.com
------------------------------
Date: Fri, 18 Jun 1999 19:29:07 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Having trouble making this work...
Message-Id: <ebohlmanFDJFGJ.E57@netcom.com>
Mitch (portboy@home.com) wrote:
: Okay, I've changed it to:
:
: sub read_config
: {
: my $cfg = shift;
: open(CFG, $cfg) or die "damn't $!";
: while(<CFG>) {
: chomp;
Some indentation would be nice here.
: s/#.*//;
: s/^\s+//;
: s/\s+$//;
: next unless length;
: my ($var, $value) = split ' ', $_, 2;
: $config{$var} = $value;
: #$$var = $value;
OK up to this point
: if (/^==(.*)/) {
: my $dir = $1;
: ($name, $path) = fileparse($dir);
You didn't supply the code for fileparse. One of your problems might be
there.
: print "name is $name, path is $path\n";
: unless (-d $dir) {
: mkdir $dir, 0777 or die "could not create '$dir' $!";
: }
: open FILE, ">$path/$name" or die "Can't open $path $!";
: } elsif (/^\--END$/) {
: close FILE;
: } else {
: print FILE "$_\n";
: }
It looks to me like you want to treat lines in between --BEGIN and --END
differently from the rest of your lines; I'm guessing that you want to
copy them into a file, but *not* transform them and *not* parse them for
config values. Your code isn't doing that.
What you really want to do when you see a filename command line is to go
into a nested loop that does nothing but copy lines over until it sees --END.
Note that your current code copies the --BEGIN line into the file, but
not the --END line. This seems inconsistent; you probably want to copy
both or neither.
: }
: close(CFG);
: return;
: }
: Lastly, how can I setup the "slurp" of config so that it can handle
multiple
: lines starting with the same variable, but ending with a different value.
: i.e. if my config was:
:
: coke enable
: pepsi disable
: mountdew is okay
: coke sucks
:
: I wouldn't have in $config{coke} returning sucks. I need someway of having
: both enable and sucks for coke...????? How can I do this?
You need to set up an appropriate data structure. Maybe a hash of
arrays, or maybe just a hash of comma-separated values. What structure
is appropriate will depend on what you're planning to do with the data
after you've gathered it.
------------------------------
Date: Fri, 18 Jun 1999 19:56:24 GMT
From: Mitch <portboy@home.com>
Subject: Re: Having trouble making this work...
Message-Id: <376A3487.EB8A329A@home.com>
Eric Bohlman wrote:
> Mitch (portboy@home.com) wrote:
> : Okay, I've changed it to:
> :
> : sub read_config
> : {
> : my $cfg = shift;
> : open(CFG, $cfg) or die "damn't $!";
> : while(<CFG>) {
> : chomp;
>
> Some indentation would be nice here.
Sorry...
>
>
> : s/#.*//;
> : s/^\s+//;
> : s/\s+$//;
> : next unless length;
> : my ($var, $value) = split ' ', $_, 2;
> : $config{$var} = $value;
> : #$$var = $value;
>
> OK up to this point
>
> : if (/^==(.*)/) {
> : my $dir = $1;
> : ($name, $path) = fileparse($dir);
>
> You didn't supply the code for fileparse. One of your problems might be
> there.
>
I should have pasted in the portion use File::Basename;
>
> : print "name is $name, path is $path\n";
> : unless (-d $dir) {
> : mkdir $dir, 0777 or die "could not create '$dir' $!";
> : }
> : open FILE, ">$path/$name" or die "Can't open $path $!";
> : } elsif (/^\--END$/) {
> : close FILE;
> : } else {
> : print FILE "$_\n";
> : }
>
> It looks to me like you want to treat lines in between --BEGIN and --END
> differently from the rest of your lines; I'm guessing that you want to
> copy them into a file, but *not* transform them and *not* parse them for
> config values. Your code isn't doing that.
>
> What you really want to do when you see a filename command line is to go
> into a nested loop that does nothing but copy lines over until it sees --END.
>
> Note that your current code copies the --BEGIN line into the file, but
> not the --END line. This seems inconsistent; you probably want to copy
> both or neither.
>
Yes you are right, I want to copy everything (including) --BEGIN and through
(including) --END. I have been tinkering with my code and here's a snippet of what
i tried. it doesn't seem to be working. I kow this is broken, however, your
comments are welcome. ^shrug^ I'm trying :(
sub read_config
{
my $cfg = shift;
open(CFG, $cfg) or die "damn't $!";
while(<CFG>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
my ($var, $value) = split ' ', $_, 2;
$config{$var} = $value;
#$$var = $value;
if (/^==(.*)/) {
my $dir = $1;
($name, $path) = fileparse($dir);
print "name is $name, path is $path\n";
unless (-d $dir) {
mkdir $dir, 0777 or die "could not create '$dir' $!";
}
open FILE, ">$path/$name" or die "Can't open $path $!";
while !(/^\--END$/) { <- I know this is broker, but how do you
"not" an expression like this?
print FILE, $_;
}
}
#} elsif (/^\--END$/) {
#close FILE;
#} else {
#print FILE "$_\n";
#}
#}
close(CFG);
return;
}
>
> : }
> : close(CFG);
> : return;
> : }
> : Lastly, how can I setup the "slurp" of config so that it can handle
> multiple
> : lines starting with the same variable, but ending with a different value.
> : i.e. if my config was:
> :
> : coke enable
> : pepsi disable
> : mountdew is okay
> : coke sucks
> :
> : I wouldn't have in $config{coke} returning sucks. I need someway of having
> : both enable and sucks for coke...????? How can I do this?
>
> You need to set up an appropriate data structure. Maybe a hash of
> arrays, or maybe just a hash of comma-separated values. What structure
> is appropriate will depend on what you're planning to do with the data
> after you've gathered it.
What's the plan with the data....hmmmm..... okay, when the multiple lines like
coke enable
coke sucks
are read into the script, they will only be used to see if they exist (meaning if a
user inputted coke sucks...error coke sucks exists) or to remove them from the
config file. Also, when the script is running the user might be able to input :
coke rules. This information (on a "save") needs to be written to the config... so
you have:
coke enable
coke sucks
coke rules
So, since I don't know how to implement this type of data structure - any help?
Thanks again,
.mitch
------------------------------
Date: Fri, 18 Jun 1999 21:05:26 +0100
From: "Martin Quensel" <martin@adoma.se>
Subject: Re: Losing referrer information when passing through a perl script...?
Message-Id: <7ke6fc$rrl$1@zingo.tninet.se>
Euro Jake skrev i meddelandet <7kdnql$894$1@news3.Belgium.EU.net>...
>
>> give you a hand on what?
>> All i can say to you is:
>> It seems like it doesent work the way you want it to work.
>> Maybee you are overlooking a detail, maybee not.
>>
>> Now, that dident help you much im afraid.
>>
>> maybee this will help
>> http://www.plover.com/~mjd/perl/Questions.html
>>
>>
>> Best regards
>> Martin Quensel
>
>I assume the reference you supplied in your answer is an accidental
>mistake..., it didnt mention anything related to my problem...
In a way it does! it maybee explains the problem we in this newsgroup face
sometimes when we are trying to help people out.
I myself, dident stumble on this webpage, it was someone who tried to help
me out, that gave it to me.
If you think for a while, and read through that page again, ...It handles
why questions go unansvered..I in fackt botherd to ansver your question,
cause in a way i was intrested in the problem you had, but unfortunatley
couldent help at all.
>If it is not, I think you will create many friends this way...
>Thougt this medium is a way to find information and assistance, apologies
if
>I am wrong
>Nevertheless, thank you for your contribution and your help
Im sorry, but as the question dident supply the information needed to solve
your problem, i cant help you.
I think it will be very hard for anyone to help you solv your problem,
unless you give us something to look at.
Right now, the problem you have could really be anything.
It could be that you dont have perl installed on you system, or a million
other things.
Or even that you dont have javascript turned on in your browser.
I dont think its something simple as that..im not saying it is.
Im just trying to explain how little i have to go on, when a question is
that way.
I could try to mention, everything that could be wrong with your script.
But since it could be millions of things, i dont have the time to write it
down. And you dont have time to download a 10 megabyte textfile.
Post some code where you think its going wrong, explain the problem a little
better.
Then sit down and relax as people like me will try to help you with you
problem.
cheers!
Martin Quensel
------------------------------
Date: Fri, 18 Jun 1999 19:15:45 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: matinal musings and the madrugada
Message-Id: <ebohlmanFDJEu9.Cx0@netcom.com>
Abigail (abigail@delanet.com) wrote:
: Bart Lateur (bart.lateur@skynet.be) wrote on MMCXVII September MCMXCIII
: in <URL:news:376b29cf.2678417@news.skynet.be>:
: [] David Cantrell wrote:
: []
: [] >>the Marine Corps always dated their documents YY/MM/DD
: []
: [] >Makes it nice n' easy to sort by date in a language which doesn't
: [] >support a Date type (see - back on topic!) which is a Good Thing.
: []
: [] But yet it is a Y2K bug.
:
:
: Only if you keep documents for longer than 100 years.
:
: Not all uses of 2 digit years are Y2K bugs.
If you keep the documents across a numerical century boundary, you lose a
lot of the sortability (days and months within a year retain their order,
but the years get scrambled). Since the sortability was the primary
reason for using that format rather than a more common one, there seems
little to gain by using such a format. It reminds me of Netscape's
frames model; it gives the appearance of solving a real problem without
actually doing so.
------------------------------
Date: Fri, 18 Jun 1999 19:43:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: matinal musings and the madrugada
Message-Id: <376c9be4.7774139@news.skynet.be>
Abigail wrote:
>[] But yet it is a Y2K bug.
>
>
>Only if you keep documents for longer than 100 years.
>
>Not all uses of 2 digit years are Y2K bugs.
If you want to SORT the files according to date, using string sort, the
documents stamped as dating jan 1 2000 and later, would come after the
documents dating 1999 and before. I call that a Y2K bug.
Bart.
------------------------------
Date: Fri, 18 Jun 1999 14:54:50 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: multidimensional arrays with functions push and pop
Message-Id: <x3ywvx1z6dj.fsf@tigre.matrox.com>
cdmafleet@aol.com (CDMAFleet) writes:
> Let's say you've got a multidimensional array (an array for each login id on
> the machine for example). So if there's twenty different login ids and you
> need to store their phone number, last time logged in, address and few other
> things, then the multidimensional array would look something like this:
>
> @myarray = ( [], [], [], [], [] ... and so on).
If your login ids are small integers starting from 0 or 1 and
incrementing by one for each user, then your approach would be
fine. Otherwise, if the login ids are names, then I wouldn't do it
this way. I would create a hash of arrays. The keys for the hash would
be the login ids, the values would be a reference to an array
containing the data.
> for ($i = 0; $i < $number_of_login_ids; $i++)
> {
>
> @myarray = (@myarray, []);
This is more efficiently written as:
push @myarray => [];
> } # end for loop [$i]
>
> (PS. If my code looks funny, I'm a C coder first, then a Perl
> scripter next!)
Your choice of words is interesting. What made you say "code" for C,
and "script" for Perl? Do you see any difference in your coding habits
in both cases? Do you treat your Perl "scripts" any differently from
the way you treat C "code" ?
> push ( ($myarray[2]), $data);
push() expects an array as its first argument, so give it one:
push @{$myarray[2]} => $data;
Since $myarray[2] is a reference to an array, @{$myarray[2]} is the
array it references.
> Also, on a side note, how would one get the length (number elements) [1] and
> the length (number of characters at a given index)...[2]
>
> I.E.(1) Size of the array... if the third sub-array in @myarray has twelve
> elements, what's the Perl code?
$x = @{$myarray[2]};
> I.E.(2) Length of a given index... if the third sub-array has twelve elements
> and the fifth element (index 4) is of length 27. Does this mean length
> ($myarray[2][4]) == 27? (Or am I crazy? [That too!])
Yep that's correct .. why didn't you try it?
HTH,
Ala
------------------------------
Date: 18 Jun 1999 19:56:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: odd autoincrement behavior ?
Message-Id: <7ke89c$grh$1@pegasus.csx.cam.ac.uk>
Abigail <abigail@delanet.com> wrote:
>Bill Jones (bill@fccj.org) wrote on MMCXVII September MCMXCIII in
><URL:news:376a2569.0@usenet.fccj.cc.fl.us>:
>\\ It doesn't like -
>\\
>\\ print "$_ : $hash{$_}\n" foreach sort keys %hash;
>
>
>That's because you have a syntax error. Where's the list you iterate over?
`sort keys %hash' looks like a list to me.
That's only a syntax error in perl5.004_04 and earlier. Bill's problem
is an out of date Perl.
Mike Guy
------------------------------
Date: Fri, 18 Jun 1999 15:08:37 -0400
From: Matthew Amster-Burton <mamster@mamster.net>
Subject: Re: Pattern Matching Question
Message-Id: <Pine.GSO.3.96.990618150609.18555A-100000@wired.your-site.com>
On Fri, 18 Jun 1999, Burton Kent wrote:
> $string =~ /James Bond.*|/
>
> This will search for James Bond, and then check to make sure
> it's the first ("Movie Name") field and not the second one.
>
> Of course, this is Perl. There's more than one way to do it.
Yes, but this isn't one of them.
$string = "monkey";
print 'found' if $string =~ /James Bond.*|/;
will print "found". perldoc perlre and pay close attention to the '|'
behind the curtain.
Matthew
------------------------------
Date: Fri, 18 Jun 1999 12:32:32 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: greg@dns.kode.net
Subject: Re: Printing compound variables (?)
Message-Id: <376A9ED0.43F244F9@mail.cor.epa.gov>
[courtesy cc sent to poster]
vectorcalculus@my-deja.com wrote:
>
> If I have this:
>
> $one = "text and stuff";
> $two = '$one';
>
> Is there any way I can get to the contents of $one
> by only accessing $two? Something to the effect
> of:
>
> print (some_method($two));
>
> that would print the contents of the scalar whose
> name is the value in $two.
Greg, the technique you have here is called 'symbolic
references', and it is not A Good Thing. In fact, in Perl
you can use hashes to avoid doing such a thing.. as TomC's
long post said. Do something like:
print some_method($two_hash{$one});
instead. That said, I have a question for you.
Why did you think this was a reasonable thing to do?
I don't want to appear rude or flippant here. I really
want to know. This ng is getting a *lot* of such questions,
when it is not a thing most programmers would want to do.
Is this a commonly-seen technique in some CGI scripts?
Did you read about it in a book?
I would really appreciate an answer, preferably in the
comp.lang.perl.misc newsgroup so others can see. If you
have been led to think this wa a good option by some source,
I would really like to know about it.
TIA,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 18 Jun 1999 19:41:31 GMT
From: jennifer01@vei.net
Subject: Random Index?....
Message-Id: <929734963.817.103@news.remarQ.com>
Hi! I was wondering if anyone knew of a script(someone told me there
was a perl one)that would allow me to have random index pages load.
Meaning when the person hits reload, a whole new different index page
would load. I saw it at http://starwars.com/episode-i/ and just am
dying to know how they do that! Ive tried in vain for a javascript
for it but am not too sure on some of the details about it. So i
figured id try here as well since i was told it was more then likely a
perl script. Any help would be greatly appreciated! Thanks!
Jen
------------------------------
Date: Fri, 18 Jun 1999 12:23:27 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: script to lookup phone number off website?
Message-Id: <376A9CAF.317DED7E@mail.cor.epa.gov>
AL wrote:
>
> Darn, can't I be lazy?
>
> Tom Phoenix <rootbeer@redcat.com> wrote
> [snip]
> > If you're wishing merely to _find_ (as opposed to write) programs,
> > this newsgroup may not be the best resource for you. There are many
> > freeware and shareware archives which you can find by searching Yahoo
> > or a similar service. Hope this helps!
Yes, you can be lazy. Laziness is a virtue for Perl programmers.
In fact, it is defined (in the camel) as: "The quality that makes
you go to great effort to reduce overall energy expenditure. It
makes you write labor-saving programs that other people will find
useful, and document what you wrote so you don't have to answer
so many questions about it..."
Asking others to do your work *increases* overall energy
expenditure. That doesn't sound like the Perl definition of
Laziness to me. But using a labor-saving program like Yahoo!
might be a step in that direction.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 18 Jun 1999 15:12:27 -0400
From: "Carey Barnett" <cbarnett@idirect.com>
Subject: Re: Using ^M within backquotes possible?
Message-Id: <376a9a21@diana.idirect.com>
What you're trying to do is send a carriage return, so try...
> print `cd $ROOT; echo "y\n" | setnode g=$GENERIC node=$ROOT >/dev/nul
> l 2>&1`;
Burton Kent <burton@lucent.com> wrote in message
news:376A8F40.2F123CC0@lucent.com...
> I need to call a program from a shell. To bypass a prompt, I have to echo
"y^M"
> to the program:
>
> print `cd $ROOT; echo "y\^M" | setnode g=$GENERIC node=$ROOT >/dev/nul
> l 2>&1`;
>
>
> This is what I get, instead of having the program ("setnode") run
properly:
>
> " | setnode g=$GENERIC node=$ROOT >/dev/null 2>&1
>
>
> I have tried escaping the double quotes, escaping the ^M, and both. No
luck.
> Any suggestions!? Should I be using an entirely different approach?
>
> Burton
------------------------------
Date: Fri, 18 Jun 1999 19:22:06 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Using ^M within backquotes possible?
Message-Id: <y%wa3.9186$CG.220787@typ31b.nn.bcandid.com>
In article <376a9a21@diana.idirect.com>,
Carey Barnett <cbarnett@idirect.com> wrote:
>What you're trying to do is send a carriage return, so try...
>
>> print `cd $ROOT; echo "y\n" | setnode g=$GENERIC node=$ROOT >/dev/nul
>> l 2>&1`;
$ echo "y\n"
y\n
Bzzt.
I don't get one thing though. Why put something in backquotes if you're
redirecting its output (and errors even) to /dev/null? The backquotes return
nothing. Then print it! Wouldn't want to miss out on printing the nothing.
if(!open(FOO, "|cd $ROOT; setnode g=$GENERIC node=$ROOT >/dev/null 2>&1")) {
die "can't pipefork setnode: $!\n";
}
print FOO "y\n";
close(FOO);
No backquotes, no mess.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Fri, 18 Jun 1999 19:13:35 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: VERY SIMPLE QUESTION.
Message-Id: <zTwa3.442$7X1.107542@news.shore.net>
xacto@my-deja.com wrote:
: I am very unfamiliar with Perl in CGI but have been assigned the task
: of transferring Perl based CGI files from a Apache Server to a WinNT
: Server and still have the CGI function properly. I've installed
: ActivePerl and it seems like I'm on my way but I do have a question.
: I've noticed that most files end with the .cgi extension. Is there a
: reason why Perl based files are named .cgi verus .pl? Are they two
: different file types altogether? Any help would be great.
Traditionally, ".cgi" is used for programs that run via the CGI interface,
regardless of what language they're written in. It doesn't matter what the
suffix is, though, as long as your web server is configured to run them as
CGI programs and not simply return them as static documents. (For example,
all of the Perl code examples in the O'Reilly CGI book use the .pl suffix;
don't tell Tom C! :)
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 18 Jun 1999 19:29:41 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: VERY SIMPLE QUESTION.
Message-Id: <7ke6n5$r10$1@info2.uah.edu>
In article <7kdvd1$n4m$1@nnrp1.deja.com>,
xacto@my-deja.com writes:
: ActivePerl and it seems like I'm on my way but I do have a question.
: I've noticed that most files end with the .cgi extension. Is there a
: reason why Perl based files are named .cgi verus .pl?
The .cgi extension is usually a hint to webservers that the file is a
program that uses the Common Gateway Interface. The .pl extension is
conventionally used as a hint to humans that the file is a Perl Library.
: Are they two
: different file types altogether? Any help would be great.
I suppose that depends on how you define `file type'.
This is all only tangentially related to Perl, though.
Greg
--
Isn't it weird that we drink milk, stuff designed to nourish baby cows? How did
THAT happen? Did some cattleman once say, "Oh, man, I can't wait till them
calves are done so I can get ME a hit of that stuff."
-- Jerry Seinfeld
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6048
**************************************