[7118] in Perl-Users-Digest
Perl-Users Digest, Issue: 742 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 17 23:07:22 1997
Date: Thu, 17 Jul 97 20:00:33 -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, 17 Jul 1997 Volume: 8 Number: 742
Today's topics:
Re: $ $ $ $ M A K E B I G B U C K S $ $ $ $ (Gernot Lachner)
Re: 2 xor 0 -> 1 (??) (Grant Reaber)
ANNOUNCE: New module "Locations" (1.0) (Steffen Beyer)
Re: Back button <rootbeer@teleport.com>
Bad file number (Sara Young)
Re: Building a perl hash in C using hv_store_ent() <dougm@osf.org>
Re: Can I do that?? (Dave Cross)
Re: Can I send a fax through cgi? <rootbeer@teleport.com>
chmod <crules@olivernews.com>
Re: chmod (Ashwin Bihari)
Re: chmod <rootbeer@teleport.com>
Re: Complex Data Structures... <zenin@best.com>
Re: Complicated split; not in FAQ <tibbs@hpc.uh.edu>
downloading perl file(s) (PJ Cassel)
dynamic func. arguments <justinb@cray.com>
Re: en francais (M. muPe)
Re: gethostbyaddr <rootbeer@teleport.com>
Re: How to keep track of context ('{' and '}') in LaTeX <rootbeer@teleport.com>
Re: How to mail files uuencoded? <bart_mitzvah@spam-is-not.kosher.com>
Re: How to round numbers in perl <ajohnson@gpu.srv.ualberta.ca>
Re: Input Validation with Regular Expressions <rootbeer@teleport.com>
Re: Intermitent 'Runtime exception', Why? <rootbeer@teleport.com>
Re: Is there a tool similar to lex and awk combined <bwalker@csl.co.uk>
New Module List Posted (Andreas Koenig)
Newbie to perl objects - help! <rhakim@cyberus.ca>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Jul 97 10:29:09 GMT
From: glachner@iafrica.com (Gernot Lachner)
Subject: Re: $ $ $ $ M A K E B I G B U C K S $ $ $ $
Message-Id: <N.071697.122909.32@196-31-18-173.iafrica.com>
> On 15 Jul 1997 09:06:33 GMT, "Steven.Lamb"
> <Steven.Lamb@clear.net.nz>
> wrote:
>
> >I'll chip in a hundred bucks !!
> >
> >Alan M Goss <thatsit@icon.co.za> wrote in article
> ><01bc9038$2f79a1c0$7a9c22c4@thatsit.icon.co.za>...
> >> People,
> >>
> >> I have an idea...lets all club together and get a hit
> man...
> >
> Bring me the head of Alfredo Spammer...
>
> Sorry for the bad pun...
i'll gladly supply the hardware :)
--
the BAT ~..~
------------------------------
Date: 16 Jul 1997 15:55:21 GMT
From: greaber@joker.cme.nist.gov (Grant Reaber)
Subject: Re: 2 xor 0 -> 1 (??)
Message-Id: <5qiqt9$k6u1@news.nist.gov>
In article <33CCB3FD.2D6DE714@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>robert c. combs wrote:
>>
>> Actually, I've always thought it odd that a logical operator would
>> return ANYTHING OTHER than 1 or 0 (True or False). But, that could
>> just be the result of too much symbolic logic. :)
>
>But you have to remember that Perl doesn't defined 1 and 0 as True and
>False. There are three values for False[*] and everything else is
>True. When you need to return a True value, why not return one that's
>already there? It seems more resonable than an arbitrary value like 1.
>Now that I know Perl, I wonder why more languages don't do something
>like this. But then again, symbolic logic makes my brain hurt.
Well, one argument against the behavior is that xor can't do the symmetric
thing by returning interesting false values since it doesn't define the
order its arguments are evaluated in. So,
0 or undef => undef
But what should 0 xor undef evaluate to? (An obvious answer is undef,
but now things are getting more and more complicated to fully explain
-- xor specifies an order for argument evaluation for no obvious
reason.) Right now, xor appears to always return "" for false.
I still think the interesting true value is worth considering.
Grant
------------------------------
Date: 16 Jul 1997 10:33:38 GMT
From: sb@sdm.de (Steffen Beyer)
Subject: ANNOUNCE: New module "Locations" (1.0)
Message-Id: <5qi822$qgr$1@nadine.teleport.com>
Dear Perl users,
I am glad and proud to submit an especially useful and elegant module
to the Perl community, namely
=====================================
Package "Locations" Version 1.0
=====================================
for Perl version 5.000 and higher
Copyright (c) 1997 by Steffen Beyer. All rights reserved.
This package is free software; you can redistribute and/or
modify it under the same terms as Perl itself.
Where to find:
--------------
You can download this module ("Locations-1.0.tar.gz") from my web site at
http://www.engelschall.com/u/sb/download/
It will probably also be available soon on CPAN.
What does it do:
----------------
Locations - magical spots in your output files
"Locations" free you from the need to write output files
in rigidly sequential order.
They allow you to define insertion points in output files
(while you are still writing to them!) which you can fill
in later.
You can also generate data once in your program and use it several
times at different places in your output files using this class,
while the data is stored in memory only once.
(Potential infinite recursions are detected and prevented automatically)
Think of "Locations" as folders (or drawers) containing papers
in a sequential order, most of which contain printable text or
data, while some may contain the name of another folder (or drawer).
When dumping a location to a file, the papers contained in it
are printed in their stored order. When a paper containing the
name of another location is encountered, the contents of that
location are processed before continuing to print the remaining
papers of the current location. And so forth, in a recursive
descent.
Note that you may create as many locations with as many embedded
locations, as many nesting levels deep as your available memory
will permit.
Not even Clodsahamp's multidimensionally expanded tree house (see
Alan Dean Foster's fantasy novel "Spellsinger" for more details!)
can compare with this! :-)
Possible applications of this module are for example:
- source code generation
- web page generation
- generating mail messages in mime format
- filling in forms
- ...
Let your fantasy go wild inventing more applications!
(And tell me about them!)
Installation:
-------------
Simply install this module using the following commands:
% perl Makefile.PL
% make
% make install
Documentation:
--------------
To see the module's documentation, use the command "man Locations" thereafter.
Credits:
--------
Many thanks go to Gero Scholz (now at the Dresdner Bank in Frankfurt, Germany)
for writing the "ProMAC" macro processor (some sort of a precursor to Perl in
spirit!) and implementing the concept of "locations" there, which inspired me
to write this Perl module!
Author's note:
--------------
I hope you will find this module benefitful!
Share and enjoy!
Yours,
--
Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
"There is enough for the need of everyone in this world,
but not for the greed of everyone." - Mahatma Gandhi
------------------------------
Date: Wed, 16 Jul 1997 07:45:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joelle D'Antin & Nicolas Gregoire <dantin@icp.grenet.fr>
Subject: Re: Back button
Message-Id: <Pine.GSO.3.96.970716074309.14876F-100000@kelly.teleport.com>
On Wed, 16 Jul 1997, Joelle D'Antin & Nicolas Gregoire wrote:
> here a question that a lot of people asked before me but:
If that's the case (and it is) why ask it again? It's either in the FAQ or
you can find it in a Usenet archiving service, such as AltaVista or
DejaNews.
> How to do a back button (like the one in Netscape, not a href) in my
> HTML page.
There's no way that works on all browsers. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 16 Jul 1997 08:57:21 GMT
From: syoung@actcom.co.il (Sara Young)
Subject: Bad file number
Message-Id: <5qi2dh$l93$1@lnews.actcom.co.il>
I have a program with the following line in it:
$oqref = do "$QUOTE" || die("can not run quote: $!");
The program worked fine, until I made some changes in it (mostly just
adding my's to the $QUOTE program).
Now I get:
can not run quote: Bad file number at ...
I apologize if this is a UNIX question, but does anybody know what Bad
file number means? I have never encountered this in the past.
I'd appreciate a cc to my email address.
TIA,
Sara
------------------------------
Date: Thu, 17 Jul 1997 11:15:31 -0400
From: Doug MacEachern <dougm@osf.org>
To: Marco Moreno <mmoreno@cas.org>
Subject: Re: Building a perl hash in C using hv_store_ent()
Message-Id: <33CE3713.114B@osf.org>
Marco Moreno wrote:
>
> In C, I am attempting to embed perl, construct a perl hash, push a
> reference
> to it on the stack, manipulate the hash via a perl subroutine call and
> return the results back to C via the stack.
>
> Though I've read perlembed, perlcall and perlguts I have not found any
> good
> examples of hash manipulation. I've been successful in using an array,
> but
> I keep getting segmentation faults when trying to do it with a hash.
> (I derived the code from the examples in TPJ vol.1 iss.4.)
>
> Can anyone show me what I'm doing wrong or point me to some examples of
> how
> to do this?
>
> Any help would be greatly appreciated!
The major problem with your code below is perl internal stuff has not
been initialized, e.g. the shared hash key table before calling newHV(),
etc. You should always perl_alloc()..perl_run() before calling any
other Perl API functions.
In any case, below is an example that does work and should print:
in Perl: me=`dougm'
in Perl: foo=`val'
in C: willi=`nilli'
in C: me=`dougm'
in C: foo=`bar'
If you use a reference, the subroutine need not return it so you can get
at the modified hash in C, note the comments. The same approach can be
used with array references.
-Doug
#hashref.pl
use strict;
sub My::subroutine {
my $hashref = shift;
while(my($k,$v) = each %$hashref) {
print "in Perl: $k=`$v'\n";
}
$hashref->{foo} = "bar";
$hashref->{willi} = "nilli";
}
__END__
/* hashref.c */
#include <EXTERN.h>
#include <perl.h>
void
hash_stuff()
{
dSP;
HV *hv = newHV();
SV *val;
char *key;
I32 klen;
hv_store(hv, "foo", 3, newSVpv("val",3), FALSE);
hv_store(hv, "me", 2, newSVpv("dougm",5), FALSE);
ENTER;
SAVETMPS;
PUSHMARK(sp);
XPUSHs(newRV_noinc((SV*)hv)); /* don't mortalize here */
PUTBACK;
perl_call_pv("My::subroutine", G_SCALAR | G_EVAL);
(void)hv_iterinit(hv);
while ((val = hv_iternextsv(hv, &key, &klen)))
printf("in C: %s=`%s'\n", key, SvPV(val,na));
if (SvTRUE(GvSV(errgv)))
fprintf(stderr, "eval error: %s\n", SvPVx(GvSV(errgv), na));
FREETMPS;
LEAVE;
/* now release hv */
hv_undef(hv);
SvREFCNT_dec((SV*)hv);
}
int main(int argc, char **argv, char **env)
{
char *embedding[] = { "", "hash.pl" };
PerlInterpreter *my_perl = perl_alloc();
perl_construct(my_perl);
perl_destruct_level = 1;
perl_parse(my_perl, NULL, 2, embedding, (char **)NULL);
perl_run(my_perl);
hash_stuff();
perl_destruct(my_perl);
perl_free(my_perl);
}
------------------------------
Date: Wed, 16 Jul 1997 12:35:42 GMT
From: Dave.Cross@gb.swissbank.com (Dave Cross)
Subject: Re: Can I do that??
Message-Id: <DAVE.CROSS.97Jul16133542@ln4d110swk.gb.swissbank.com>
In article <33C98AD2.7E8C@cyberlab.nl> Spin <spin@cyberlab.nl> writes:
> Where can I find 'the frequent posting'?
>
> > Please check out the frequent posting about choosing good subject lines.
Here... frequently...
--
"...but Man created all gods equal."
Dave.Cross@gb.swissbank.com
------------------------------
Date: Wed, 16 Jul 1997 07:47:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Christopher Chan <chris@cybertech.com.sg>
Subject: Re: Can I send a fax through cgi?
Message-Id: <Pine.GSO.3.96.970716074530.14876G-100000@kelly.teleport.com>
On Wed, 16 Jul 1997, Christopher Chan wrote:
> Subject: Can I send a fax through cgi?
>
> Is it possible??
Can you send the text of a something you want faxed through a CGI script?
Yes, you can. Will it come out of a FAX machine somewhere? That's
possible, too. Do I have a script sitting around which will make this work
with your hardware? No, I don't. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jul 1997 05:43:34 -0700
From: CG <crules@olivernews.com>
Subject: chmod
Message-Id: <33CCC1F6.12F69DE9@olivernews.com>
I would like to use the chmod command in a perl script, but it doesn't
work. Does anyone have a part of a script or a script that will chmod
files?
Thanks
------------------------------
Date: 16 Jul 1997 14:31:32 GMT
From: ashwin@SPAMSUCKScs.uml.edu (Ashwin Bihari)
Subject: Re: chmod
Message-Id: <slrn5spmq4.tgh.ashwin@jupiter.cs.uml.edu>
On Wed, 16 Jul 1997 05:43:34 -0700, <CG> wrote:
> I would like to use the chmod command in a perl script, but it doesn't
> work. Does anyone have a part of a script or a script that will chmod
> files?
What exactly are you typing and what exactly is it not doing?? giving part
of the code that includes the CHMOD function could help us figure out what
could be wrong..Regards
--
/-----------------------------------------------------------------------------\
|Ashwin Bihari University of Massachusetts Lowell|
|E-Mail: abihari@cs.uml.edu Department of Computer Science |
|URL: http://www.cs.uml.edu/~abihari |
|-----------------------------------------------------------------------------|
| NOTE: The address above has the words NOSPAM, to stop just that, please |
| reply to the address in this box, if you have to at all! |
\-----------------------------------------------------------------------------/
------------------------------
Date: Wed, 16 Jul 1997 08:21:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: CG <crules@olivernews.com>
Subject: Re: chmod
Message-Id: <Pine.GSO.3.96.970716081915.14876L-100000@kelly.teleport.com>
On Wed, 16 Jul 1997, CG wrote:
> I would like to use the chmod command in a perl script, but it doesn't
> work.
When you say "it doesn't work", what does that mean? It's a little vague.
chmod 0, "myfile" or warn "Can't chmod: $!";
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 13 Jul 1997 22:42:45 GMT
From: Zenin <zenin@best.com>
Subject: Re: Complex Data Structures...
Message-Id: <5qbll5$oc1$8@nntp2.ba.best.com>
Patrick Scott Pierce <pspierce@mindspring.net> wrote:
> In creating complex data structures like so: (taken from Perl Data
> Structures Cookbook)
>multilevel stuct sniped<
> I have successfully written the data structure to a SMDB file
Huh? If you're not using the MLDBM_File module or similar
persistence package, this will **NOT** work. Oh yes, it will
*SEEM* to work just fine for datastuctures that you build, save,
and retrieve WITHIN THE SAME RUNNING OF THE PROGRAM since all
your reference pointers will be valid, but the next time you run
your program you won't be able to get to ANY of the data except
the first level keys as there values will simply be invalid memory
pointers from references your program was using at the time it
"saved" the data to disk.
> and been
> able to retrieve it as well;
Hmm, see above. Have you tryed to run your program twice? Once to
save the info, and the next to *only* try to retrieve it? Get the
MLDBM_File module or similar from CPAN if you haven't already.
> however, I can't seem to get the right spin
> on getting the number of elements in 'members'.
> Anybody show me an example.
> I had hoped something like:
> $tmp = $TV{flinstones}{members};
> ... $#tmp;
> but to no avail.
Not that any of this will work without a MLDBM_File package
first, but here it is anyway. :)
Have you read the perlref, perldsc, and perllol man pages?
$TV{flinstones}{members} contains a reference to a list of hash
references. So, you must dereference it first before you can
get anything useful out of it. You basicly have two choices:
## Dereference the entire array and evaluate it as a scalar
$TotalMembers = scalar @{ $TV{flinstones}{members} };
## Dereference the array location and use the last member index
## pointer. This (I think) is more efficient then the latter.
$TotalMembers = $#{ $TV{flinstones}{members} } + 1;
On a similar note,
Has anyone in the perl porters group ever thought about allowing
a syntax of:
$ArrayRef->[#]
or
$ArrayRef->#
or maybe it's own mock class, like FileHandle?
$ArrayRef->length;
To be used inplace of $#{$ArrayRef}?
-Zenin
zenin@best.com
--
-Zenin
zenin@best.com
------------------------------
Date: 16 Jul 1997 09:56:32 -0500
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Complicated split; not in FAQ
Message-Id: <ufavi2bdp0f.fsf@sina.hpc.uh.edu>
>>>>> "TP" == Tom Phoenix <rootbeer@teleport.com> writes:
TP> And that's not in the FAQ? Try my copy. :-)
Assuming your copy is the same as the perlfaq4 POD and what's on perl.com,
then that solution _does not_ solve my problem. I even said that right in
my message and explained why it didn't work. I even did the work myself
and found something that seems to do what I need, but I wanted to run it by
some people who know more about this thing than I.
I know everyone gets tired of answering FAQ questions, but wouldn't at
least be prudent to read the message before crying "FAQ!"? I tried my best
to avoid that by saying in the Subject: that it wasn't solved in the FAQ.
I wasn't lying, you know.
TP> This document is titled "How can I split a [character] delimited string
TP> except when inside [character]? (Comma-separated files)"
Which, as shown in my message, does not properly split even my first
example and doesn't come even close to splitting my second example.
--
Jason L. Tibbitts III - tibbs@uh.edu - 713/743-3486 - 622PGH
System Manager: University of Houston Department of Mathematics
1994 PC800 "Kuroneko" DoD# 1723
------------------------------
Date: Thu, 17 Jul 1997 08:41:58 -0500
From: pjcassel@prismnet.com (PJ Cassel)
Subject: downloading perl file(s)
Message-Id: <MPG.e37dd24542c959989685@news.prismnet.com>
I have recently taken a basic class in perl, and I need to practice. I
went to the following ftp site:
ftp://ftp.activeware.com/Perl-Win32/beta/
I need to know if I need all the files in a series, ie: all files with
the number 302 in the file name, or just one of the files listed. I want
to set this up on a win95 platform and will appreciate all constructive
suggestions that come my way.
Thank You,
PJ Cassel
pjcassel@prismnet.com
------------------------------
Date: Wed, 16 Jul 1997 07:47:01 -0500
From: Justin Banks <justinb@cray.com>
Subject: dynamic func. arguments
Message-Id: <33CCC2C5.446B@cray.com>
Hello,
I'm trying to build an argument list to a function like this example
(taken hopelessly out of context) :
foreach $field (sort keys %$ars_data) {
my $fieldname = "${field}_field";
$fieldname =~ s/\s//g;
$fieldname =~ s/\W//g;
$refname = "$fieldname";
$fieldname = ars_GetFieldByName($ctrl, $schema, $field) ||
print "no such field in this schema: $field" && die;
push @submit_cmd , ", \$$refname, \"$$ars_data{$field}\"";
}
(my $field_id = ars_CreateEntry(@submit_cmd)) ||
print "Can't create entry : $ars_errstr" && die;
And (perhaps obviously), it won't work. I tried with a simple scalar,
and that (again, perhaps obviously) didn't work. Then, I remembered that
function arguments are passed in as a flat array, so I tried the above.
I have the sneaking feeling that I can use eval to somehow make this
work, but I'm not quite sure how to do it, and a perusal of the Camel
book didn't help (maybe I'm dense). Any help would be appreciated.
BTW : I printed out the arguments for debug purposes, and they are
exactly what I want them to be, I just can't get the function to use
them in the way I want.
--
Justin Banks
Silicon Graphics Cray Research
Eagan, Minnesota
------------------------------
Date: Wed, 16 Jul 1997 16:03:01 GMT
From: mupe@desk.nl (M. muPe)
Subject: Re: en francais
Message-Id: <5qio5s$r1i$1@news2.xs4all.nl>
In article <8cen8z6zew.fsf@gadget.cscaper.com>, Randal Schwartz <merlyn@stonehenge.com> wrote:
>So, yes, there *are* translated documents. You'll just have to pay a
>little bit for them. And being from ORA, they're probably pretty good
>translations. I dunno... I'm an American, so I speak only one (human)
>language. :-)
Auch, we dutch people hate to spend money. Maybe that's the reason we
had to learn multiple languages at school.
But it is good to know the major language do have their blue camel
translation.
Mathilde muPe
------------------------------
Date: Wed, 16 Jul 1997 08:36:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Natalie Wojtech <wn@vttz.at>
Subject: Re: gethostbyaddr
Message-Id: <Pine.GSO.3.96.970716083222.14876N-100000@kelly.teleport.com>
On Wed, 16 Jul 1997, Natalie Wojtech wrote:
> gethostbyaddr works very slow for unresolved users (passes the NULL
> string after 1.5 minutes).
This is (almost certainly) the behavior of your system's resolver. To find
out, try commands like these from the shell prompt. (Assuming you have a
Unix-like system.)
nslookup non.exist.ant
nslookup non.exist.ant.org
If those are slow, check your system's choice of nameserver (or ask a
system administrator to do so).
On the other hand, if nslookup is speedy, something else is wrong. In that
case, post again. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jul 1997 08:18:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andreas Olsson <seo@sorona.se>
Subject: Re: How to keep track of context ('{' and '}') in LaTeX with Perl?
Message-Id: <Pine.GSO.3.96.970716080923.14876K-100000@kelly.teleport.com>
On 16 Jul 1997, Andreas Olsson wrote:
> In some way I have to track brace-pairs to find the proper end-brace,
> but I can't find out a way to do this in a simple way.
You have to use more than just simple regular expressions, since those
can't "count braces" to keep track of the nesting depth. (Although you
could construct a RE to match up to any finite depth, and you can even do
that on the fly, that may not be the best way to handle this problem.)
One way is to actually parse the string, turning it into a data structure
which recursively represents the nested constructs. This can be
subsequently manipulated and re-assembled into LaTeX.
Another (somewhat quick-and-dirty) way would be to start with a substring
which holds the opening brace, and repeatedly extending the substring to
go just past the next closing brace. After each such extension, count the
opening and closing braces, and exit if there are the same number. (This
is easiest if there's no way to quote a brace. Is that true of LaTeX?)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jul 1997 08:30:18 GMT
From: Joe Stewart <bart_mitzvah@spam-is-not.kosher.com>
Subject: Re: How to mail files uuencoded?
Message-Id: <33cc82cf.26939507@news.infoave.net>
On Tue, 15 Jul 1997 18:58:01 -0500, Eryq <eryq@enteract.com> wrote:
<snipped much appreciated help on Perl>
>
>(Note: I'd have responded by email to the original poster as well,
>but they've got one of those cutesy "no spam" return addresses
>with no instructions as to what the real address is. And
>I hate guessing games. :-( )
>
It was not an oversight on my part to leave out instructions
on how to remove the spam blocker from my address. When
I post to usenet I do not necessarily require an e-mail reply.
But, for future reference, the key to removing most people's
standard spam-blocker is: remove the phrase with "spam" in
it between two dots ( or between the @ symbol and a dot),
and remove the dot immediately following.
Now that I've told you the formula for how to do this, please
don't send flames to my personal e-mail; instead, post them to
alt.flame. Followups have been set to that group.
-Joe
------------------------------
Date: Wed, 16 Jul 1997 03:02:09 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: How to round numbers in perl
Message-Id: <33CC8001.73CFCAD8@gpu.srv.ualberta.ca>
Brand and Karina Hilton wrote:
>
> In article <5qg7l7$bhn@lyra.csx.cam.ac.uk>,
> M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
> >
> >In article <5qg1ih$j0j$9@nntp2.ba.best.com>, Zenin <zenin@best.com> wrote:
> >>
> >> Boy, you work to hard...
> >>
> >> $Float = 1.2;
> >> $RoundInt = int ($Float + 0.5);
> >
> >And you work inaccurately. Think about negative numbers.
>
> Unfortunately, your solution doesn't do much better for negative numbers.
> (e.g., round -1.7 returns -1 and round -2.7 returns -2)
>
> Like the FAQ says, printf and sprintf are best. Specifically:
>
> sprintf "%1.0f", $myfloat
>
actually, my copy of perlfaq4 says 'sprintf() or printf()
is usually the easiest route' not that they are *best*...
for rounding to a specified number of digits, in this case to
an integer, a specific method is almost certainly more
efficient timewise:
sub round {
my $int=shift;
$int=int($int<0?$int-.5:$int+.5);
}
should perform better than the sprintf() version---though, for
programmer efficiency, its more difficult to change it to round
to some other number of digits. But if I know the data, and I'm going
to do a lot of processing, I'd pick the custom version.
regards
andrew
------------------------------
Date: Wed, 16 Jul 1997 07:52:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "clayton@grin.net" <clayton@grin.net>
Subject: Re: Input Validation with Regular Expressions
Message-Id: <Pine.GSO.3.96.970716074838.14876H-100000@kelly.teleport.com>
On Wed, 16 Jul 1997, clayton@grin.net wrote:
> I tried using
>
> <INPUT TYPE=HIDDEN NAME="re"
> VALUE="email=^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$">
>
> with my mailform to verify e-mail addresses but it doesn't work.
No, for a couple of reasons. One is that you're confusing HTML and Perl,
which is like confusing the menu with the meal! :-)
But before you start the whole "validing an e-mail address" discussion
again, check the history of the discussion on a Usenet archive like
DejaNews or Alta Vista. It seems like it's all been asked and answered
already, but if you have an original question, that's welcome here.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 17 Jul 1997 15:53:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andreas Olsson <seo@sorona.se>
Subject: Re: Intermitent 'Runtime exception', Why?
Message-Id: <Pine.GSO.3.96.970717155026.3938X-100000@kelly.teleport.com>
On 17 Jul 1997, Andreas Olsson wrote:
> I intermitently get the message 'Runtime exception' and then the
> execution hatls.
That's not a Perl error message listed in perldebug(1). Could it be coming
from your system, instead of from Perl? If you're using an older version
of Perl, or if you're using it on a non-Unix system, or if you might be
running out of memory, those things could be part of the reason. Do any of
those apply? Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 16 Jul 1997 13:58:00 GMT
From: "Barrie Walker" <bwalker@csl.co.uk>
Subject: Re: Is there a tool similar to lex and awk combined
Message-Id: <01bc91f0$49c11360$843482c2@fruin.csl.co.uk>
Hi,
Can't think of an succinct awk way off hand,
The perl script below does it easily enough if it's all single character
input.
(complete (& utter) ignorance of lex showing here)
while (<>) { for (split //) { defined &$_ ? &$_ : &duh }}
sub duh {}
sub a { # whatever for 'a' }
sub h { # etc }
sub C {}
# etc
If you need access to following parameters try replacing the first line
above with this one
undef $/; @c= split //, <>; defined &$_ ? &$_ : &duh while $_ = shift @c;
You can get the next character with
$p = shift @c;
Antony & Minimol <antony@exit109.com> wrote in article
<33CB039F.302D27D7@exit109.com>...
> Hi all
> I am looking for a tool which is similar to lex with interpreting
> capability of awk or perl. This tool should treat input as stream of
> characters not as
> stream of records. When a pattern matches, it should perform some
> action.
> There are lot of such patterns and I do not have the flexibility of
> compiling
> otherwise I could have used lex.
> Input is only a stream of characters without any record or field
> separators.
> If this can be done with awk or perl without doing much fuss,
> please let me know. If there is some other tool, please let me know that
> also.
>
> Thanks in Advance
> Antony P. Joseph
>
------------------------------
Date: 13 Jul 1997 22:34:00 GMT
From: andreas.koenig@franz.ww.tu-berlin.de (Andreas Koenig)
Subject: New Module List Posted
Message-Id: <5qbl4o$gmm$1@brachio.zrz.TU-Berlin.DE>
Keywords: FAQ, Perl, Module, Software, Reuse, Development, Free
The Perl 5 Module List, v2.43...
================================
A new revision of the module list is on it's way around USENET and
CPAN. It has been posted to
news:comp.lang.perl.modules
and uploaded to
http://www.perl.com/CPAN/modules/00modlist.long.html
The recent changes are appended below. In addition, Graham Barr and
Tim have added a new section, a ``Standards Cross Reference'', that
gives a nice overview on which modules deal with which standards.
As usual, comments, corrections and suggestions are more than
welcome. Please don't hesitate, mail them to modules@perl.org I
believe that I have taken into account all mails we have received
since the last posting. If this is not the case, please let us know.
A big Thank You to all contributors helping us to keep the document up
to date and apologies to all who didn't get responses as quick as they
should.
Recent Changes in the modules database
--------------------------------------
3) Development Support
----------------------
ExtUtils::
::DynaGlue adcr Permits runtime execution of C library code DOUGM !
::DynaLib adcO Allows direct calls to dynamic libraries JTOBEY +
::F77 RdpO Facilitate use of FORTRAN from Perl/XS code KGB !
6) Data Types and Data Type Utilities (see also Database Interfaces)
--------------------------------------------------------------------
Date::
::DateCalc Rdcf Gregorian calendar date calculations STBEY !
ObjStore ad+O ObjectStore DBMS Interface JPRIT +
11) Text Processing, Parsing and Searching
------------------------------------------
Parse::
::RecDescent cnpO Recursive descent parser generator DCONWAY +
TeX::
::DVI adpO Methods for writing DVI (DeVice Independent) JANPAZ !
Text::
::DelimMatch RdpO Match (possibly nested) delimited strings NWALSH +
::Invert cdpO Create/query inv. index of text entities NNEUL +
13) Internationalization and Locale
-----------------------------------
Cz::
::Cstocs adpO Charset reencoding JANPAZ +
::Sort adpO Czech sorting JANPAZ +
17) Archiving, Compression and Conversion
-----------------------------------------
Archive::
::Tar adpO Read, write and manipulate tar files CDYBED +
18) Images, Pixmap and Bitmap Manipulation, Drawing and Graphing
----------------------------------------------------------------
Chart::
::Base a Business charts MKRUSE +
Recent Changes in the users database
------------------------------------
+ CDYBED Calle Dybedahl <calle@lysator.liu.se>
+ DBEAZLEY Dave Beazley <dmb@asator.lanl.gov>
+ DCONWAY Damian Conway <damian@cs.monash.edu.au>
+ DEVEN Deven T. Corzine <deven@ties.org>
+ DSUGAL Dan Sugalski <sugalsd@lbcc.cc.or.us>
+ ENEGAARD Eric Negaard <lmdejn@lmd.ericsson.se>
+ JGROENVELJohn Groenveld <groenvel@cse.psu.edu>
+ MKRUSE Matt Kruse <mkruse@netexpress.net>
+ NNEUL Nathan Neulinger <nneul@umr.edu>
+ NWALSH Norman Walsh <norm@berkshire.net>
! RJRAY Randy J Ray <rjray@uswest.com>
+ SMCCAM Stephen McCamant <alias@mcs.com>
Please, visit the new module list at one of the locations mentioned
above.
Enjoy,
andreas
------------------------------
Date: Wed, 16 Jul 1997 12:38:34 -0400
From: Richard Hakim <rhakim@cyberus.ca>
Subject: Newbie to perl objects - help!
Message-Id: <33CCF90A.30196EE@cyberus.ca>
Hi there!
I'm writing what is effectively a search engine for a research
institute. Each researcher has a set of keywords associated with them.
When the user enters a word to search on, the script must go through all
the keywords of all the researchers and find matches. It must then
return the name of researcher, all the matches for that researcher, and
the URL of the researcher's WWW page.
After some consideration, I think the best way to represent the
researchers and do the searching is with the use of an object. The
object would know about the researcher's name, URL, and keywords. When
given a search string, it would search through the keywords, and then
return the list of hits. Sounds simple, right?
Well, apparently I'm having trouble just understanding the basics of how
objects work in perl. I've got a good C/C++ and Java background,
but....
I've attached the relevant package below; if people out there can see
what I'm doing wrong (and I'm sure it's -very- wrong), please let me
know! The code I would be using in the main script to call routines in
this package would be stuff like:
$researchers{$name} = SearchHits->new();
$researchers{$name}->setKeywords(@keywords);
$researchers{$name}->setURL('/researchers/albert/');
print $researchers{$name}->getURL();
etc.
Here is the package:
package SearchHits;
##########################
#
# This object (package) will be used to track the hits made from a
search
# query. It will hold the hits for one researcher. An array or hash
# in the main program will deal with the number of researchers, etc.
etc.
#
# Things this object knows about:
# - the name of the researcher it represents
# - the list of keywords for that researcher (passed in the new
function)
# - the url of that researcher
# - the query made
# - the list of keywords that made the cut
#########################
local(@keywords);
local($researcherName);
local($researcherURL);
local($queryString);
local(@hits);
sub new {
my $this = shift;
my $class = ref($this) || $this;
my $self = {};
bless $self, $class;
return $self;
}
# Routines to deal with the keywords for this researcher
sub setKeywords {
my ($self, @keywords) = @_;
}
sub getKeywords {
my $self = shift;
return $self->@keywords;
}
# Routines to deal with the researcher name
sub setName {
my $self = shift;
$researcherName = @_;
}
sub getName {
my $self = shift;
return $self->$researcherName;
}
# Routines to deal with the researcher URL
sub setURL {
my $self = shift;
$researcherURL = @_;
}
sub getURL {
my $self = shift;
return $self->$researcherURL;
}
# Searching routine
sub search {
my $self = shift;
$queryString = @_;
foreach $word (@keywords) {
if ($word =~ $queryString) {
push(@hits, $word);
}
}
if (@hits) {
return @hits;
} else {
return null;
}
}
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 742
*************************************