[16194] in Perl-Users-Digest
Perl-Users Digest, Issue: 3606 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 19:49:16 2000
Date: Mon, 10 Jul 2000 16:49:06 -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: <963272946-v9-i3606@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 10 Jul 2000 Volume: 9 Number: 3606
Today's topics:
system command output ? <e.bras@hccnet.nl>
Re: system command output ? <mike.solomon@eps.ltd.uk>
Re: system command output ? <foo@bar.va>
Re: system command output ? <flavell@mail.cern.ch>
Re: system command output ? <news@fido.workone.com>
Re: system command output ? <e.bras@hccnet.nl>
Re: system command output ? (Tad McClellan)
Re: Taryag Perl <tzadikv@my-deja.com>
Templates (was: Open Source PERL Bulletin Board system) <iltzu@sci.invalid>
test pooza@looza.com
Text Formatting <bohmj@mrs.umn.edu>
Re: Text Formatting <tony_curtis32@yahoo.com>
Thanks: Was: How to sort hash by keys, but print the el <sven@rheingau.netsurf.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 4 Jul 2000 14:07:20 +0200
From: "Ed Bras" <e.bras@hccnet.nl>
Subject: system command output ?
Message-Id: <8jsjvo$bus$1@enterprise.cistron.net>
Can someone please tell me how to capture the output of the command
system (ps -a | grep something) in my perl program ??
(I mean the output of ps -a | grep something if it where executed on the
command line)
Regards,
Ed Bras
------------------------------
Date: Tue, 4 Jul 2000 13:22:46 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: system command output ?
Message-Id: <8jskv2$1897a$1@ID-36965.news.cis.dfn.de>
open(PS,"ps -a | grep something|");
while(<OPEN>) {
print;
}
should give you what you need
Regards
Mike Solomon
Ed Bras <e.bras@hccnet.nl> wrote in message
news:8jsjvo$bus$1@enterprise.cistron.net...
> Can someone please tell me how to capture the output of the command
> system (ps -a | grep something) in my perl program ??
>
> (I mean the output of ps -a | grep something if it where executed on the
> command line)
>
> Regards,
> Ed Bras
>
>
>
>
------------------------------
Date: Tue, 04 Jul 2000 14:31:17 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: system command output ?
Message-Id: <3961D915.79624BE2@bar.va>
Ed,
Ed Bras wrote:
> Can someone please tell me how to capture the output of the
> command system (ps -a | grep something) in my perl program ??
Use the backticks.
<code>
@results=`your_command_here`
</code>
Best regards,
Marco
------------------------------
Date: Tue, 4 Jul 2000 14:19:20 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: system command output ?
Message-Id: <Pine.GHP.4.21.0007041415270.5516-100000@hpplus03.cern.ch>
On Tue, 4 Jul 2000, Ed Bras wrote:
> Can someone please tell me how to capture the output of the command
> system
FAQ. perldoc -q command ->
Why can't I get the output of a command with system()?
You're confusing the purpose of system() and backticks (``).
Also the documentation for the function 'system':
perldoc -f system ->
This is I<NOT> what you want to use to capture
the output from a command, for that you should use merely backticks
You had the terminology right: your failure was in not using the
documentation that's already available in your Perl installation.
------------------------------
Date: Tue, 4 Jul 2000 15:28:34 +0200
From: Kirill Miazine <news@fido.workone.com>
Subject: Re: system command output ?
Message-Id: <Pine.LNX.4.21.0007041524080.6919-100000@isolde.uio.no>
This should work for you
$out = `/bin/ps a | /bin/grep something`;
On Tue, 4 Jul 2000, Ed Bras wrote:
# Can someone please tell me how to capture the output of the command
# system (ps -a | grep something) in my perl program ??
#
# (I mean the output of ps -a | grep something if it where executed on the
# command line)
#
# Regards,
# Ed Bras
#
#
#
#
#
------------------------------
Date: Tue, 4 Jul 2000 15:48:42 +0200
From: "Ed Bras" <e.bras@hccnet.nl>
Subject: Re: system command output ?
Message-Id: <8jspua$fns$1@enterprise.cistron.net>
Thanks guys,
Ed
Ed Bras <e.bras@hccnet.nl> wrote in message
news:8jsjvo$bus$1@enterprise.cistron.net...
> Can someone please tell me how to capture the output of the command
> system (ps -a | grep something) in my perl program ??
>
> (I mean the output of ps -a | grep something if it where executed on the
> command line)
>
> Regards,
> Ed Bras
>
>
>
>
------------------------------
Date: Tue, 4 Jul 2000 09:18:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: system command output ?
Message-Id: <slrn8m3p0r.drs.tadmc@magna.metronet.com>
On Tue, 4 Jul 2000 14:07:20 +0200, Ed Bras <e.bras@hccnet.nl> wrote:
>Can someone please tell me how to capture the output of the command
>system (ps -a | grep something) in my perl program ??
No.
The answer to that question is already on your hard disk.
Just get it from there.
>(I mean the output of ps -a | grep something if it where executed on the
>command line)
Read the docs for the function you are using!
perldoc -f system
"This is I<not> what you want to use to capture
the output from a command, for that you should use merely"
followed by the answer to your question!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 Jul 2000 15:42:03 GMT
From: Tzadik Vanderhoof <tzadikv@my-deja.com>
Subject: Re: Taryag Perl
Message-Id: <8kcqs7$pnb$1@nnrp1.deja.com>
In article <8ib3j1$4su$1@nnrp1.deja.com>,
Tzadik Vanderhoof <tzadikv@my-deja.com> wrote:
> Is it just a coincidence that ActiveState's lastest release is "build
> 613"? I think not.... :)
>
> --
>ActiveState is pleased to announce the release of ActivePerl build
>615. For a complete list of changes in this release please refer to:
>
>http://www.ActiveState.com/Products/ActivePerl/docs/CHANGES.html
Nooooo!!!!!!
Oh, well, it was fun while it was lasted... actually, the changes don't
actually impress me as things I really need...
I think I'll hold onto my "build 613" for now! :)
--
Tzadik
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 5 Jul 2000 18:54:56 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Templates (was: Open Source PERL Bulletin Board system)
Message-Id: <962821563.15005@itz.pp.sci.fi>
In article <8jvm8d$1s9$1@eastnews1.east.sun.com>, Nobody wrote:
>with PHP. Trying to analyze/maintain code that is intermixed within
>HTML gives me a headache. For that matter, I have the same problem with
>all of these pseudo-client-side cgi languages. If the code runs on the
The "training wheels without the bicycle" metaphor applies here too.
In web applications, templates are ideal for implementing the view
part of a Model-View-Controller architecture. In simple, display-
oriented applications, where the database is effectively the model,
and controllers are implemented by dynamic SQL, this is enough. I've
written several such applications in ColdFusion, and liked the result,
even though I'd never use the language for anything more extensive.
The problems start to appear as soon as you need to write some actual
model code. Templates are specialized tools, suitable for dynamic
text generation and very little else. Trying to write extensive back
end code with them is about as productive as hitting nails with a
small screwdriver. The proper solution, instead, is to use templates
together with a general purpose language, for example HTML::Mason with
Perl or Webmacro with Java.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Thu, 6 Jul 2000 16:09:40 -0400
From: pooza@looza.com
Subject: test
Message-Id: <E8110306FCB3BAD0.E7DB228EFCA84665.35FAB0494F4D6C8D@lp.airnews.net>
test
------------------------------
Date: Wed, 05 Jul 2000 11:20:18 -0500
From: Jordan Bohm <bohmj@mrs.umn.edu>
Subject: Text Formatting
Message-Id: <39636041.424BE8E6@mrs.umn.edu>
I am using this code that outputs to a log file and I want to keep the
output to a single line. Right now the $REMOTE_HOST has a carriage
return and I don't see why it would.
$REMOTE_HOST = `nslookup $ENV{'REMOTE_ADDR'} | grep Name | cut -c10-72`;
print LOG "At $date, $REMOTE_HOST came here from
$ENV{'HTTP_REFERER'}using $ENV{'HTTP_USER_AGENT'}.\n";
close (LOG);
-
------------------------------
Date: 05 Jul 2000 11:32:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Text Formatting
Message-Id: <87lmzg1qsf.fsf@limey.hpcc.uh.edu>
>> On Wed, 05 Jul 2000 11:20:18 -0500,
>> Jordan Bohm <bohmj@mrs.umn.edu> said:
> I am using this code that outputs to a log file and I
> want to keep the output to a single line. Right now the
> $REMOTE_HOST has a carriage return and I don't see why
> it would.
Because you're going out to a shell. chomp() the returned
value.
> $REMOTE_HOST = `nslookup $ENV{'REMOTE_ADDR'} | grep Name
> | cut -c10-72`;
But why go out to a shell? Try the Net::DNS package. The
documentation has easy-to-adapt examples:
use Net::DNS;
$res = new Net::DNS::Resolver;
$query = $res->search('208.201.239.50');
if ($query) {
foreach $rr ($query->answer) {
next unless $rr->type eq 'PTR';
print $rr->ptrdname, "\n";
}
}
else {
print "query failed: ", $res->errorstring, "\n";
}
You can get Net::DNS from CPAN of course.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Wed, 05 Jul 2000 03:37:03 GMT
From: Sven Rudolph <sven@rheingau.netsurf.de>
Subject: Thanks: Was: How to sort hash by keys, but print the elements?
Message-Id: <8juagv$ee6$1@nnrp1.deja.com>
Thanks for your answers. You really helped me.
Sven
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 3606
**************************************