[17673] in Perl-Users-Digest
Perl-Users Digest, Issue: 5093 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 12 18:10:37 2000
Date: Tue, 12 Dec 2000 15:10:20 -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: <976662620-v9-i5093@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 12 Dec 2000 Volume: 9 Number: 5093
Today's topics:
Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js <lmoran@wtsg.com>
Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js <joe+usenet@sunstarsys.com>
Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js <xzrgpnys@yvtugubhfrovm.pbz>
output file to browser? <me@privacy.net>
Re: output file to browser? <mbudash@sonic.net>
Re: Passing parameter to CGI in webpage link <xzrgpnys@yvtugubhfrovm.pbz>
Re: Perl 5.6, Regexp, performance problems <joe+usenet@sunstarsys.com>
Re: Perl 5.6, Regexp, performance problems guthrie_linck@my-deja.com
Perl Training <mysangam@my-deja.com>
Perl XS problems <soumen.das@cp.net>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Colin Watson)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <joe+usenet@sunstarsys.com>
Problem using Image::Size on a webserver <g.soper@soundhouse.co.uk>
Ready Made Form Data? <vivekvp@spliced.com>
scan and read mails from /var/mail <jagman98@home.com>
Re: srand() for CGI (Tad McClellan)
Tabs and the M^ thing... <lmoran@wtsg.com>
Re: Tabs and the M^ thing... guthrie_linck@my-deja.com
TTY list <dizer@eircom.net>
Re: TTY list <rick.delaney@home.com>
Re: TTY list (Joe Smith)
Re: TTY list <krahnj@acm.org>
Re: TTY list <xzrgpnys@yvtugubhfrovm.pbz>
Re: Use PERL or Java? Which is faster? (Mark W. Schumann)
Re: Use PERL or Java? Which is faster? (Randal L. Schwartz)
Re: Use PERL or Java? Which is faster? <xzrgpnys@yvtugubhfrovm.pbz>
Re: using s// on *()[]+ in perl regex (Tad McClellan)
Re: Win32 User Account Management <carvdawg@patriot.net>
Win32/CGI question: "Running as" gets switched? ralphe142@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Dec 2000 17:53:38 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js - css - html - DreamWeaver
Message-Id: <g2bd3ts0l3j6kehgoaiu6kfjdv2ajguco7@4ax.com>
On 12 Dec 2000 21:49:32 GMT, kevin metcalf
<xzrgpnys@yvtugubhfrovm.pbz> wrote wonderful things about sparkplugs:
>Unbelievably, Telecommuter@Visto.com wrote:
>> ***** ON A SCALE FROM 1 - 10 PERL must be 10 *****
>> ***** ON A SCALE FROM 1 - 10 NT4.0 ISS SERVER = 10 ***
What the Hell is ISS? I have to give myself a 1.
>> $15.00 to $25.00 per hour commensurate with experience.
>
>Is it just me or is this person suffering from a sever lack of the
>reality gene?
lmoran@wtsg.com
print "\x{263a}"
------------------------------
Date: 12 Dec 2000 18:03:52 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js - css - html - DreamWeaver
Message-Id: <m3u289dyxz.fsf@mumonkan.sunstarsys.com>
Lou Moran <lmoran@wtsg.com> writes:
> On 12 Dec 2000 21:49:32 GMT, kevin metcalf
> <xzrgpnys@yvtugubhfrovm.pbz> wrote wonderful things about sparkplugs:
>
> >Unbelievably, Telecommuter@Visto.com wrote:
> >> ***** ON A SCALE FROM 1 - 10 PERL must be 10 *****
> >> ***** ON A SCALE FROM 1 - 10 NT4.0 ISS SERVER = 10 ***
>
> What the Hell is ISS? I have to give myself a 1.
>
Imperial Sucking Sound.
--
Joe Schaefer
------------------------------
Date: 12 Dec 2000 21:49:32 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: ON - INTERNET TELE COMMUTE ONLY - PERL - Java - Js - css - html - DreamWeaver
Message-Id: <3A369DFA.D00AA4B@yvtugubhfrovm.pbz>
Unbelievably, Telecommuter@Visto.com wrote:
> ***** ON A SCALE FROM 1 - 10 PERL must be 10 *****
> ***** ON A SCALE FROM 1 - 10 NT4.0 ISS SERVER = 10 ***
> $15.00 to $25.00 per hour commensurate with experience.
Is it just me or is this person suffering from a sever lack of the
reality gene?
--
Kevin Metcalf
(Carbon Ocelot)
email: xzrgpnys@yvtugubhfrovm.pbz
Huh? http://www.flactem.com/utils/rot13.html
------------------------------
Date: Tue, 12 Dec 2000 22:32:41 GMT
From: "EM" <me@privacy.net>
Subject: output file to browser?
Message-Id: <dIxZ5.8701$Nw6.28919@news.iol.ie>
currently i use this code to output a file to the browser
copy("file.zip",\*STDOUT);
this works great but what if i dont want to output the entire file?
how do i only output specified bytes like 100000 to 10000000
how do i do this without first loading the file into memory?
--------------
Eric
------------------------------
Date: Tue, 12 Dec 2000 14:51:00 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: output file to browser?
Message-Id: <mbudash-1581D2.14510012122000@news.pacbell.net>
In article <dIxZ5.8701$Nw6.28919@news.iol.ie>, "EM" <me@privacy.net>
wrote:
> currently i use this code to output a file to the browser
> copy("file.zip",\*STDOUT);
>
> this works great but what if i dont want to output the entire file?
> how do i only output specified bytes like 100000 to 10000000
> how do i do this without first loading the file into memory?
>
> --------------
> Eric
>
>
perldoc -f open
perldoc -f seek
perldoc -f read
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 12 Dec 2000 21:54:53 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: Passing parameter to CGI in webpage link
Message-Id: <3A369F3C.1D99C51E@yvtugubhfrovm.pbz>
Paula Powell Sapienza wrote:
> How does one pass a command-line (or otherwise) parameter to a Perl
> script? Say, from a link in a webpage? (i.e., <a href="mything.cgi?4">)
Um, you mean like this?
<html><head><title>=test</title></head><body>
<a href="mything.cgi&theparameter=1">Click here for One!</a><br>
<a href="mything.cgi&theparameter=2">Click here for Two!</a><br>
<a href="mything.cgi&theparameter=3">Click here for Three!</a><br>
<a href="mything.cgi&theparameter=4">Click here for Four!</a>
</body></html>
Then you just parse it out using the right pm and you say:
if ($contents{theparameter}==1) {
}
elsif ($contents{theparameter==2}) {
}
...
--
Kevin Metcalf
(Carbon Ocelot)
email: xzrgpnys@yvtugubhfrovm.pbz
Huh? http://www.flactem.com/utils/rot13.html
------------------------------
Date: 12 Dec 2000 15:25:19 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Perl 5.6, Regexp, performance problems
Message-Id: <m33dftfkuo.fsf@mumonkan.sunstarsys.com>
logan@cs.utexas.edu (Logan Shaw) writes:
> In article <915cvh$5t9$1@News.Dal.Ca>,
> <hume.spamfilter@bofh.halifax.ns.ca> wrote:
> >
> >My code does something like this:
> >
> > load config file
> > for every regexp in config file
> > store qr/$pattern/ in object
> > end for
> > for every line in the file
> > for every regexp configured for this file
> > if line =~ object->pattern
> > count, next line
> > end if
> > end for
> >
> > flag unmatched line
> > end for
>
> What you're doing sounds like about the best way to structure
> such a thing, assuming you're going to use a bunch of regular
> expressions.
I'm not familiar with 'the Regexp module', but I think it
might help if you store your qr/$pattern/ 's into an array.
Then the inner loop would look like
for (my $n = 0; $n < @regexp; ++$n) {
if ($line =~ $regexp[$n]) { #count, next line }
}
that converts method calls (object->pattern) to array entry
lookups, which should be faster. You might also experiment
with hashes also.
YMMV
--
Joe Schaefer
------------------------------
Date: Tue, 12 Dec 2000 21:06:31 GMT
From: guthrie_linck@my-deja.com
Subject: Re: Perl 5.6, Regexp, performance problems
Message-Id: <91640h$370$1@nnrp1.deja.com>
what i think you need to do is build up a code in a string of
all the regular expressions that you want to match. i think the big
performace hit here is coming from the fact that it has to recompile the
regular expressions each time. i wouldn't use the Regexp module. i've
never used it and i think the core regexp support is all you need.
generate an anonymous subroutine ref:
use $_ to contain each input line.
in a foreach loop $_ is a REF to the current item. if you don't
use $_, it will have to make a private copy of each item, you don't
really need that and it slows things down.
ie, something like this,
# this must go before the following eval()....
my $count = 0;
my $f;
my $s = 'sub { if (';
foreach (@regexp) {
$s.= "/$_/ or ";
}
substr($s, -4) = ') { $count++ }';
# you could put other code in here as well, instead of just a count....
$s .= '}';
defined ($f = eval $s)
or die "bad. wierd....\n";
foreach (<INFILE>) {
&$f;
}
print "count=$count\n";
i'm pretty sure this will cause a very large speedup.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 12 Dec 2000 21:05:09 GMT
From: Sangam <mysangam@my-deja.com>
Subject: Perl Training
Message-Id: <9163tv$2vd$1@nnrp1.deja.com>
I am looking for advanced perl programming training class in NJ area.
Please let me know, if anyone is aware.
Thanks
--
.
.
.
Sangam
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 12 Dec 2000 12:53:35 -0800
From: "Soumen Das" <soumen.das@cp.net>
Subject: Perl XS problems
Message-Id: <t3d47e4i7s4k12@corp.supernews.com>
The two problems that I have is as follows ..
1. Constants
I am trying to Perl wrap this API. [const wchar_t* ErrorString(long hr)]
My XS code looks like this ..
const wchar_t*
MDS_ErrorString(hr)
long hr
CODE :
RETVAL = MDS_ErrorString(hr);
OUTPUT :
RETVAL
My typemap is :
const wchar_t* T_PV
While compiling I do get the following error. I am using the Sun's CC
compiler.
"XSConfig.c", line 59: Error: Formal argument ptr of type const char* in
call to Perl_sv_setpv(sv*, const char*) is being passed const wchar_t*.
What am I doing wrong ? Is there a special way to deal with constants ?
2. The second problem with MakeMaker is that I am not able to link with the
.a files. How do I do this ? I tried to use depends as follows :
'depend' => {'blib/arch/auto/WrapConfig/WrapConfig.so' =>
'../../../unixshared/lib/sparc/nplexlib.a
../../../unixshared/lib/sparc/mdes.a
../../../unixshared/lib/sparc/TestToolSupport.a
../../../unixshared/lib/sparc/libdb.a'},
This does not seem to make an effect. I had to manually go and edit the link
line. Any ideas how could I influence MakeMaker to link to .a files ?
any help is appreciated. Thanks in advance.
Regards,
Soumen
------------------------------
Date: 12 Dec 2000 22:36:42 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91699q$g62$1@riva.ucam.org>
Tad McClellan <tadmc@metronet.com> wrote:
>You can ask perl itself to help you find common programming mistakes
>by doing two things: enable warnings (perldoc warnings) and enable
>"strict"ures (perldoc strict).
Maybe a Perl 5.005-friendly description would be helpful here:
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings, or perl -w)
and enable "strict"ures (perldoc strict).
--
Colin Watson [cjw44@flatline.org.uk]
If I had mayonnaise I'd be dangerous.
------------------------------
Date: 12 Dec 2000 17:53:17 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <m3y9xldzfm.fsf@mumonkan.sunstarsys.com>
cjw44@flatline.org.uk (Colin Watson) writes:
> Tad McClellan <tadmc@metronet.com> wrote:
> >You can ask perl itself to help you find common programming mistakes
> >by doing two things: enable warnings (perldoc warnings) and enable
> >"strict"ures (perldoc strict).
>
> Maybe a Perl 5.005-friendly description would be helpful here:
>
> You can ask perl itself to help you find common programming mistakes
> by doing two things: enable warnings (perldoc warnings, or perl -w)
> and enable "strict"ures (perldoc strict).
Better still:
Welcome to comp.lang.perl -w.misc.
...
You can ask perl -w itself to help you shoot yourself in the foot
by doing two things: disable warnings (perldoc warnings, or a
4-letter invocation) and disable "strict"ures (perldoc strict,
or remove "use strict;" from the top of your program). However,
posting your (self-inflicted) problems to comp.lang.perl -w.misc
would be highly inappropriate in such cases.
--
Joe Schaefer
------------------------------
Date: Tue, 12 Dec 2000 22:12:22 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Problem using Image::Size on a webserver
Message-Id: <4a2bf0ff5eg.soper@soundhouse.co.uk>
I wish to use the module Image::Size in a script running on a remote
webserver. On this server I only have access to my filespace and a
cgi-bin. I have a directory called 'required' in the cgi-bin where I keep
libraries and such that are used by my scripts. In this I created a
directory called 'Image' and into this put the file Size.pm.
Now when I run the program below I get the error (through Carp):
Size.pm: Can't locate Image/Size.pm in @INC (@INC
contains: /usr/lib/perl5/i386-linux /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
admin.cgi
line 23. BEGIN failed--compilation aborted at admin.cgi line 23.
Now why isn't the path '/home/soundh/cgi-bin/required' in that array? I
know it does get added at some point as it finds my libraries in that
directory. Does it look at the use statements before doing anything else?
If that's the case how can I use that module without proper access to the
server's Perl installation?
Many thanks
Top of script:
#!/usr/bin/perl -w
$require_dir = '/home/soundh/cgi-bin/required';
if ($require_dir ne '') {
push(@INC, $require_dir);
}
require '../settings.pl';
require 'chkemail.pl';
require 'sendmail.pl';
require 'new_template.pl';
require 'gs_database.pl';
require 'gs_general.pl';
require 'gs_news.pl';
use strict;
use CGI qw(:standard);
use Fcntl qw(:DEFAULT :flock);
use POSIX qw(:errno_h);
use Time::Local;
use CGI::Carp qw(fatalsToBrowser);
use Image::Size;
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Tue, 12 Dec 2000 22:07:53 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Ready Made Form Data?
Message-Id: <9167ji$6h0$1@nnrp1.deja.com>
Hello,
I need to take data from a form (data see below) I have below and send
it to a perl script that would write it to a mysql database.
I am not sure how to separate the data sent in the form - and send it
to each table. Basically I just want the data in the form to send the
data to the
database. Each field is a table.
So how do I separate them? I think I can handle writing and retrieving
the data. I mean I hope I can! I want to use the Post method as that
seems
safer. Can I ensure the data is only numbers text plus an '@', '.','-'
symbols?
Thanks!
V
Data:
http://www.xxx.com/database/test/?=555&=444&=4444&=222&=555&=5555&first_
name=test%40test.com&first_name=x&last_name=x&street_1=x&city=x&select_s
tate=Louisiana&state=x&zip=12345&country=United+States&flags1=1&birth_da
te_mon=12&birth_date_day=19&birth_date_year=1981&Sex=0&Marital=S&Continu
e=Sign+Me+Up%21
--
He who fights and runs away, lives to run another day!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 12 Dec 2000 21:55:01 GMT
From: root <jagman98@home.com>
Subject: scan and read mails from /var/mail
Message-Id: <3A36A115.7D8149BD@home.com>
How can I scan and read mails using perl from /var/mail. Thanks in
Advance.
------------------------------
Date: Tue, 12 Dec 2000 14:50:29 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: srand() for CGI
Message-Id: <slrn93d3sl.p9.tadmc@maxim.metronet.com>
sluppy <sluppy@my-deja.com> wrote:
>I'm assuming
Why are you doing that?
>that srand() is equivalent to srand(time)
perldoc -f srand
says what srand() is equivalent to, and it isn't what you
have guessed.
Don't guess. Look it up and *know*.
>which AFAIK
You will K more if you can be bothered to read the documentation
for the functions that you use.
>doesn't get any finer than the current second.
>
>So... I assume that two visitors to my web site during the exact same
>second would be issued the exact same session ID. (This, of course,
>would be bad.)
So don't generate the ID the way you are generating the ID.
>Is there a way I can minimize the possibility of two or more visitors
>to the web site getting the same random result?
Yes.
>Thanks!
Yeah right.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Dec 2000 17:21:46 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Tabs and the M^ thing...
Message-Id: <jm6d3t8uvf8ffibikrqlqvn6leqgrh9vo7@4ax.com>
--I would like to remove tab spaces and the DOS generated M^ (which I
think is some sort of carriage return) from some files. (oddly,
specifically, perl stuff I wrote on the WIN32 side of my laptop
partition.)
--I looked in perlfaq 4 (Data Manipulation) but I didn't see anything
that addressed these situations. (Or that looked very much like these
situations)
--any ideas?
lmoran@wtsg.com
print "\x{263a}"
------------------------------
Date: Tue, 12 Dec 2000 22:49:10 GMT
From: guthrie_linck@my-deja.com
Subject: Re: Tabs and the M^ thing...
Message-Id: <916a13$8n8$1@nnrp1.deja.com>
yes,
if you have the program "dos2unix" it does exactly that.
else you just want to:
perl -pn -e 's/^M//g' FILENAME
you have to capture that control character somehow.
the `^M' has to be produced by pressing `Ctrl-V Ctrl-M' in vi, or
`Ctrl-QCtrl-M' in emacs.
In article <jm6d3t8uvf8ffibikrqlqvn6leqgrh9vo7@4ax.com>,
Lou Moran <lmoran@wtsg.com> wrote:
> --I would like to remove tab spaces and the DOS generated M^ (which I
> think is some sort of carriage return) from some files. (oddly,
> specifically, perl stuff I wrote on the WIN32 side of my laptop
> partition.)
>
> --I looked in perlfaq 4 (Data Manipulation) but I didn't see anything
> that addressed these situations. (Or that looked very much like these
> situations)
>
> --any ideas?
>
> lmoran@wtsg.com
> print "\x{263a}"
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 12 Dec 2000 19:12:40 -0000
From: "Dizer" <dizer@eircom.net>
Subject: TTY list
Message-Id: <T1vZ5.5312$Er5.3254@news.indigo.ie>
Hey there,
I'm running perl scripts, and I want to get a list of all the users logged
in now, and their tty(s). I looked up perlfunc but couldn't find anything.
Then I thought I'd check some C and system calls, I found the
getut* commands.
But in perl I can only find the
getpw* commands which list users on the passwd file, rather than those
logged in.
I can get a list using `ps -ao user,tt` but thats vile and disgusting :)
Any ideas as to how to get the users logged on AND their tty(s). Many
thanks,
Dizer.
------------------------------
Date: Tue, 12 Dec 2000 20:01:57 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: TTY list
Message-Id: <3A3687B4.EC45416B@home.com>
[posted & mailed, silly and dead removed]
Dizer wrote:
>
> Any ideas as to how to get the users logged on AND their tty(s). Many
> thanks,
`who`;
There is no builtin function to do this but there is probably a module
on CPAN.
http://search.cpan.org/
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 12 Dec 2000 20:22:54 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: TTY list
Message-Id: <9161eu$1mpo$1@nntp1.ba.best.com>
In article <T1vZ5.5312$Er5.3254@news.indigo.ie>,
Dizer <dizer@eircom.net> wrote:
>Hey there,
>I'm running perl scripts, and I want to get a list of all the users logged
>in now, and their tty(s). I looked up perlfunc but couldn't find anything.
Because it is not in the core of perl. You will probably need to use an
external command.
@info = `who`;
print "Users currently logged in:\n",@info;
It's much easier than trying to parse /etc/utmp and/or /var/adm/wtmp yourself.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Tue, 12 Dec 2000 21:01:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: TTY list
Message-Id: <3A3692BC.BE9BE776@acm.org>
Dizer wrote:
>
> Hey there,
> I'm running perl scripts, and I want to get a list of all the users logged
> in now, and their tty(s). I looked up perlfunc but couldn't find anything.
> Then I thought I'd check some C and system calls, I found the
man finger
man who
man last
John
------------------------------
Date: 12 Dec 2000 21:39:06 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: TTY list
Message-Id: <3A369B88.75361BB6@yvtugubhfrovm.pbz>
Dizer wrote:
> Any ideas as to how to get the users logged on AND their tty(s). Many
> thanks,
Here's a program that I wrote that searches for a particular user in a
list of all users then 'rings' them. I wrote it to talk to
automatically get someone's attention when I was at console and they
were idle. I'm sure you can see how to modify it for your own use. And
yes, you gurus out there can correct my script if you wish.
#!/usr/bin/perl -w
# First make sure the user knows what this program is designed to do...
unless (@ARGV==0) {
$ringwho = shift @ARGV;
$number = shift @ARGV;
chomp ($whoami =`whoami`);
chomp ($who = `/usr/bin/who -T`);
@wholist = split /\n/, $who;
$location='FALSE';
foreach $person (@wholist) {
$person =~ s/(\s{2,})/\t/g;
@whoargs=split /(\t)+/, $person;
if ($whoargs[0] eq $ringwho) {
$location = $whoargs[4];
}
}
if (!($location eq 'FALSE')) {
# SET THE NUMBER OF TIMES TO RING...
if (!($number >= 1)) {
$num_rings=3;
}
else {
$num_rings=$number;
}
$curr_rings=1;
print "Ringing Your party ($num_rings times.)\n";
`echo -en '\n$whoami is paging you ($num_rings times).\nRespond "talk
root" ' >$
# GET CURRENT SECOND COUNT.
while ($num_rings >= $curr_rings){
$curr_sec = `date +%s`;
$finished='FALSE';
while ($finished eq 'FALSE') {
$new_sec = `date +%s`;
if (($new_sec) >= ($curr_sec + 1)) {
$finished='TRUE';
$curr_rings++;
}
}
`echo -en '.\a' > /dev/$location`;
}
print "\n";
`echo -e '\n'`;
}
else {
print "Sorry, it does not appear $ringwho is logged in.
Terminating...\n";
}
}
# If they don't print the error message:
else {
print "\n\nUsage: $0 username [# of times (default 3)]\n\n";
}
--
Kevin Metcalf
(Carbon Ocelot)
email: xzrgpnys@yvtugubhfrovm.pbz
Huh? http://www.flactem.com/utils/rot13.html
------------------------------
Date: 12 Dec 2000 16:44:34 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <916682$3sd@junior.apk.net>
Massive cross-posting. I detect a troll.
In article <3A2E6155.C2273626@yahoo.com>, Al Dev <alavoor@yahoo.com> wrote:
>Any suggestions on which runs faster - PERL or Java??
>Speed is more important (top priority)
If speed is your top priority, forget both. Lovingly hand-optimized
machine code is fastest of all.
By the way, there is no such thing as PERL. You may be thinking of
Perl or even perl.
But my main concern is that the way you phrase the question indicates
you don't know very much about either Perl or Java. I'm not optimistic
about your chances for a successful project if you're diving on something
that's performance-critical before you know what you're doing.
Have you considered learning one or both languages before making a
decision?
------------------------------
Date: 12 Dec 2000 14:00:33 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <m1k895711a.fsf@halfdome.holdit.com>
>>>>> "Mark" == Mark W Schumann <catfood@apk.net> writes:
Mark> If speed is your top priority, forget both. Lovingly hand-optimized
Mark> machine code is fastest of all.
No! If speed is your top priority, skip machine code. Go right to
microcode or hardwired logic!
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 12 Dec 2000 22:05:04 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <3A36A19E.A8247D0@yvtugubhfrovm.pbz>
"Randal L. Schwartz" wrote:
>
> >>>>> "Mark" == Mark W Schumann <catfood@apk.net> writes:
>
> Mark> If speed is your top priority, forget both. Lovingly hand-optimized
> Mark> machine code is fastest of all.
>
> No! If speed is your top priority, skip machine code. Go right to
> microcode or hardwired logic!
Yeah! Just get out your microscope and tweasers and "optimize" your
ALU! That would be LOTS faster! :)
--
Kevin Metcalf
(Carbon Ocelot)
email: xzrgpnys@yvtugubhfrovm.pbz
Huh? http://www.flactem.com/utils/rot13.html
------------------------------
Date: Tue, 12 Dec 2000 14:18:31 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: using s// on *()[]+ in perl regex
Message-Id: <slrn93d20n.p9.tadmc@maxim.metronet.com>
Andreas Burmester HG/EHS/FD <qhsand@ehpt.com> wrote:
>Sorry about the MIME, i tryed to remove it now.
It must be working, because I can see this post.
My news software autodeleted your MIME post (I assume it did
anyway, since I never saw it).
>Here's a sample of the sub that im using,
>
>Its used to take a tag (<foo>) and remove all tags inside it until it
^^^^^^^^^^^
>finds the endtag (</foo>).
There are no tags inside the <foo> tag. Tags cannot be nested.
The greater-than sign is the *end* of the tag.
A "nested tag" would be something like <foo <bar>>
*Elements* can be nested. "Tags" are merely delimiters for the element.
A "start tag" delimits the beginning of the element, an "end tag"
delimits the end of the element.
>$body_line is the current line my script is working with.
>
>sub intag {
> $intag_end = "0"; # has the end tag been found?
Using a string as a flag is a very strange thing to do.
$intag_end = 0; # works fine
Global variables are Very Bad. Every single variable in your
code is global! Hence your program is Very Bad. You should
fix that :-)
perldoc strict
perldoc -f my
> if($body_line =~ /<$tag>(.*)<\/$tag>/) {
^^
^^
Better make that a non-greedy match.
> $intag =~ s/<\w*>//g; # removes all start tags
That does not remove all start tags.
<a href="www.perl.com">
is an example of a tag that will not be removed by your code.
That removes things that are not tags at all.
<>
is an example of something that is not a tag, that will be removed
by your code.
$intag =~ s/<\/\w*>//g; # removes all end tags
That does not remove all end tags.
</foo >
is an example of an end tag that will not be removed by your code.
>unless($intag =~ /\+/ || $intag =~ /\*/ || $intag =~ /\[/ || $intag =~
>/\|/ || $intag =~ /\]/) {
> $body_line =~ s/$intag_old/$intag/;
>}
>
>, this is where i get the error if i remove the unless line.
I don't understand what you mean (but since you quote upside
down, I have no interest in trying to understand what you mean).
[ snip Jeopardy-quoted text ]
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Dec 2000 17:34:28 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Win32 User Account Management
Message-Id: <3A36A7F4.9ED98507@patriot.net>
You might consider using Win32::Lanman for user management, rather than
Win32API::Net...Lanman is much easier to use...
"B.A." wrote:
> I'm trying to learn Perl on a WinNT machine. I trying to follow the
> examples in the book, but I'm getting weird results. I'm not sure if
> I've done something wrong, or my machine is screwed up. I'm running this
> against a Win2K Server from a Win2K workstation. Here i the script that
> I used.
>
> use Win32API::Net;
>
> Win32API::Net::GetDCName(Win32::NodeName,Win32::DomainName,$server);
>
> Win32API::Net::UserGetInfo($server, Win32::LoginName($Userid),
> 10,\%user);
>
> print $user{fullName},"\n";
>
>
> I changed the userID but I still got the first username that I tried
> Why?
>
>
> I changed the user level to 1011, but no data was returned. Why?
>
> I also noticed that the hash names are weird, fullName instead of
> FullName...... Are they supposed to be case-sensitive, kinda backwards
> like that?
>
> Thanks
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Tue, 12 Dec 2000 19:31:41 GMT
From: ralphe142@my-deja.com
Subject: Win32/CGI question: "Running as" gets switched?
Message-Id: <915uet$u0g$1@nnrp1.deja.com>
I have an interesting little problem that I would
appreciate some help with, if anybody's in the
know...
I'm on ActiveState Perl on an NT server.
I've got a script that's working fine when run
from the command line on my web server. It's
calling an add-in module called Win32::PerfLib to
get performance statistics from a remote NT
Server machine. Like I say, it works fine when I
manually run "Perl.exe myscript.pl" from a
command prompt on the web server, logged in as me.
However, I'm trying to run this same script as a
CGI application in a web browser, and everything
works except the calls to Win32::PerfLib
functions to a remote machine. If I specify the
local machine name (i.e. the web server), I get
the perf stats just fine, no problem. But when I
specify a remote machine, it fails every time.
It's something to do with security, but...
Funny thing is, I checked who is logged in during
runtime, using the Win32::LoginName() call, and
it's my account -- the same account that works
when running from the command prompt (we're not
allowing anonymous access on our IIS server, so
IUSR is not in the picture.) I also put a delay
in my script, checked the Perl.exe process that
got launched using PVIEW.EXE, and it is also
running under my account.
However, turning auditing on reveals that
additional processes of Perl.exe are being
launched under the SYSTEM account, which I
presume are due to the calls to Win32::PerfLib.
I realize the SYSTEM account doesn't have the
necessary network privileges to do remote network
stuff, hence the failure is understandable.
My question is, why is a script that's clearly
running as me, apparently launching another
process as SYSTEM when I make the Win32::PerfLib
calls? And is there anyway to stop this from
happening?
Thanks,
Ralph Edington
ralphe@mitchell.com
Sent via Deja.com
http://www.deja.com/
------------------------------
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 5093
**************************************