[17741] in Perl-Users-Digest
Perl-Users Digest, Issue: 5161 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 20 14:10:39 2000
Date: Wed, 20 Dec 2000 11:10:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977339420-v9-i5161@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Dec 2000 Volume: 9 Number: 5161
Today's topics:
HTTP::Request help (Getting past ASP Login pages) <kaneda@intercom.com>
Re: is this bad perl programming habit? <uri@sysarch.com>
Re: is this bad perl programming habit? nobull@mail.com
Re: is this bad perl programming habit? (Tom Christiansen)
Re: is this bad perl programming habit? (Abigail)
Re: is this bad perl programming habit? (Tom Christiansen)
launching an .exe file with exec() stong123@my-deja.com
multiple RECIPIENTS sealeman@my-deja.com
Re: multiple RECIPIENTS (Brian Pontz)
Re: multiple RECIPIENTS nobull@mail.com
Re: newbie question - dbi:xbase <jeff@vpservices.com>
Re: No embeding please! (Abigail)
Re: overriding 'print' (Anno Siegel)
Re: overriding 'print' (Abigail)
Re: Perl to TCP/IP Connection & Overall Direction Neede (Monte Phillips)
PPM <juha.manninen@datex-ohmeda.com>
Probelm with Hash and loop msalerno@my-deja.com
Re: problem with awk in perl script <jeffp@crusoe.net>
Re: problem with awk in perl script (Tad McClellan)
PWS - perl <snefsite@hotmail.com>
Re: PWS - perl nobull@mail.com
Re: qmail-inject (Tad McClellan)
Re: RegEx: \s but not \n (Sean McAfee)
switch/case in Perl? <cleon42@my-deja.com>
using eventlog module to access nt log <nday@3s-technology.com>
using vi from within perl hedley_s@my-deja.com
Re: using vi from within perl mike_solomon@lineone.net
Re: using vi from within perl <David.Hiskiyahu@alcatel.be>
verilog-mode.el Installation Problems brusque@my-deja.com
Re: yet another question: is ' more efficient than "? (Christopher Masto)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Dec 2000 18:42:41 GMT
From: "Steve Lok" <kaneda@intercom.com>
Subject: HTTP::Request help (Getting past ASP Login pages)
Message-Id: <B4706.225$in1.28993@newshog.newsread.com>
Hello,
First posting here, hoping anyone can assist me here.
I'm trying to post some info to a form at /check/check.asp, but I get
redirected to a /login.asp script whenever I send the request. I'm
suspecting it's asking me to log in first, that's my problem.
I've tried sending the login info along with the main request to check.asp,
to no avail. I've tried sending the login info first to /login.asp, then
using the same UserAgent call, post my request to /check/check.asp. The
username and password are valid. What am I doing wrong? Sorry for the mess.
(URLs replaced)
$request1 = "ID=login&password=pass&txt1=you&txt2=me";
$url1 = "/check/Check.asp"; # URL to post to
# set up the HTTP request
my $ua = LWP::UserAgent->new;
my $rq1 = HTTP::Request->new (POST => $url1);
$rq1->header('Content-Type' => 'text/xml');
#####
$url2 = "Login.asp"; # URL to post to (
$request2 = "txtID=login&txtpassword=pass";
my $rq2 = HTTP::Request->new (POST => $url2);
$rq2->header('Content-Type' => 'text/xml');
# Set the content of the request to the XML request text
$rq1->content($request1);
# Set the content of the request to the XML request text
$rq2->content($request2);
$ua->request($rq2);
my $response = $ua->request($rq1);
------------------------------
Date: Wed, 20 Dec 2000 18:22:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: is this bad perl programming habit?
Message-Id: <x7elz3dkal.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> Yes. "use" is done at compile time. You should be doing:
A> if (defined $args{USE_XYZ_FUNCTIONS}) {
A> require MyModules::XYZModule;
syntax error. you fell into the use to require trap. the argument to
require is an expression and not a package name. it needs to be quoted,
have the .pm suffix and :: converted to /. i ran into this when doing a
dynamic load of modules based on the package name.
A> MyModules::XYZModule -> import () if
A> MyModules::XYZModule -> can ("import");
all modules can import as import is in UNIVERSAL. but you should skip
that anyway of the module is pure OO and doesn't mung with the symbol table.
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: 20 Dec 2000 18:16:30 +0000
From: nobull@mail.com
Subject: Re: is this bad perl programming habit?
Message-Id: <u9snnjyn41.fsf@wcl-l.bham.ac.uk>
abigail@foad.org (Abigail) writes:
> if (defined $args{USE_XYZ_FUNCTIONS}) {
> require MyModules::XYZModule;
> MyModules::XYZModule -> import () if
> MyModules::XYZModule -> can ("import");
> push @MyModules::Glue => 'MyModules::XYZModule';
> }
Since the title of this thread is "is this bad perl programming
habit?" I think I should point out that unthinkingly calling the
import() method of a module that's require()d at runtime is probably
a bad habit. I'm not saying you shouldn't call it, just that you
should think about what it means first.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 20 Dec 2000 11:41:14 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: is this bad perl programming habit?
Message-Id: <3a40fd4a@cs.colorado.edu>
In article <x7elz3dkal.fsf@home.sysarch.com>, Uri Guttman <uri@sysarch.com> wrote:
>all modules can import as import is in UNIVERSAL.
Um, no it's not.
% perl -le 'print defined &UNIVERSAL::import || 0'
0
% perl -le 'print defined &UNIVERSAL::can || 0'
1
Rather, it's simply that a failed import method is silently discarded by Perl:
% perl -e 'UNIVERSAL->import()'
% perl -e 'UNIVERSAL::import()'
Undefined subroutine &UNIVERSAL::import called at -e line 1.
Exit 255
% perl -e 'snagglepuss->import()'
% perl -e 'snagglepuss::import()'
Undefined subroutine &snagglepuss::import called at -e line 1.
Exit 255
Brought to you by the gv_fetchmethod_autoload function in src/perl/gv.c:
gv = gv_fetchmeth(stash, name, nend - name, 0);
if (!gv) {
if (strEQ(name,"import"))
gv = (GV*)&PL_sv_yes;
else if (autoload)
gv = gv_autoload4(stash, name, nend - name, TRUE);
}
(And found in the perlapi manpage, but this is not fessed to)
The Lesson of this Tale? That you shouldn't forget the fun you can
have wiht the "ant" package:
import ant "comments can be hidden this way";
--tom
------------------------------
Date: 20 Dec 2000 18:41:36 GMT
From: abigail@foad.org (Abigail)
Subject: Re: is this bad perl programming habit?
Message-Id: <slrn941vb0.7r0.abigail@tsathoggua.rlyeh.net>
nobull@mail.com (nobull@mail.com) wrote on MMDCLXVIII September MCMXCIII
in <URL:news:u9snnjyn41.fsf@wcl-l.bham.ac.uk>:
() abigail@foad.org (Abigail) writes:
()
() > if (defined $args{USE_XYZ_FUNCTIONS}) {
() > require MyModules::XYZModule;
() > MyModules::XYZModule -> import () if
() > MyModules::XYZModule -> can ("import");
() > push @MyModules::Glue => 'MyModules::XYZModule';
() > }
()
() Since the title of this thread is "is this bad perl programming
() habit?" I think I should point out that unthinkingly calling the
() import() method of a module that's require()d at runtime is probably
() a bad habit. I'm not saying you shouldn't call it, just that you
() should think about what it means first.
By not calling import(), it wouldn't do the same as "use", which the
OP attempted to do. OP wanted to have a conditional, run-time use.
Omitting import() would be a mistake.
Abigail
--
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'
------------------------------
Date: 20 Dec 2000 12:02:56 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: is this bad perl programming habit?
Message-Id: <3a410260@cs.colorado.edu>
In article <slrn941vb0.7r0.abigail@tsathoggua.rlyeh.net>,
>By not calling import(), it wouldn't do the same as "use", which the
>OP attempted to do. OP wanted to have a conditional, run-time use.
>Omitting import() would be a mistake.
Not to disagree, but simply to caution: Run-time imports are hardly
as effective as compile-time ones. Why? Because there can certainly
semantics that need changing while the parse tree is being built,
not later on. That means that you can end up with a silently very
wrong answer. I alwasy mistrust run-time imports as a consequence.
First, consider prototypes. If X::fn and Y::fn have different
context coercion templates, when you call fn() such that which
one you call hasn't been determined until run time, you will
miss out on the coercion. Heck, what happens it even *has*
such a template?
Consider:
package NewPush;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT = 'mypush';
sub mypush(\@@) {
my $aref = shift;
push @$aref, @_;
}
1;
Now, watch the difference this makes:
% perl -MNewPush -e '@x = (["inner"],"fred");
mypush(@x, "NEW");
print "@x\n@{$x[0]}\n"'
ARRAY(0xa9150) fred NEW
inner
Fine. But at run-time, you're screwed:
% perl -e 'eval q(use NewPush);
@x = (["inner"],"fred");
mypush(@x, "NEW");
print "@x\n@{$x[0]}\n"'
ARRAY(0xa9150) fred
inner fred NEW
No error message, no joy. Terrible answer.
Bad. Very bad.
Next, there are things like overridden constants:
% perl -MMath::BigInt=:constant -le 'print 2**50'
+1125899906842624
% perl -le 'eval q(Math::BigInt=:constant); print 2**50'
1.12589990684262e+15
This can certainly happen in more places than numbers. For
example:
package NoBill;
use overload;
sub import { overload::constant q => \&string_handler }
sub string_handler {
my ($original) = @_;
$original =~ s/Windows/Winblows/g;
return $original;
}
1;
Which now produces this disparate outcome:
% perl -MNoBill -le 'print "Windows can bite me"'
Winblows can bite me
% perl -le 'eval q(use NoBill); print "Windows can bite me"'
Windows can bite me
Finally, consider all the lexical pragmata:
% perl -le 'use integer; print 5/2'
2
% perl -le 'eval "use integer"; print 5/2'
2.5
As people switch over from the obsolescent "-w" flag to the spiffier
"use warnings" pragma, we'll see this issue revisited.
So, I do not trust run-time imports all that much, and I hope that
you don't, either.
--tom
------------------------------
Date: Wed, 20 Dec 2000 18:18:48 GMT
From: stong123@my-deja.com
Subject: launching an .exe file with exec()
Message-Id: <91qt60$d6u$1@nnrp1.deja.com>
Hi,
earlier Jeff H. had helped me on mapping to a shared drive, but if I
want to run an .exe file from that shared drive, I tried exec() but
kept encountering error, below is what I did.
$dirname = "//minerva/global/setup/";
opendir(DIR, $dirname) or die "$!";
exec("set up1.exe") or die "$!";
closedir(DIR);
I tried system () but no luck.
the executable is named 'set up1.exe' and is located in teh server's
setup directory.
TIA,
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:06:03 GMT
From: sealeman@my-deja.com
Subject: multiple RECIPIENTS
Message-Id: <91qotl$9cp$1@nnrp1.deja.com>
In using an order form with Earthlink.net, I want to send the results to
more than one RECIPIENT. The current code looks like the following with
specific addresses enclosed in (brackets).
<FORM METHOD="POST" ACTION="http://www.(website name)/cgi-bin/mailto">
<input type="hidden" name="RECIPIENT" value="(e-mail address)">
If I simply add another RECIPIENT value in a new line, it still only
sends to one. Can anyone show me how to add a 2nd RECIPIENT. Thanks.
Allen
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:42:35 GMT
From: pontz@NO_SPAM.channel1.com (Brian Pontz)
Subject: Re: multiple RECIPIENTS
Message-Id: <3a40ef0e.590471743@news.e-dialog.com>
>
>If I simply add another RECIPIENT value in a new line, it still only
>sends to one. Can anyone show me how to add a 2nd RECIPIENT. Thanks.
>
>Allen
Try seperating the email addresses with commas ( , ).
email@email.com,second@second.com
Brian Pontz
comp.lang.perl.misc Searchable Archive
http://www.axehind.com/complangperl.html
------------------------------
Date: 20 Dec 2000 18:08:54 +0000
From: nobull@mail.com
Subject: Re: multiple RECIPIENTS
Message-Id: <u9u27zyngp.fsf@wcl-l.bham.ac.uk>
pontz@NO_SPAM.channel1.com (Brian Pontz) writes:
> > [ off-topic question ]
>
> [ answer ]
Do not answer off-topic questions in the newsgroup. If you really
can't refrain then at the very least point out that they are
off-topic.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 20 Dec 2000 09:05:25 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie question - dbi:xbase
Message-Id: <3A40E6D5.A7848CF3@vpservices.com>
Michal Kolesar wrote:
> And I am newbie to perl.. and I don't know, that perl is case sensitive
> language..
Yes, even if you are on a file system like windows that doesn't
distinguish case names of module file names, you still have to use the
correct case for the module in your script.
> I change it to XBase and now is all OK!
Great! Good luck with a fine module.
--
Jeff
------------------------------
Date: 20 Dec 2000 17:16:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: No embeding please!
Message-Id: <slrn941qaj.7r0.abigail@tsathoggua.rlyeh.net>
AP (alex@hoopsie2.com) wrote on MMDCLXVIII September MCMXCIII in
<URL:news:3A40D633.13A24EA8@hoopsie2.com>:
::
:: So that they are seen as comments by HTML design tools. What those tools
:: may do to the tags or how they may move them around is another story beyond
:: my knowledge because I either code HTML by hand or use HMTL editing tools
:: that are not WYSIWYG.
"Coding by hand" as opposed to "editing tools" give me the image of
someone using his nails to cut out holes in a punchcard.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: 20 Dec 2000 16:12:34 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: overriding 'print'
Message-Id: <91qlpi$mtu$1@lublin.zrz.tu-berlin.de>
Tom Christiansen <tchrist@perl.com> wrote in comp.lang.perl.misc:
>In article <91qg5u$mku$1@lublin.zrz.tu-berlin.de>,
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>I know of no way do find out if a function can be overridden, short
>>of trying to override it.
>
>1) In the Perl Cookbook's chapter on modules, one learns that
>
> Not all ``reserved words'' have the same status. Those
> that return a negative number in the C-language C<keyword()>
> function in the I<toke.c> file in your Perl source kit may
> be overridden.
>
> Actually, it's now the Perl_keyword function, but no matter.
>
> % perl -lne 'print $1 if (/^\S*keyword/ .. /^}/)
> && /return\s*-KEY_(\w+)/' /usr/local/src/perl/toke.c | fmt
>
> __FILE__ __LINE__ __PACKAGE__ and abs alarm atan2 accept
> bless bind binmode CORE cmp chr cos close chdir chmod chown
[...]
>2) Check whether you get back a positive-length string from calling
> prototype("CORE::...."), where "...." is the function in question.
>
> % perl -le 'print prototype("CORE::socket")'
> *$$$
> % perl -le 'print prototype("CORE::sort")'
>
> % perl -le 'print prototype("CORE::tie")'
[...]
Aha. Thanks for that bit. The prototype part even makes sense: If
the parameters cannot be described by a prototype there's no way
to replace the functionality with a Perl function.
Anno
------------------------------
Date: 20 Dec 2000 17:13:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: overriding 'print'
Message-Id: <slrn941q53.7r0.abigail@tsathoggua.rlyeh.net>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDCLXVIII
September MCMXCIII in <URL:news:91qlpi$mtu$1@lublin.zrz.tu-berlin.de>:
-:
-: Aha. Thanks for that bit. The prototype part even makes sense: If
-: the parameters cannot be described by a prototype there's no way
-: to replace the functionality with a Perl function.
Well, yeah, that's true, but the prototypes of shift and pop can
be described; their functionality can be replaced by a Perl function;
yet prototype() won't give a prototype for them.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Wed, 20 Dec 2000 10:41:01 GMT
From: montep@hal-pc.org (Monte Phillips)
Subject: Re: Perl to TCP/IP Connection & Overall Direction Needed
Message-Id: <3a408a6e.1932228@news.hal-pc.org>
On Tue, 19 Dec 2000 15:36:30 -0800, Eric Hilding <eric@hilding.com>
wrote:
>Monte Phillips wrote:
>>
>> >1. Connect via Perl with TCP/IP to a remote database. Is there already
>> >some
>> > kind of module? I AM CLUELESS ON HOW TO APPROACH THIS.
>>
>> What is your platform? What is the remote servers platform? What
>> access security level do you have on each? Do you have port 80 access
>> to the remote?
>
>Thanks for the reply, Monte: What I've been able to determine at this
>point is it's also a Unix system, and to port 23 via Telnet. I'm
>waiting on a call back from someone who can clarify other info for me,
>and to confirm the file format of the database output is Tab Delimited.
>
>I can get anything I need out of it using HyperTerminal, but
>Gheeezzzz...
>it's such a Manual pain that I would like to automate as much as
>possible.
Well all though only marginally within the guidelines of this
newsgroup I will plunge ahead<grin>. My first approach if I were in
this situation would be to have my script placed on the remote server,
and either let its cron do the timing and send you the output.
If you have telnet access to the remote I do not see any issues with
that being a feasable solution.
My reason for asking about port 80 was the obvious but extrremely
convoluted method by which you place your script on their web
server(Apache) and you 'trigger' it via the net.
There are other more secure ways of doing this, including assigning an
obscure port for your personal use, but you need a really, really
close relationship with the remote folks to get that set up<grin>.
Solve these issues and the perl part of the puzzle should become a
trivial matter.
g'Luk
------------------------------
Date: Wed, 20 Dec 2000 20:18:48 +0200
From: Juha Manninen <juha.manninen@datex-ohmeda.com>
Subject: PPM
Message-Id: <3A40F808.2D76863A@datex-ohmeda.com>
Hi!
Long time ago I sent messages because I could not get PPM working.
It always gave the usage help, whatever options I gave, even 'ppm
version'.
I am using ActivePerl on NT 4.
Then I gave up but now I noticed the command 'ppm' start a .bat file
(ppm.bat).
When I went to Perl/bin directory and typed 'perl ppm.pl', everything
started to work!
It was almost shocking after all that frustration.
So, what is this ppm.bat anyway? It is about the same size with 'ppm.pl'
but still gives only usage help. Shit!
Juha Manninen
------------------------------
Date: Wed, 20 Dec 2000 17:15:39 GMT
From: msalerno@my-deja.com
Subject: Probelm with Hash and loop
Message-Id: <91qpfi$9un$1@nnrp1.deja.com>
I am having problems creating a hash of users that match the $search
var. I can do this with an array, but in order to do this properly I
would like to use a hash. The information in the hash will later be
used to print out a list. I am pretty sure that I will need to use a
foreach loop in order to print out a list of all the users in the hash
30 at a time, but before I can battle with that, I need help with this
issue. Any assistance is appreciated.
Thanks,
Matt
#!/usr/bin/perl -w
use strict;
use vars qw( $cnt $search %pwlist $o );
$search = "oot";
open(PASSWD, "</etc/passwd") || die "ERROR: Cannot open\n";
my @pwq = <PASSWD>;
$cnt = 0;
for (my $i = 0; $i < @pwq; $i++)
{
if (lc($pwq[$i]) =~ /\Q$search/ ){
my($user, $pword, $uid, $gid, $comment, $home, $shell) =
split(/:/, $pwq[$i]);
%pwlist = ("$cnt" => ["$user", "$comment"]);
$o = $i;
print "$cnt\t$user\t$comment\n";
print "Catalog # $cnt\tUser: $user\tComments: $comment\n";
$cnt++;
}
}
if ($cnt >= 1){
print "HERE\n";
print $pwlist{1}[0];
}
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 12:12:39 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: problem with awk in perl script
Message-Id: <Pine.GSO.4.21.0012201147500.22284-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 20, Kenny McCormack said:
>In article <91qdel$umg$1@nnrp1.deja.com>, <mike_solomon@lineone.net> wrote:
>...
>>Why are you using awk within a Perl script? You can use Perl to do
>>eveything awk does to convert awk scripts to Perl you can use a utility
>>called a2p
>
>The most likely answer to this is that the OP is using Perl more or less as
>a shell, rather than as a programming language. Given what a crappy
>language Perl is qua language, this is understandable. Probably some
>company mandate that it be used in place of the the more conventional
>shells.
The question is not about whether Perl or awk is a crappy language. Yes,
Perl can be used as a scripting language -- but if you're going to do
that, you might as well not use Perl. Someone was just saying that to
call awk from Perl is kinda silly, since Perl can do what awk does (and in
some cases, it does it faster -- yes, I have the benchmarks to show this).
And calling awk from Perl requires a system call.
And no one here bashed [pun intended] awk, so please return the favor.
>The most likely answer to the original question is a PATHing problem. The
>error messages look like those generated by "old AWK" - making it look like
>there is some alias or PATH setup in the shell that causes "awk" to invoke
>"nawk" or "gawk" (or some other modern AWK), but that inside Perl, he's
>picking up /bin/awk (on Solaris).
From a Perl point of view, his code is:
system(`awk '{print $10, $1}' statdata.txt`);
He has mixed backquotes (which execute a command) with system() (which
executes a command). One of them is not needed. If he wants to print the
output, he should system(). If he wants to store the results, he should
use `` or qx().
But he also needs to make sure he escapes the $ characters, or uses a
single-quoted string, so that Perl doesn't substitute in its variables
when the string is interpolated:
system q[awk '{print $10, $1}' statdata.txt];
The q[] thing is an alternative to single quotes (since you also need to
use them on the inside). You could write it as:
system 'awk \'{print $10, $1}\' statdata.txt';
But backslashing tends to be messy.
Here's the qx[] approach:
@output = qx[awk '{print \$10, \$1}' statdata.txt];
But, all awk aside, here's a pure Perl solution:
open FILE, "statdata.txt" or die "can't open statdata.txt: $!";
while (<FILE>) {
print join(" ", (split)[9,0]), "\n";
}
close FILE;
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 20 Dec 2000 10:53:58 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: problem with awk in perl script
Message-Id: <slrn941lgm.2gn.tadmc@magna.metronet.com>
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>Nikos Laoutaris wrote in comp.lang.perl.misc:
>>
>> I have a problem with a rather simple awk command that i am issuing from
>> inside a perl script using the system() call.
>Take some time to learn the basics of Perl
Good idea.
>and to reimplement this using only Perl commands!
That part should take less than 5 seconds to do!
The 'a2p' program is part of the normal perl install. Use it
to convert the awk program into a Perl program.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Dec 2000 17:32:07 +0100
From: "Sven Franke" <snefsite@hotmail.com>
Subject: PWS - perl
Message-Id: <91qmnt$t03$1@enterprise.cistron.net>
Hi, I hope you guys can help me out.
I use W98(se) and I installed PWS.
I make a virtual directory (CGI-BIN) and selected the execute and script
option.
I wrote a little HELLO WORLD (try.cgi) and placed this file into CGI-BIN.
When I go to http://localhost/CGI-BIN/try.cgi the page cannot be displayed
or the file is shown totally.
What is wrong? I looked at activestate, but the help overthere wasn't
solving my problem.
I want to use PWS to check my scripts as if they were on the web.
Sven.
------------------------------
Date: 20 Dec 2000 18:46:53 +0000
From: nobull@mail.com
Subject: Re: PWS - perl
Message-Id: <u9n1drylpe.fsf@wcl-l.bham.ac.uk>
"Sven Franke" <snefsite@hotmail.com> writes:
> Hi, I hope you guys can help me out.
Maybe some of us could but it would be considerd a bad thing for us to
do so as we don't want to encourage off-topic posting.
> I use W98(se) and I installed PWS.
> I wrote a little HELLO WORLD (try.cgi) and placed this file into CGI-BIN.
>
> When I go to http://localhost/CGI-BIN/try.cgi the page cannot be displayed
> or the file is shown totally.
What you have here is a PWS configuration question - not related to
Perl. You must somehow tell PWS that files in CGI-BIN with a .cgi
suffix are to be interpreted using perl.exe. Or alternatively perhaps
you can persuade PWS to honour #! headers. I don't know because I
know nothing about PWS.
> What is wrong? I looked at activestate, but the help overthere wasn't
> solving my problem.
Because your problem is not Perl related.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 20 Dec 2000 11:13:01 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: qmail-inject
Message-Id: <slrn941mkd.2gn.tadmc@magna.metronet.com>
Ed Grosvenor <secursrver@hotmail.com> wrote:
>My hosting provider uses qmail-inject instead of sendmail.
>every once in a great while, I get an error that reads "Use of
>uninitialized value at line 100..."
qmail is written in C. That is a _Perl_ warning message.
The problem is in your Perl program, not in qmail-inject.
>Well, that's great, except that the man
>pages (which are all I can get my hands on it seems) don't exactly tell you
>what's at line 100.
It is line 100 in your Perl program.
>I follow the instructions and the error seems almost
>arbitrary.
The qmail instructions will not help with a Perl problem :-)
>So what I was wondering is if any of you knows where I might be able to get
>my hands on an actual real copy of qmail-inject.
www.qmail.org
Surprise!
>my searches for the
>source have proven fruitless.
Google finds over a hundred hits for both "qmail" and "qmail-inject".
Did your "search" include trying a search engine?
>I would really appreciate any help on this
>one.
We would need to see the Perl code to help with the Perl problem.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Dec 2000 17:13:57 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: RegEx: \s but not \n
Message-Id: <pN506.11187$O5.302076@news.itd.umich.edu>
In article <87vgshjmia.fsf@cal056202.student.utwente.nl>,
Thomas Geffert <thomas@geffert.com> wrote:
>mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:
>> s/(?=\s*?\n)\s+//;
>I would have chosen the following:
>s/\s*\n\s*//;
Um...yeah. That is better. I guess I get lookahead-crazy sometimes.
>And I must admit that I don't understand your use of the
>zero-width-look-ahead . Especially I'm not sure, why your
>s/(?=\s*?\n)\s+// works for "abc\ndef". I thought, the \s+ would need
>at least one whitespace after the (?=\s*?\n) term. What am I missing
>with this look-ahead approach?
\n is part of \s. The \n is not consumed by the lookahead.
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Wed, 20 Dec 2000 18:51:24 GMT
From: Adam Levenstein <cleon42@my-deja.com>
Subject: switch/case in Perl?
Message-Id: <91qv39$f0j$1@nnrp1.deja.com>
Hey all,
Is there a version of C++'s "switch" function in Perl? As in:
switch ($x) {
case z: ...
case a: ...
}
Thanks,
Adam
--
-------------------------------------------------
Adam Levenstein
cleon42@my-deja.com
"Extraordinary claims require extraordinary evidence."
-- Carl Sagan
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:04:11 GMT
From: Nick Day <nday@3s-technology.com>
Subject: using eventlog module to access nt log
Message-Id: <91qoq5$99p$1@nnrp1.deja.com>
I am trying to use the eventlog module supplied with active perl.
The issue is with the types of event entries returned. It only seems
to return log entries with event id's in the 4000 or 6000 series. It
does not report anything lower than 4000.
Any suggestions to help me report all log entries.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:11:25 GMT
From: hedley_s@my-deja.com
Subject: using vi from within perl
Message-Id: <91qp7m$9j5$1@nnrp1.deja.com>
hi,
I need to be able to allow users to vi a file from within a perl script.
I know that this is not good practice but though that I would be able
to do the following:
$status = `vi $filename` ;
However, this seems to put me in vi mode, but the screen stays as it
is until I exit vi, I cannot see the file contents.
Does anyone know how I can get around this? I presume I'm barking up
the wrong tree and that it may be better to kick off a child process or
something but I'm not sure how.
any help would be appreciated
thanks
H
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:32:43 GMT
From: mike_solomon@lineone.net
Subject: Re: using vi from within perl
Message-Id: <91qqfs$asc$1@nnrp1.deja.com>
In article <91qp7m$9j5$1@nnrp1.deja.com>,
hedley_s@my-deja.com wrote:
> hi,
>
> I need to be able to allow users to vi a file from within a perl
script.
> I know that this is not good practice but though that I would be able
> to do the following:
>
> $status = `vi $filename` ;
>
> However, this seems to put me in vi mode, but the screen stays as it
> is until I exit vi, I cannot see the file contents.
>
> Does anyone know how I can get around this? I presume I'm barking up
> the wrong tree and that it may be better to kick off a child process
or
> something but I'm not sure how.
>
> any help would be appreciated
>
> thanks
>
> H
>
> Sent via Deja.com
> http://www.deja.com/
>
try:
system("vi filename");
this will open the file to edit
when you exit vi it will return you to the script
I hope this helps
Regards
Mike Solomon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 19:22:42 +0100
From: David Hiskiyahu <David.Hiskiyahu@alcatel.be>
Subject: Re: using vi from within perl
Message-Id: <3A40F8F2.D57D2DCD@alcatel.be>
...
> > I know that this is not good practice but though that I would be able
> > to do the following:
> >
> > $status = `vi $filename` ;
> >
> > However, this seems to put me in vi mode, but the screen stays as it
> > is until I exit vi, I cannot see the file contents.
...
mike_solomon@lineone.net wrote:
>
> try:
>
> system("vi filename");
>
> this will open the file to edit
>
> when you exit vi it will return you to the script
>
...
Mike, any clue why 'system' works ok here while the backticks fails?
I wonder if there is some written info on the difference between the two,
which most of time behave just the same.
I can guess that 'system' causes the perl parent process to fork a child
process and wait for it to exit, while backticks probably runs the system
command under the same process, which must mess up the i/o, which must be
the reason for backticks failing to show the vi window.
'%man perlfunc' in the section of 'system' does clearly say that 'system'
forks a child and waits, but I couldn't find a clear description of how
backticks work ...
------------------------------
Date: Wed, 20 Dec 2000 16:25:04 GMT
From: brusque@my-deja.com
Subject: verilog-mode.el Installation Problems
Message-Id: <91qmgl$743$1@nnrp1.deja.com>
Am trying to setup emacs with verilog-mode.el
I followed the installation procedure outlined
here(http://www.verilog.com/emacs_install.html#windows) and rebooted
then tried to run emacs and it only flashes across the screen and
disappears. I rechecked the setup and can't find any discrepencies.
If I execute "runemacs.exe", emacs starts righ up, but without the
verilog-mode.el settings. Any suggestions on how to debug this setup?
Many Thanks
Bill
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 20 Dec 2000 17:13:38 GMT
From: chris@lion-around.at.yiff.net (Christopher Masto)
Subject: Re: yet another question: is ' more efficient than "?
Message-Id: <6N506.1820$nM5.655419@news02.optonline.net>
In article <m1bsu72lyh.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>On the flipside, I double-quote nearly everything that isn't just a
>single word, because during maintenance, I'm almost always adding or
>removing \n and friends, and going to back to fix a string that was
>single-quoted is a pain in the hiney.
>
>So, if you're going to write code that *I* am going to maintain,
>I'd much prefer you use double-quotes on everything that doesn't
>absolutely need single quotes. Thank you.
And more importantly, double quotes are prettier.
--
Christopher Masto Senior Network Monkey NetMonger Communications
chris@netmonger.net info@netmonger.net http://www.netmonger.net
Free yourself, free your machine, free the daemon -- http://www.freebsd.org/
------------------------------
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 5161
**************************************