[12517] in Perl-Users-Digest
Perl-Users Digest, Issue: 6117 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 24 12:07:23 1999
Date: Thu, 24 Jun 99 09:00:21 -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 Thu, 24 Jun 1999 Volume: 8 Number: 6117
Today's topics:
'ucfirst' for a sentence? bing-du@tamu.edu
Re: A foreach question (Larry Rosler)
Re: accessing a character in a string <dgrisinger@exactis.com>
Re: accessing a character in a string <gellyfish@gellyfish.com>
Re: accessing a character in a string <fake@nospam.edu>
Attaching a file with a form pyammine@my-deja.com
Re: Can I do this? Conditional Operator construct.... (Larry Rosler)
Copying files and directories gershon_joseph@icomverse.com
Re: deleting whitespace (Larry Rosler)
Re: deleting whitespace (Marc Bissonnette)
garbage collector vijoc@my-deja.com
gathering output from program amidalla@my-deja.com
Good engine to find special project info jeffusa@my-deja.com
HELP! Runtime Exception Error rburghardt@juno.com
HELP! Runtime Exception Error rburghardt@juno.com
Re: How can I read a whole file in one go ? (Larry Rosler)
how to read die "Error:..." <wolfgang.goetzinger@siemens.at>
how to remove \n from middle of variable <aardvark@ibm.net>
Perl Distribution & Runtime <jalil@corp.home.net>
Read a file starting a a certain point in the middle (Mesarchm)
Re: Repettive Text manipulation (Sean McAfee)
Re: Replacing i with e etc (Larry Rosler)
Running ActiveState Installed on NT Workstation in othe <saarg@bigfoot.com>
Re: Safe expression evaluation <Marcel.vdLaan@ehv.sc.philips.com>
Re: Safe expression evaluation <tchrist@mox.perl.com>
Re: time question (Paul David Fardy)
Re: Where is sendmail on NT using Perl <tstaals@eurovos.com>
Re: Where is sendmail on NT using Perl <gellyfish@gellyfish.com>
Re: Writing to a terminal from a perl script <dbane@shannon.tellabs.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 24 Jun 1999 15:37:15 GMT
From: bing-du@tamu.edu
Subject: 'ucfirst' for a sentence?
Message-Id: <7ktjb9$904$1@nnrp1.deja.com>
Hello,
Let's say there is a sentence "deja news is helpful".
Instead of 'split' the sentence first, then 'ucfirst' each word,
Any other better way to convert the sentence to:
"Deja News Is Helpful"?
Thanks in advance for your help,
Bing
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 07:47:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: A foreach question
Message-Id: <MPG.11dbe4b8d5f599d8989c3c@nntp.hpl.hp.com>
In article <7ktamq$5dn$1@coranto.ucs.mun.ca> on 24 Jun 1999 13:09:45
GMT, Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
> Different semantics: this one may match baz on consecutive lines.
>
> #!/local/bin/perl -w
> use strict;
>
> my $foo;
> while (<DATA>) {
> chomp;
> $foo and /baz/ and printf "%3d: Matched baz in \"%s\"\n", $., $_;
> $foo = /foo/;
> }
That is a nifty way to set the state flag, which I mentioned in my first
posting was necessary to run this code off an array instead of a file.
Which your version does, and mine doesn't.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 24 Jun 1999 08:34:25 -0600
From: Daniel Grisinger <dgrisinger@exactis.com>
Subject: Re: accessing a character in a string
Message-Id: <m3ogi5651q.fsf@dhcp70.corp.merc.com>
"Ariel" <fake@nospam.edu> writes:
> I have a fake email address to keep from getting spammed (just yesterday I
> had to close one of my email accounts due to the incredible amount of spam I
> was getting.)
I don't believe this.
I'd wager that I post publically a lot more often than most address
mungers and that my mail address appears on a far larger number of
websites where it can be picked up by address harvesters than the
average munger, yet I consider it a bad week if I see 3 pieces of
spam in my inbox. (I don't count the number of messages thrown
away by sendmail, procmail, or gnus- it may be much higher.)
Perhaps you should invest some time in writing a decent set of
filters for yourself.
dgris
--
Daniel Grisinger dgrisinger@exactis.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 24 Jun 1999 16:13:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: accessing a character in a string
Message-Id: <37724b1e@newsread3.dircon.co.uk>
David Cassell <cassell@mail.cor.epa.gov> wrote:
>
> Besides, it's more fun to sleuth out the spammers and report
> them to their ISP's so they can be evicted and humiliated.
>
And put their addresses on web pages so they can spam each other ...
> And you just missed the Spam Cookoff at the Manly Man Festival
> in Roslyn WA. Perhaps someday they'll grill Stanford Wallace.
I though that spamford had recanted ...
/J\
--
"I must call a man in - I want to get felt laid down in the loft" -
Graham Norton
------------------------------
Date: Thu, 24 Jun 1999 08:05:03 -0700
From: "Ariel" <fake@nospam.edu>
Subject: Re: accessing a character in a string
Message-Id: <7kthdf$mhl@news.or.intel.com>
Daniel Grisinger wrote in message ...
>"Ariel" <fake@nospam.edu> writes:
>
>> I have a fake email address to keep from getting spammed (just yesterday
I
>> had to close one of my email accounts due to the incredible amount of
spam I
>> was getting.)
>
>I don't believe this.
Believe it!
>
>I'd wager that I post publically a lot more often than most address
>mungers and that my mail address appears on a far larger number of
>websites where it can be picked up by address harvesters than the
>average munger, yet I consider it a bad week if I see 3 pieces of
>spam in my inbox. (I don't count the number of messages thrown
>away by sendmail, procmail, or gnus- it may be much higher.)
>
>Perhaps you should invest some time in writing a decent set of
>filters for yourself.
>
Hotmail (where my now-closed email account was on) doesn't let you have your
own (customized) filters. It only lets you block specific senders or
specific domains. For example, It wouldn't let me filter out anyone that had
a 6-digit number (or larger) in their email address. I was getting spammed
from several random addresses using domains like mindspring, hotmail,
prodigy, usa.net, typically with an email address like
<name>34456690@<domain>.com..so it wasn't one specific address that I could
block. I have reported the spam to a few of the ISPs but the spam kept
coming, on average about 5 messages a day.
Anita
arielle7@uclink4.berkeley.edu
------------------------------
Date: Thu, 24 Jun 1999 15:38:56 GMT
From: pyammine@my-deja.com
Subject: Attaching a file with a form
Message-Id: <7ktjed$91d$1@nnrp1.deja.com>
Is it possible with Perl to attach a file (i.e. a Word file) to a form
and save it when submitting?
I know how to upload a file name
<input type="file" etc...> using HTML tags but how do you take that
file and path and have it uploaded into the server?
I would appreciate any help in this area.
Pascal
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 07:06:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can I do this? Conditional Operator construct....
Message-Id: <MPG.11dbdb454f44b33b989c39@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <3772288e@cs.colorado.edu> on 24 Jun 1999 06:46:06 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> lr@hpl.hp.com (Larry Rosler) writes:
> :I believe there is a compiler bug lurking here. If I understand it, the
> :grammar is:
> :
> : EXPR ? EXPR : EXPR
> :
> :and the precedences are such that the inner EXPR can be *anything*. It
> :works for a single assignment, though '=' has lower precedence than '?
> ::'. So why shouldn't it work for ',' also???
>
> It does not work for single assigment.
Oh yes it does work. It is correct and consistent syntactically and
semantically.
> Because this operator produces an assignable result, using assignments
> without parentheses will get you in trouble. For example, this:
<SNIP> of the dangers of under-parenthesizing the third expression.
All true indeed, but leading to a peculiar definition of 'does not work'
-- 'hazardous in the hands of the unwary', which would apply to a great
deal of Perl, wouldn't it?
So you haven't answered the question -- why does the precedence
hierarchy in the second expression work through '=' but fail for ','?
It's damned hard to find a bug in the Perl compiler nowadays; but why
not acknowledge one if it is there, instead of hand-waving "But you
wouldn't want to do that anyway."?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Jun 1999 14:40:59 GMT
From: gershon_joseph@icomverse.com
Subject: Copying files and directories
Message-Id: <7ktg1p$7ja$1@nnrp1.deja.com>
Hello,
I am writing a Perl program to copy directories and files from our
development server to our web server. I have checked the built-in
Perl functions in the books "Perl in a Nutshell" and "Learning Perl" and
have not found an efficient way to do this. Is there a function(s) to do
this without reading the file and writing it out again? Some of these
files are binary files, which I would rather not read.
Thanks in advance for the help.
Gershon.
--
Gershon Leib Joseph
DOCUMENTATION TECHNOLOGIES MANAGER
Comverse Network Systems
email: gershon_joseph@icomverse.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 07:36:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: deleting whitespace
Message-Id: <MPG.11dbe246be4d110c989c3b@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <XIqc3.19806$5a.25979@news20.bellglobal.com> on Thu, 24 Jun
1999 13:50:47 GMT, Marc Bissonnette <dragnet@internalysis.com> says...
> In article <MPG.11dacf91634a4fdf989c34@nntp.hpl.hp.com>, lr@hpl.hp.com says...
> >That deletes the first space character only.
> >
> >Why not let perlre and the FAQ answer the question, as three other
> >people have already suggested?
>
> Rats! Should have been $line =~ s/ //g;
...
> Since I figured there was a question I could finally return the favour for, I
> posted the answer (flawed though it was - next time I'll double check my answer
> through the docs :) :)
Not enough. You should also double check your answer by testing it.
> I did learn, eventually, that the FAQ's are faster than posting, for the simple
> stuff and actually have the FAQ's on my HD as a shortcut in my browser (no
> excuse not to use em now :)
That's one of the gracious things that ActivePerl sets up for you, if
you are *fortunate* enough to be able to install perl on your Windows PC
(whether or not you actually use it there :-).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Jun 1999 14:56:51 GMT
From: dragnet@internalysis.com (Marc Bissonnette)
Subject: Re: deleting whitespace
Message-Id: <TGrc3.19841$5a.25617@news20.bellglobal.com>
In article <MPG.11dbe246be4d110c989c3b@nntp.hpl.hp.com>, lr@hpl.hp.com says...
>
>> - next time I'll double check my answer
>> through the docs :) :)
>
>Not enough. You should also double check your answer by testing it.
Point taken, will do :)
>That's one of the gracious things that ActivePerl sets up for you, if
>you are *fortunate* enough to be able to install perl on your Windows PC
>(whether or not you actually use it there :-).
Are you kidding? Since I do a lot of (boring) HTML stuff, along with Perl for
my clients, Perl has saved quite literally hundreds of hours by allowing me to
do repetitive tasks and mass document conversions on my PC :)
Now, if I could only understand fully Hashes of Hashes, I'd be rocking :)
--
----------------------------
Marc Bissonnette
InternAlysis
Corporate Internet Research and Results!
http://www.internalysis.com
------------------------------
Date: Thu, 24 Jun 1999 15:42:01 GMT
From: vijoc@my-deja.com
Subject: garbage collector
Message-Id: <7ktjk5$94l$1@nnrp1.deja.com>
Is the perl garbage collector going to change
anytime soon?
tia,
vijo.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 15:35:52 GMT
From: amidalla@my-deja.com
Subject: gathering output from program
Message-Id: <7ktj8n$8ve$1@nnrp1.deja.com>
I'm trying to gather output like this..
open(README, "looper.exe -URTS_DEBUG=quit |")
or die "Cant run program: $!\n";
while(README) {
$output .= $_;
}
close (README);
why doesn't this work??
my ultimate goal is to see if the process (looper.exe) has run to
completion. I use Win32::Process::Create to start the process, but I
can't seem to get different exit code for a process that is terminated
via the $ProcessObj->Kill function as opposed to a proper exit due to
the process successfully ending.
I was looking at the Expect module but couldn't get it in a windows
format. Thanks for any help..
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 15:33:37 GMT
From: jeffusa@my-deja.com
Subject: Good engine to find special project info
Message-Id: <7ktj4g$8ss$1@nnrp1.deja.com>
Hey
I tried the new FindItFoundIt! search engine when I was
trying to locate some unique scripts I needed when putting
together a self-replicating site. It found what I was
looking for. It's at http://www.finditfoundit.com
I tried it after seeing stuff about it in the Warriors column and
egroups.com. It seems pretty neat. Pretty funny too.
This is the egroups.com mesage:
Subject: Get Listed First!
From: Shannan Hearne@sra-charlotte.com
Wanted to quickly tell you all about a new search engine, FindIt
FoundIt. Go ahead and submit
your site for indexing so you'll be listed quickly!
http://www.FindItFoundIt.com
Shannan Hearne
Success Promotions Building Your Business Better
http://www.successpromotions.com
This is the warriors:
Try FindItFoundIt! located at:
http://www.FindItFoundIt.com
They are the internet's newest big-time engine,
and may have what you are looking for.
I use it all the time now. It's easier to
use than the others.
Marty
Email the author (5star@n2software.com)
Read the article that started this thread.
You never know, it could be the next yahoo.
cgiJeff
--------------------------------
Join CAUCE http://www.cauce.org
--------------------------------
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 14:29:31 GMT
From: rburghardt@juno.com
Subject: HELP! Runtime Exception Error
Message-Id: <7ktfbr$7a3$1@nnrp1.deja.com>
I have a perl script sitting on a network server. The script connects
to a SQL database via ODBC. When run from machine A (using perl s:
\perl\.....\myscript.pl) it works perfectly! However, when run from
machine B (using the same command), I get "Error: Runtime exception" on
a call to ODBCConnect().
Unfortunately, I cannot compare the two machines very well b/c the one
that does not work is here with me on Long Island and the other is in
Boston.
It must have something to do with the perl setup on my NT machine here,
right?
I am desperate for any solution here -- any help would be greatly
appreciated!
Thank you.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 14:29:26 GMT
From: rburghardt@juno.com
Subject: HELP! Runtime Exception Error
Message-Id: <7ktfbn$7a0$1@nnrp1.deja.com>
I have a perl script sitting on a network server. The script connects
to a SQL database via ODBC. When run from machine A (using perl s:
\perl\.....\myscript.pl) it works perfectly! However, when run from
machine B (using the same command), I get "Error: Runtime exception" on
a call to ODBCConnect().
Unfortunately, I cannot compare the two machines very well b/c the one
that does not work is here with me on Long Island and the other is in
Boston.
It must have something to do with the perl setup on my NT machine here,
right?
I am desperate for any solution here -- any help would be greatly
appreciated!
Thank you.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 24 Jun 1999 07:25:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I read a whole file in one go ?
Message-Id: <MPG.11dbdfc0ead5e00b989c3a@nntp.hpl.hp.com>
In article <slrn7n4ar3.el.mr@kells.kells> on 24 Jun 1999 12:51:46 GMT,
mr@kells.kells <mr@kells.kells> says...
> Here's a way. Read the entire file into a string and then split
> the string.
>
> {local $/; my $file = <INPUTFILE>; @records = split /\<c\>/, $file}
^ ^
useless noise
Here's a 'better' way. Set the $INPUT_RECORD_SEPARATOR to do all the
heavy work, instead of doing nothing as in your method.
{ local $/ = '<c>'; @records = <INPUTFILE> }
This works because the split is on a constant string, not on a regex.
Of course, now the '<c>' is at the end of each record but the last
(instead of being discarded by the 'split'), but that is easy to deal
with:
{ local $/ = '<c>'; chomp(@records = <INPUTFILE>) }
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Jun 1999 17:35:15 +0200
From: Wolfgang =?iso-8859-1?Q?G=F6tzinger?= <wolfgang.goetzinger@siemens.at>
Subject: how to read die "Error:..."
Message-Id: <37725033.B02C1E2@siemens.at>
Hi everybody!
i programmed a perl script that executes the program myProgr and reads
the stdout of myProgr in @output:
open OUTPUT,'myProgr|';
@output = <OUTPUT>;
close OUTPUT;
question: if myProgr dies with:
die "Error: blahblah...";
how can i read this errormessage in my perl script???????
(there is no usable value in $? and $!)
------------------------------
Date: Thu, 24 Jun 1999 10:53:40 -0400
From: David Barnes <aardvark@ibm.net>
Subject: how to remove \n from middle of variable
Message-Id: <37724674.2EC4964C@ibm.net>
I have a variable that holds multiple lines kind of like:
line one
line two
line three
I would like to remove the \n from the variable so that it holds
line one line two line three
using $variable =~ tr/\n/ /; gets rid of everything up to the last \n,
so my result is only
line three
which really confuses me. Thank you for any help.
------------------------------
Date: Thu, 24 Jun 1999 15:10:44 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Perl Distribution & Runtime
Message-Id: <930237044.367318@zeppelin.svr.home.net>
I was wondering:
1. Can Perl be used in commercial software? If so, how/where a license to do
so should be obtained?
2. Is there a way to make perl installers so that perl code and runtime get
installed on a target machine, especially windows?
Regards,
-Jalil
------------------------------
Date: 24 Jun 1999 15:34:01 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Read a file starting a a certain point in the middle
Message-Id: <19990624113401.22212.00000086@ng-cg1.aol.com>
I currently have a perl scripts that reads IIS logs and grabs specific
elements. However, this script will run against an entire directory of log
files. Because of this it needs to know if it already read a file, and if it
did pickup where it left off. I can not make any changes to the logs. Some of
these files are very large. Ranging from 100MB to GB's. Because of that I
need it to not read the file from the begging, but pick up from that
predetermined line.
If you can help it would be appreciated.
Thanks,
Mike
------------------------------
Date: Thu, 24 Jun 1999 15:27:18 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Repettive Text manipulation
Message-Id: <q7sc3.105$q95.3253@news.itd.umich.edu>
In article <zRic3.763$MC6.4534@newsfeed.slurp.net>,
Timothy W. Valis <tvalis@intur.net> wrote:
>I have a fixed field text file streamed to tape from a mainframe. each
>record is 1545 bytes, each field is fixed in size (I have a field map, no
>problem here) but the file is one long line, no CR/LF between records, in
>fact, there are no record delimiters at all. I would like to use perl to
>insert a CR/LF every 1545 bytes. My problem is this is a single line file
>21 MB (Yes MegaBytes) in size. Any ideas?
Use some special magic of the $/ variable:
$/ = \1545;
while (<FILE>) {
print "$_\r\n";
}
A slightly different way that does it all in one fell swoop from the
command line:
perl -i.bak -pe 'BEGIN { $/ = \1545; $\ = "\r\n" }' big_honkin_file
See the perlvar man page for the full scoop on $/ (and $\).
--
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: Thu, 24 Jun 1999 07:54:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Replacing i with e etc
Message-Id: <MPG.11dbe6705df56490989c3d@nntp.hpl.hp.com>
In article <3772344b.0@145.227.194.253> on Thu, 24 Jun 1999 14:46:11
+0100, Your Name <Your.Name@icl.com> says...
> does anybody know of perl code to replace all characters with accents (e.g.
> i, s, h etc) with the standard a-z chars
It is a one-liner.
perldoc -f tr
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Jun 1999 16:40:20 +0200
From: "Saar Ginzburski" <saarg@bigfoot.com>
Subject: Running ActiveState Installed on NT Workstation in other Work Station.
Message-Id: <930235429.192810@soint2>
Hi,
I'm trying to install ActiveState Perl (517) on an NT workstation and using
it in other workstation. I have the PerlCRT dll in my path and I even tried
to edit the registry with the matching values but I keep getting the
message: "Error: Parse exception".
Maybe someone has an idea ? I know there is no problem doing it using the
standard Perl distribution.
Thanks In Advance,
Saar Ginzburski
Amdocs (Israel) Inc.
saarg@amdocs.com
------------------------------
Date: Thu, 24 Jun 1999 16:51:53 +0200
From: "Marcel van der Laan" <Marcel.vdLaan@ehv.sc.philips.com>
Subject: Re: Safe expression evaluation
Message-Id: <930235901.179378@dibbs3.eur.cis.philips.com>
Hello again,
Tom Christiansen wrote in message <376f79e2@cs.colorado.edu>...
> [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc,
> "Marcel van der Laan" <Marcel.vdLaan@ehv.sc.philips.com> writes:
>:I'd like to, but the whole mox.perl.com site seems to be down, from where
>:I'm at. Is it mirrored anywhere?
>
>Please try again.
>
Okay, the site worked, and I took a look at the code and how you use the
Safe module. But I can't for the life of me figure out when it does what.
What I'm looking for is something that will evaluate a condition, without it
evaluating system calls. So I use:
my $cpt = new Safe("Eval");
$cpt->permit_only(qw{:base_core});
But from there on I've tried just about everything, I guess. Well nearly
everything. How do I reval a piece of code that will evaluate all of these
expressions:
defined $var->{'x'}
$var->{'y'} =~ /letter/
$var->{'z'} + 3
Shouldn't ideally the $var be referenced when the evaluation is done, and
not when creating the code string, i.e.
'defined $var->{\'x\'}' as opposed to "defined $var->{'x'}"? Of course with
$cpt->share($var).
I've tried sharing a subroutine containing an eval(), then calling
&Root::<evalfunc> but this also does system() calls, which I don't want.
I realise this may all sound like garbage, but I've been going round in
circles for a while now and getting a tad dizzy! Please help me out if you
can. It would really be appreciated!
Thanks a lot
Marcel
------------------------------
Date: 24 Jun 1999 09:51:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Safe expression evaluation
Message-Id: <37725402@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Marcel van der Laan" <Marcel.vdLaan@ehv.sc.philips.com> writes:
:Okay, the site worked, and I took a look at the code and how you use the
:Safe module. But I can't for the life of me figure out when it does what.
This test code:
use Safe;
$| = 1;
my $DO_STRICT = 1;
my $box = new Safe("Eval");
$box->permit_only(qw{:base_core});
@codes = (
q{ $var->{'z'} = 12 },
q{ defined $var->{'z'} },
q{ $var = {} },
q{ $var->{'y'} =~ /letter/ },
q{ $var->{'z'} + 3 },
q{ unlink $fred },
q{ $var->{a}{b}{c} },
q{ while (1) { } },
q{ last },
q{ return },
q{ do 'grinch' },
q{ require Help },
);
for $code (@codes) {
$i++;
print "Running code #$i: $code\n\t";
$@ = '';
my $rv = $box->reval($code, $DO_STRICT);
if (!defined $rv && $@) {
print("SAFE TRAP: $@\n");
} else {
if (defined $rv) {
print qq(Retval = "$rv"\n\n);
} else {
print "Retval is <UNDEF>\n\n";
}
}
}
Produces this output. Some of it is suspect.
Running code #1: $var->{'z'} = 12
Global symbol "$var" requires explicit package name at (eval 2) line 1.
Retval is <UNDEF>
Running code #2: defined $var->{'z'}
Retval = ""
Running code #3: $var = {}
SAFE TRAP: anonymous hash trapped by operation mask at (eval 6) line 1.
Running code #4: $var->{'y'} =~ /letter/
Retval = ""
Running code #5: $var->{'z'} + 3
Retval = "3"
Running code #6: unlink $fred
Global symbol "$fred" requires explicit package name at (eval 12) line 2.
SAFE TRAP: unlink trapped by operation mask at (eval 12) line 2.
Running code #7: $var->{a}{b}{c}
Retval is <UNDEF>
Running code #8: while (1) { }
SAFE TRAP: loop exit trapped by operation mask at (eval 16) line 2.
Running code #9: last
SAFE TRAP: last trapped by operation mask at (eval 18) line 2.
Running code #10: return
Retval is <UNDEF>
Running code #11: do 'grinch'
SAFE TRAP: do 'file' trapped by operation mask at (eval 22) line 2.
Running code #12: require Help
SAFE TRAP: require trapped by operation mask at (eval 24) line 3.
--
If you want to see useful Perl examples, we can certainly arrange to have
comp.lang.misc flooded with them, but I don't think that would help the
advance of civilization. :-) --Larry Wall in <1992Mar5.180926.19041@netlabs.com>
------------------------------
Date: 24 Jun 1999 14:30:17 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: time question
Message-Id: <7ktfdp$jfc$1@coranto.ucs.mun.ca>
Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
>>>> Actually, time() gives me the number of seconds since 1969-12-31.
lr@hpl.hp.com (Larry Rosler) writes:
>>> Wrong. It is the number of seconds since 1970-01-01 00:00:00 UTC,
Paul David Fardy <pdf@morgan.ucs.mun.ca> says...
>> How is that different? Isn't 1970-01-01 00:00:00 UTC also 0 seconds
>> after 1969-12-31?
lr@hpl.hp.com (Larry Rosler) writes:
> As the most liberal possible representation in seconds of the
> incomplete specification 1969-12-31 is 1969-12-31 23:59:59,
> 1970-01-01 00:00:00 is at least one second after 1969-12-31.
> But as your interpretation of 1969-12-31 is some sort of abstract
> mathematical time continuum that becomes 1970-01-01, you are right
> too. Heh!
We agree on the core then, but ...
I don't think my interpretation is at all abstract. It's simply
real--in both a mathematical and practical sense. On the
other hand, I think the second you believe lies between
1969-12-31 and 1970-01-01 00:00:00 is imaginary.
What day is it one half second before 1970-01-01 00:00:00?
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: Thu, 24 Jun 1999 16:11:00 +0200
From: "Tom Staals" <tstaals@eurovos.com>
Subject: Re: Where is sendmail on NT using Perl
Message-Id: <7kte9k$jke$1@zonnetje.NL.net>
There is a sendmail port for windows nt.
Should find it on the ftp site of microsoft. I can't remember exactly were.
You maybe have to recompile it on your windows NT.
Your sincerely,
Tom Staals
David Cassell <cassell@mail.cor.epa.gov> schreef in berichtnieuws
375FF932.8DEBED1@mail.cor.epa.gov...
> RG wrote:
> >
> > My sysop is out of town , but is not real familiar with perl, and I need
> > to know where to point my formmail.pl script's tag to "sendmail" on the
> > NT server. I believe the right path would be d:/perl/lib/sendmail
>
> Umm, probably not. First, as two people have already pointed out,
> sendmail (while the de facto standard on unix) is not the usual
> mailer on NT boxes. There *may* be a sendmail program on your
> NT server (there are two versions I know of for NT, one of them
> by M$), but the mailer may be blat or wrmail or another choice.
> You have to find out from your sysop. You may want to read the
> ActivePerl FAQ which comes with ActiveState Perl. It has a
> section (section 5) titled "Windows 95/NT" which includes a
> detailed discussion on sending mail from NT.
>
> And second, I find it unlikely that a sysop would put a non-Perl
> system program like sendmail/whatever in a /perl/lib/...
> hierarchy. You have to find out from your sysop.
>
> Matt Wright's formmail.pl program was written assuming that
> your sysop would be running some flavor of unix. So the
> script may break in other places as well. _Caveat_utor_.
>
> > $mailprog="d://perl//lib//sendmail";
> > or
> > $mailprog="d:/perl/lib/sendmail";
>
> While the second may work (depending on the rest of the code),
> the first is unlikely to work anywhere. I think you meant
> something like "d:\\perl\\lib\\sendmail" .
>
> > Both of these do not work, as the form doesnt get sent to my email
> > address. I do not get an error message, though.
>
> The error messages may all be going to the server log.
>
> If your sysop is not using a standard sendmail, you may have
> to re-write some of the mailing code.. or ALL the mailing
> code. So read that section of the ActivePerl FAQ and study
> the examples therein.
>
> > Thanks in advance
>
> HTH,
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
------------------------------
Date: 24 Jun 1999 16:10:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where is sendmail on NT using Perl
Message-Id: <37724a70@newsread3.dircon.co.uk>
Tom Staals <tstaals@eurovos.com> wrote:
> There is a sendmail port for windows nt.
> Should find it on the ftp site of microsoft. I can't remember exactly were.
> You maybe have to recompile it on your windows NT.
>
Er that will be ...
<http://sunsite.doc.ic.ac.uk/packages/microsoft/developr/drg/UNIX-to-Windows/Ports/Sendmail/SM1121.ZIP>
And no you dont have to recompile it ...
--
"If I was going to wear a wig I'd choose something a lot better than this"
- Barry Norman
------------------------------
Date: Thu, 24 Jun 1999 14:26:07 GMT
From: Darren Bane <dbane@shannon.tellabs.com>
Subject: Re: Writing to a terminal from a perl script
Message-Id: <7ktf5i$784$1@nnrp1.deja.com>
In article
<Pine.BSF.4.05.9906231451060.13773-100000@lister.acm.wwu.edu>,
Shane Fisher <fishers@lister.acm.wwu.edu> wrote:
> Greets,
>
> I am trying to figure out how to write to my terminal from a perl
script
> invoked by another process.
man wall. wall just does what other people have advised you to do
directly, i.e. writes to the /dev/ttyXX devices.
[snipped]
--
#include <stddisclaimer.h>
Use a public HTTP keyserver for my PGP public key.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
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 6117
**************************************