[6741] in Perl-Users-Digest
Perl-Users Digest, Issue: 366 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 24 20:07:19 1997
Date: Thu, 24 Apr 97 17:00:23 -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 Apr 1997 Volume: 8 Number: 366
Today's topics:
Re: [Help] converting numbers to formatted strings <rootbeer@teleport.com>
Bizarre question of the day...precedence with typeglob? <jadams@pe-netsystems.com>
Re: Calculating dates (Abigail)
cc/make Problems Compiling Perl Modules Under IRIX 6.3 <bugaj@dnrc.bell-labs.com>
Controlling screen output <daleweb@io.com>
DB_File, umask(), and mode settings <good.luck@getting.spam.to.zenin.at.best.com>
display hostname in CGI perl script? <syanoff@strong-funds.com>
Re: GD 1.14 NT install problems <gordon.leslie.mcdorman@sap-ag.de>
Re: Generating math graphs on a WWW document (Nathan V. Patwardhan)
Re: Getting a user's ip address? <rootbeer@teleport.com>
Re: HELP:flock not implemented (Matthew D. Healy)
Re: HELP? with loop test <rootbeer@teleport.com>
Re: Need source for calling search engines (Niksun)
Re: Newbie Question: regexp email address.. (Matthew D. Healy)
Re: PERL & ADO - SQL INSERT slows after 100 Executions (Eric Bohlman)
Re: Perl5 sin function has dain bramage ?!?!?!?!? (Jack Applin)
Re: Perl5 sin function has dain bramage ?!?!?!?!? <jhi@alpha.hut.fi>
Re: POD Question: Self Documenting Programs Not Support <rootbeer@teleport.com>
Preferred style of "named parameter" subroutine args? <eryq@enteract.com>
Re: Printing to Files. <rootbeer@teleport.com>
Re: Printing to Files. <wesley.peace@ncons.com>
Re: Problem with Oraperl... (John D Groenveld)
Re: raw input <ryung@ml.com>
REQ: free cgi script harbour (clothed)
Run UNIX commands <9435697@mail.petech.ac.za>
set noclobber (Kokopelli)
shells, system, and pipes <bromberek@cems.umn.edu>
Verifying URL's (Niksun)
Re: What's the equivalent to sendmail with NT? <wesley.peace@ncons.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 24 Apr 1997 16:02:49 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Christian Aust <christian.aust@post.rwth-aachen.de>
Subject: Re: [Help] converting numbers to formatted strings
Message-Id: <Pine.GSO.3.96.970424160133.2978G-100000@kelly.teleport.com>
On Wed, 23 Apr 1997, Christian Aust wrote:
> I have to write some Perl code that converts a floating point currency
> into a string that looks like 12.223,30. That means: a comma used
> instead of the decimal dot, a dot to seperate each group of thousands
> and always 2-digit precision.
One way would be to use the standard methods of producing 12,223.30
(documented in the FAQ and other places) and then using this operator.
$number =~ tr/,./.,/;
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 24 Apr 1997 22:56:36 GMT
From: "Jon Adams" <jadams@pe-netsystems.com>
Subject: Bizarre question of the day...precedence with typeglob?
Message-Id: <01bc5102$a79d0040$027ac697@minerva>
The bizarre problem (aka 'time-sink') of the day...
The short version:
I'm trying to create a reference to a glob typedef. Problem is, the object
name that I'm trying to glob has a '.' in it, and that appears to be of
higher precedence than the globbing operation. For example, if I try to
\*this.html, what I end up with is a scalar string created by the
concatenation of the results of \*this and the bareword 'html' (interpreted
as a string)... GLOB{0x888888}html
The long version:
I'm trying to use Lincoln Stein's CGI.pm for processing HTTP uploads. I've
used CGI.pm for years, and this one always gives me problems largely due to
the fact that the filehandle is dumped into the namespace from which the
CGI object is instantiated. This problem is yet another consequence of
this. Assuming a file with the name 'mock.html' having been uploaded, in
the namespace from which CGI was instantiated, I can grab the name of the
file INPUT entity;
my $thisFile = $self->{'cgiInstance'}->param('thatThereFile');
#$thisFile should now contain 'mock.html'
my $ref2glob = eval("\\*$thisFile");
@$ gives me nothing, because the eval works. ref($ref2glob) gives me
nothing, because the resulting value is not a recognizable reference. If I
print $ref2glob, I have something of the form 'GLOB{0x########}html'. Not
good.
Escaping any '.'s chokes noisily. A few other things I've tried ran the
range from being very vocal about failing, and silently "working" (but not
as I want it to).
I'd rather not have to hack up my own module using CGI.pm as a base class
(clients have way too much duplicated and unsupported code running around
already), so if anyone has any solutions at all, I'd love to hear them.
Cheers,
Jon Adams
jadams@pe-netsystems.com
------------------------------
Date: Thu, 24 Apr 1997 22:11:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Calculating dates
Message-Id: <E95xMq.FAy@nonexistent.com>
On Thu, 24 Apr 1997 11:28:14 -0500, Dale Churchett wrote in
comp.lang.perl.misc <URL: news:335F8A1E.6B12@io.com>:
++ I'm trying to find out a way of converting a date returned by a call to
++ `date` to yesterdays date:
++
++ $todays_date = `date`;
++
++ $todays_date will obviously return the time and date the script
++ containing this statement is being run, but I need to know the date in
++ the same format and time zone for the previous day.
++
++ I've searched through the man pages and looked at the strftime() command
++ in C but can't work out how to do it. I was also told to try changing
++ the TZ variable to
++
++ TZ=CST30CDT
++
++ and then call `date` but that didn't work on my system.
++
++ Any pointers would be greatly appreciated.
Without knowing how long a day is:
$ perl -lwMDate::Manip -e 'print UnixDate ParseDate ("yesterday"), "%C";'
Wed Apr 23 18:09:39 EDT 1997
$
Abigail
------------------------------
Date: Thu, 24 Apr 1997 17:33:28 -0400
From: Stephan Vladimir Bugaj <bugaj@dnrc.bell-labs.com>
Subject: cc/make Problems Compiling Perl Modules Under IRIX 6.3 (& perhaps with gmake & gcc & the IRIX libraries...)
Message-Id: <335FD1A8.41C6@dnrc.bell-labs.com>
I am trying to compile and install several Perl modules from CPAN and
am running into some trouble. I'm running IRIX 6.3 on an O2 (R10000),
and my SGI development option version is 7.1 (I have listed the patches
that I have below in section A). I have Perl 5.003 installed, it was an
inst-able tardist I downloaded from mat075207.student.utwente.nl which
returns this from -v:
kosciuszko 4# perl -v
This is perl, version 5.003 with EMBED
built under irix at Dec 18 1996 14:39:01
+ suidperl security patch
...
(I also happen to have perl4 installed as /usr/sbin/perl4 and perl5.002,
from the SGI freeware distribution, installed as /usr/sbin/perl5.002,
but which perl returns /usr/sbin/perl which is a link to
/usr/local/bin/perl which is version 5.003 so I don't think 002 or perl4
are interfering with 003.)
>From the SGI freeware distribution I installed inst-able versions of the
gnu compilers (v2.6.3) and the gnu c++ runtime environment (v2.6.2) and
I installed gnu make 3.72.1, also as a tardist from the utwente.nl
site.
The first module that bails on me is IO-1.15, and it does this:
kosciuszko 318# make test
cc -c -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000
-I/usr/local/include -DLANGUAGE_C -O -DVERSION=\"1.15\"
-DXS_VERSION=\"1.15\" -I/usr/local/lib/perl5/IP22-irix/5.003/CORE
IO.c
cfe: Warning 799: /usr/include/sys/time.h, line 66: 'long long' is not
standard
ANSI. (3.1.1)
typedef signed long long stamp_t;
--------------------^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Syntax
Error
extern sigjmp_buf top_env ;
-------------------- ^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Empty
declaration specifiers (3.5)
extern sigjmp_buf top_env ;
-------------------- ^
*** Error code 1 (bu21)
Is there really a problem with time.h and perl.h? Well, some other Perl
modules (CGI, StatisticsDescriptive, Logfile, Math-MatrixReal, and
others) did compile and install. I have compiled C and C++ programs,
including OpenInventor and SGI ImageVision programs, but I'm not sure if
any of them used time.h. I emailed the author of IO to see if he had
any insights but haven't heard back yet (but I only sent the mail
today).
The next module that bails is OpenGL. (I tried to email the author, but
the mail bounced.) The odd thing is that with regular make it dumps
core, but with gmake it gets an error similar to IO.
kosciuszko 149# make
/usr/sbin/perl -I/usr/local/lib/perl5/IP22-irix/5.003
-I/usr/local/lib/perl5 /usr/local/lib/perl5/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/ExtUtils/typemap -typemap typemap OpenGL.xs
>OpenGL.tc &&
mv OpenGL.tc OpenGL.c
Segmentation fault - core dumped
*** Error code 139 (bu21)
kosciuszko 150# gmake
/usr/sbin/perl -I/usr/local/lib/perl5/IP22-irix/5.003
-I/usr/local/lib/perl5
/usr/local/lib/perl5/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/ExtUtils/typemap -typemap typemap OpenGL.xs
>OpenGL.tc &&
mv OpenGL.tc OpenGL.c
Please specify prototyping behavior for OpenGL.xs (see perlxs manual)
cc -c -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000
-I/usr/local/include -DLANGUAGE_C -O -DVERSION=\"0.4\"
-DXS_VERSION=\"0.4\"
-I/usr/local/lib/perl5/IP22-irix/5.003/CORE OpenGL.c
cfe: Warning 799: /usr/include/sys/time.h, line 66: 'long long' is not
standard
ANSI. (3.1.1)
typedef signed long long stamp_t;
--------------------^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Syntax
Error
extern sigjmp_buf top_env ;
-------------------- ^
cfe: Error: /usr/local/lib/perl5/IP22-irix/5.003/CORE/perl.h, line 1367:
Empty
declaration specifiers (3.5)
extern sigjmp_buf top_env ;
-------------------- ^
gmake: *** [OpenGL.o] Error 1
I'm not sure I trust gmake right now, or gcc, because they sometimes
generate an error saying they can not continue compilation because
of an "installation error" that cpp can not be found (but cpp is on the
system, clearly, and is in /lib/cpp and /usr/lib/cpp). I did use gmake
successfully to build Objective CaML, however, and maybe a couple other
things.
SGI tech support, of course, would immediately blame the 'unsupported
software' for any and all problems so any usenet community suggestions
on how to fix this would be greatly appreciated.
Thanks.
LL+P,
Stephan
====A: SGI Patches Installed====
1578,1681,1709,1710,1712,1725,1773,1775,1778,1779,1788,1790,1791,1813,
1816,1839
--
------------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
------------------------------------------------------------------------
STANDARD DISCLAIMER: My opinions are NOT necessarily those of LUCENT.
------------------------------------------------------------------------
"Researchers: We think, therefore, things are."
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2
mQBtAzNekGsAAAEDAOIrgzF4XXXhL43Bs4TM6dCjFvAY5lKUG6Vkh3mFxFaaowc+
u20kcFIENxA0ROd1A+kQCuWsHwQeYeWAdURpuAk7pE5tD5onvbArxMMbTC1B85qr
l2V+/6lU+aw1mq4dCQAFEbQsU3RlcGhhbiBWbGFkaW1pciBCdWdhaiA8YnVnYWpA
YmVsbC1sYWJzLmNvbT4=
=D9Bv
-----END PGP PUBLIC KEY BLOCK-----
----- BEGIN GEEK CODE BLOCK -----
Version: 3.1
GAT d- s+:+ a? C++++$ UI++++$(ULSB
------------------------------
Date: Thu, 24 Apr 1997 17:31:32 -0500
From: Dale Churchett <daleweb@io.com>
Subject: Controlling screen output
Message-Id: <335FDF44.7484@io.com>
I have a script running on a Unix server that spits formatted data
directly to STDOUT. The problem is that I don't know how to prevent the
screen scrolling straight past the eyes. I'd like a duplicate of the
cat | more
command.
I've tried directing the output to a temp file, and then making a
system call to display the file using the cat | more command:
system("cat $temp_file | more");
but his only works for one screenful, the rest of the output is not
displayed.
Can anyone suggest a way? Forgive me if this is an easy one.
Thanks in advance.
------------------------------
Date: 24 Apr 1997 23:29:20 GMT
From: Zenin <good.luck@getting.spam.to.zenin.at.best.com>
Subject: DB_File, umask(), and mode settings
Message-Id: <5joqcg$gu9$1@nntp2.ba.best.com>
I've got code that basicly does this:
use DB_File;
umask 000;
tie %DBM, 'DB_File', 'foo.db', O_RDWR|O_CREAT, 0666, $DB_HASH or die $!;
untie %DBM or die $!;
However, tie() (DB_File actually) is not respecting my mode setting (0666)
and gives 0644 to the new file. It does the same damn thing regardless of
what I set or don't set umask() to be. Isn't 000 ment to say "allow any
bits that the call feels like to be set any which way they want to"???
So basicly, is there a way I can tell DB_File to create the file with a
given permission *regardless* of what the stupid umask is? -Short of doing
an call to chmod() since I may not know what the filename(s) actually are
if I use a different DBM package...
Thanks.
-Zenin (Hitting head against wall...)
Zenin @ Best . com
------------------------------
Date: Thu, 24 Apr 1997 18:43:06 -0500
From: Scott Yanoff <syanoff@strong-funds.com>
Subject: display hostname in CGI perl script?
Message-Id: <335FF00A.4123@strong-funds.com>
I can get a CGI PERL script to show my hostname as 'user-0502'.
However, I have accessed Java applets that show me as my alias (I think
that is what it is) at 'syanoff_ws'
Any idea how to get PERL to show that other hostname? I am using
gethostbyaddr but it returns the 'user-0502' name.
Thanks!
------------------------------
Date: Thu, 24 Apr 1997 22:12:08 GMT
From: Gordon McDorman <gordon.leslie.mcdorman@sap-ag.de>
Subject: Re: GD 1.14 NT install problems
Message-Id: <usp0gcbpj.fsf@sap-ag.de>
"Michael P. O'Neil" <sys1mpo@is.ups.com> writes:
> The version of perl I am running on NT 4.0 is perl5.003_07
> Has anyone done the GD.pm install on NT 4.0?
Dave Roth has created a version of GD for Win32. Try the following ftp
site for relevant files:
<ftp://ftp.roth.net/pub/NTPerl/>
--
--------------------------------------------------------------
The opinions expressed above are mine, not my employer's.
gordon.leslie.mcdorman@sap-ag.de
------------------------------
Date: 24 Apr 1997 23:32:50 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Generating math graphs on a WWW document
Message-Id: <5joqj2$95b@fridge-nf0.shore.net>
Humberto Jose Bortolossi (hjbortol@saci.mat.puc-rio.br) wrote:
: Is there such software freely available? Perhaps a WWW interface program
: (1) using GNUPLOT as external program or
Yep. Examples are listed in _CGI Programming on the WWW_ by Shishir
Gundavaram, published by O'Reilly and Associates. As for a module, I
(shame on me) haven't checked. :-)
: (3) using perl directly.
Check out the Graph sections at a CPAN near you!
http://www.perl.com/CPAN/modules/by-module/Graph/
OR
http://www.perl.com/CPAN/modules/by-module/GIFGraph/
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Thu, 24 Apr 1997 16:11:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ian Feldberg <ian.feldberg@jhuapl.edu>
Subject: Re: Getting a user's ip address?
Message-Id: <Pine.GSO.3.96.970424161036.2978H-100000@kelly.teleport.com>
On Wed, 23 Apr 1997, Ian Feldberg wrote:
> Does anyone know of an easy way to get the ip address of a remote user
> of a Perl script? That is, I'm writing a cgi script in perl
If it's possible at all (and it should be) then it's something given to
your Perl script by your server. Have you checked your server's docs to
see whether and how it might do this? Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Thu, 24 Apr 1997 19:41:20 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: HELP:flock not implemented
Message-Id: <Matthew.Healy-2404971941200001@pudding.med.yale.edu>
In article <5jkvov$4u0$1@bignews.shef.ac.uk>, elp95bpa@stoat.shef.ac.uk (B
Amavasai) wrote:
> I've just got a script which contains the flock command. However whenever
> I run the script I get a "flock() not implemented" error. Any idea what's
> going wrong? I'm using Solaris. Is there a direct replacement for flock?
Under Solaris, flock() is part of what they call the SunOS/BSD Compatibility
Library Functions. Take a look at the manpage. This means that to use it
in a Perl program under Solaris, at the time of compiling your Perl
interpreter you must include the BSD library functions. Better consult
your local Solaris wizard for help!
SunOS-to-Slowlaris porting is such a joy. Since half of our Suns run
SunOS 4.x and half run Slowlaris, I'm constantly running into nasty little
differences between them.
---------
As of 22 Apr 1997, 983 days till Y2K....
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
"But I thought it was pointed at the rabbit *between* my feet!"
---------
Help a victim of severe email harrassment, see
http://www.geocities.com/~hitchcockc/story.html#fund
---------
------------------------------
Date: Thu, 24 Apr 1997 16:00:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nick Weavers <weav@apollo.havant.ibm.com>
Subject: Re: HELP? with loop test
Message-Id: <Pine.GSO.3.96.970424155418.2978F-100000@kelly.teleport.com>
On Wed, 23 Apr 1997, Nick Weavers wrote:
> I would like to test for the nextitem procedure returning
> either nothing (undef, undef) ? or something that would
> indicate that there are no more items.
In most cases, Perl functions should have a special value to indicate that
there are no more items. Usually that value is either undef or the empty
list.
> while ((($name,$value) = nextitem($parm_str)) > 0)
You probably want this.
while ( ($name, $value) = nextitem($parm_str) ) { ... }
Here's what that does. On the inside, you're calling &nextitem in a list
context, and (I hope) it will normally return two items, which you assign
to $name and $value.
The assignment itself, though, also has a value. Since the assignment is
being evaluated as a conditional, that's a scalar context. (Actually, it's
a Boolean context, which is a special case of a scalar context.) The value
of a list assignment in a scalar context is the number of items being
copied. This should be two, and since that's a true value, the loop goes
on.
But when you run out of items, &nextitem should return the empty list.
Now, the number of items being copied is zero, which is false, so the loop
quits.
Wow, it's almost as if somebody designed it to work this way... :-)
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Thu, 24 Apr 1997 22:51:58 GMT
From: niksun@lconn.net (Niksun)
Subject: Re: Need source for calling search engines
Message-Id: <335fe3ce.9855613@news.inetw.net>
I don't know if Perl has a solution to this, but JavaScript does. I
won't discuss it here since this is a Perl newsgroup, but e-mail me if
you want more info.
Niksun
niksun@lconn.net
-----
On Thu, 24 Apr 1997 13:28:17 -0400, "Edward F. Hinton"
<#fmlysoft@smtp.ix.netcom.com> wrote:
>I am looking for any Perl example source code that
>can send a request to any of the popular web search engines and
>can get back the results to then be post-processed
>before presenting a web page of results to a user.
>
>I have seen several meta-search tools out there (without source),
>so it obviously can be done (perhaps not in perl???),
>but I can't figure out how.
>
>Is there some simple way for a Perl program to invoke
>a cgi on another system and use stdin for results, or is
>there some other trick?
>
>Thanks.
>
>-Ed Hinton
> Inter-Objects, Inc.
------------------------------
Date: Thu, 24 Apr 1997 18:28:45 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: Newbie Question: regexp email address..
Message-Id: <Matthew.Healy-2404971828450001@pudding.med.yale.edu>
In article <8civ1mcpcy.fsf@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:
> Ouch. No. Here we go again.
>
> This is wrong.
>
> fred&barney@stonehenge.com is a legal email address (try it!).
>
> Nearly any character is valid on the left of the @.
>
> [Doesn't anyone use Dejanews any more? :-(]
>
Indeed, Randal is quite right that:
o fred&barney@stonehenge.com is a valid email address (it gets
a reply from Randal's robot)
BY THE WAY, if you try this address from the Unix commandline,
you must put single quotes around it, because if you type
mail fred&barney@stonehenge.com without single qoutes around
the address then the shell tries to amp-off a background process
with the mail fred part, which then hangs awaiting input...
o this subject comes up REPEATEDLY on clpm and the cgi groups
o nearly every simple regex posted that allegedly matches valid
email addresses is WRONG
To Randal's points, I'll add two other points that have been mentioned
umpteen gazillion times to little avail:
o syntactic validity is but ONE part of the real question you wish
to ask. There does not exist any certain method of confirming,
for ALL email systems, that a given syntactically-valid address
is also a working email address. SMTP commands only work for SOME
systems. Many systems INTENTIONALLY refuse to confirm validity
of email addresses, and will simply accept ANY address. Some will
later bounce invalid email, but some will SILENTLY discard it.
Just like sending a snailmail to a foreign country -- it you get
a reply, THEN you know it was addressed correctly; if you get it
returned THEN you know it did not get through; otherwise you know
ZILCH about its fate!
And even if the address is valid, how can you know it's MINE?
In the usual website registration case, there is really only one
alternative to human intervention or blind trust -- have the
registration form email them a username and password, which they
must use for any further access to your website. Be aware that
such attempts at forcing users to provide accurate registrations
will cause a dramatic decrease in the number of people who bother
to explore the rest of your site!
o In his excellent book {Mastering Regular Expressions}, published
by O'Reilly, Jeff Friedl gives a monster regex that matches _most_
strings that conform to the relevant RFC for email addresses (because
they allow nested parens, NO regex can possibly match all syntactically
valid email addresses). It is about 5000 characters long!
---------
As of 22 Apr 1997, 983 days till Y2K....
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
"But I thought it was pointed at the rabbit *between* my feet!"
---------
Help a victim of severe email harrassment, see
http://www.geocities.com/~hitchcockc/story.html#fund
---------
------------------------------
Date: Thu, 24 Apr 1997 21:49:21 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: PERL & ADO - SQL INSERT slows after 100 Executions
Message-Id: <ebohlmanE95wM9.GnF@netcom.com>
Robert J. Trembley (rtremble@ctissrv1.plt.ford.com) wrote:
: open hFile, $FilePath;
^^^^^
: while($szLine = <hFile>) # Read each line in the file and parse it
^^^^^^
IMHO, Hungarian notation in Perl code is a form of profanity.
------------------------------
Date: 24 Apr 1997 22:41:36 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: Perl5 sin function has dain bramage ?!?!?!?!?
Message-Id: <5jonj0$qtc@fcnews.fc.hp.com>
David J. Topper writes:
> I've been killing myself trying to figure out what values
> I'm getting for the sin function. Here's my code:
>
> #!/usr/local/bin/perl5 -w
>
> $pi = atan2(1,1) * 4;
> $tpi = 2*$pi;
>
> $sin2Pi = sin($tpi);
> print "sin($tpi) = $sin2Pi\n";
> $sin2Pi = sin(360);
> print "sin($tpi) = $sin2Pi\n";
>
> and my output is:
>
> sin(6.28318530717959) = -2.44929359829471e-16
> sin(360) = 0.958915723414307
>
> What the hell is going on ?!?!?!?!?
>
> Neither of these values are correct. But I don't
> see anything that I'm doing that is wrong.
Well, like the book says, sin works in radians, so we'd expect
sin(2*$pi) to be 0. Instead, you got -2.44929359829471e-16,
which is another way of writing -0.000000000000000244929359829471.
That's pretty close to zero.
Perl got the correct answer to 15 significant places. Did you expect
exactly, precisely, absolutely zero? If so, then you should learn more
about numeric representation in computers, and why floating-point
results are rarely mathematically exact.
-Jack Applin
neutron@fc.hp.com
http://www.cs.colostate.edu/~heckendo/Jack/
------------------------------
Date: 25 Apr 1997 00:29:48 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl5 sin function has dain bramage ?!?!?!?!?
Message-Id: <oeeu3kwaz3n.fsf@alpha.hut.fi>
"David J. Topper (Pathfinder)" <dtopper@pathfinder.com> writes:
> $pi = atan2(1,1) * 4;
This is *NOT* _the_ Great Pi.
You cannot get that with floating point numbers which is what the
computers use for approximating real numbers like Pi. Floating point
numbers can represent approximately only certain very limited set of
real numbers and Pi is certainly not one of them.
> $tpi = 2*$pi;
This is not 2 Pi.
> $sin2Pi = sin($tpi);
> print "sin($tpi) = $sin2Pi\n";
> $sin2Pi = sin(360);
> print "sin($tpi) = $sin2Pi\n";
This is wrong. Perl sin() takes its input as does C sin(), that is,
in radians, not in degress.
> and my output is:
>
> sin(6.28318530717959) = -2.44929359829471e-16
You must know that 6.28318530717959 is not 2 * pi. Therefore why are
you surprised that its sin is not quite zero? Perl is doing nothing
out of ordinary. Try whipping out your digital pocket calculator, set
degree input mode to radians, input the 6.283...959 and [sin] that.
If you get 0, your calculator is lying to you.
In short: you cannot count with computer as with real numbers.
--
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.
------------------------------
Date: Thu, 24 Apr 1997 15:52:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ian Flanigan <flan@cs.wustl.edu>
Subject: Re: POD Question: Self Documenting Programs Not Supported?
Message-Id: <Pine.GSO.3.96.970424155148.2978E-100000@kelly.teleport.com>
On 21 Apr 1997, Ian Flanigan wrote:
> I'm trying to use POD to do document my Perl programs. I can use
> pod2text (for example) to get all of the documentation from the
> program, but what I *really* want is the source code and the
> documentation to come out interleaved
Do you mean that you want to have the program and its docs? Why can't you
use it as-is, in that case, rather than extracting the documentation?
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Thu, 24 Apr 1997 17:16:45 -0500
From: Eryq <eryq@enteract.com>
Subject: Preferred style of "named parameter" subroutine args?
Message-Id: <335FDBCD.4B1D77CA@enteract.com>
Up until now, I've been using mixed-case with a leading capital,
like this:
1. func(Name=>"Fred", Age=>33);
That seems to be the safest, because the leading capital ensures
that I won't accidentally bump into a reserved word in the future.
However, I've seen other styles:
2. func(name=>"Fred", age=>33);
3. func(-name=>"Fred", -age=>33);
4. func(NAME=>"Fred", AGE=>33);
Is there a consensus, formal or informal, about what the preferred
form is? My perlstyle (5.002) manpage doesn't mention it.
Jes curious,
--
___ _ _ _ _ ___ _ Eryq (eryq@enteract.com)
/ _ \| '_| | | |/ _ ' / Hughes STX, NASA/Goddard Space Flight Cntr.
| __/| | | |_| | |_| | http://www.enteract.com/~eryq
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Thu, 24 Apr 1997 16:25:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mitchell Verter <mcv@ikos.com>
Subject: Re: Printing to Files.
Message-Id: <Pine.GSO.3.96.970424162254.2978K-100000@kelly.teleport.com>
On Wed, 23 Apr 1997, Mitchell Verter wrote:
> !. I open up the file handle:
> open (OFILE, ">$outfile");
And of course you check that the open succeeded, even though you've
omitted that check here for brevity. (Right? :-)
> 2. I try to print to the file
> print OFILE "$statement";
>
> I've noticed that the file remains empty until maybe the 20th
> print call. At that point, some of the text is dumped out into the
> file, but some of it still remains in limbo. Therefore, I can not
> generate a full file of text because some of it still seems to remain in
> a buffer somewhere.
Exactly right. If you're willing to reduce efficiency a little and flush
the buffer upon every print, you could use the $| variable to do so; it's
documented in perlvar(1). (You could also flush the buffer just once, if
you're a little trickier with $|, but in this case it probably doesn't
matter.)
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Thu, 24 Apr 1997 19:30:55 -0400
From: "Wesley H. Peace [MVP]" <wesley.peace@ncons.com>
Subject: Re: Printing to Files.
Message-Id: <01bc5107$89744290$323aefce@hawk>
I've run into the same problem with Window95 app. The app worked
flawlessly on my test source file as long as it was small. And the output
was formatted just like I wanted it to appear in the destination file.
BUT when I went to the real source, containing over 1200 lines, it blew up
in my face. I did find how to turn off buffering assuming that was the
problem, and yes I incorporated this into my code. No effect. Assuming it
was a limitation of the O/S, I moved it to an NT machine, again No effect,
same results.
Since this is one of those issues that I refuse to let get the better of
me, I'm open to suggestions.
--
---------------------------------------------------------
Wesley.Peace@ncons.com
Microsoft BackOffice - MVP
Persistent people begin their success where others end in failures.
-Edward Eggleston
------------------------------
Date: 24 Apr 1997 19:36:38 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Problem with Oraperl...
Message-Id: <5joqq6$2j7$1@tholian.cse.psu.edu>
Upgrade to Perl5 and the DBI/DBD-Oracle modules. Included is the Oraperl
emulation which should run your legacy scripts.
Happy Perl'ng,
John
groenvel@cse.psu.edu
------------------------------
Date: Thu, 24 Apr 1997 11:42:31 -0400
From: Robert Yung <ryung@ml.com>
To: Sascha Teske <slash@deil.de>
Subject: Re: raw input
Message-Id: <335F7F67.6462@ml.com>
If you run your script on a Unix box, you can try the following:
system("stty -icanon min 1");
while (read(STDIN, $buf, 1)) {
print ">$buf<\n";
}
Hope this will help!
Sascha Teske wrote:
>
> hi everybody,
>
> this is my first time "talking news" so sorry for my maybe dump behavior
>
> I have a Problem i want to write an more intelligent chat and want to
> use perl is there a way to get data before or without a newline "amen" ?
> don't say RTFM to me, I DID !!!
>
> thank you helper ...
>
> slash@deil.de
--
Robert Yung
Consultant @ Work
------------------------------
Date: Thu, 24 Apr 1997 22:34:48 GMT
From: clothed@imaginet.fr (clothed)
Subject: REQ: free cgi script harbour
Message-Id: <5jomtu$bco@belzebul.imaginet.fr>
Hi everybody
I have a java applet wich is a counter page.
It run with a cgi script and a text file wich store the count value.
My Internet Service Provider refuse to harbour my cgi script for
security considerations.
I'm looking on the net for a place where I could freely made harbour
this cgi script and the associated text file.
If someone know where I can do this, please mail me to:
clothed@imaginet.fr
Thanks a lot.
------------------------------
Date: Fri, 25 Apr 1997 01:37:47 +0200
From: William Krige <9435697@mail.petech.ac.za>
Subject: Run UNIX commands
Message-Id: <335FEECB.502A@mail.petech.ac.za>
Hi all
I was wondering if it is possible to run a command with a perl script,
just like you would normally do with UNIX.
e.g last root
tail -f /usr/adm/syslog/syslog.log | grep "Thu 18"
How would you run a commands like the ones above in perl, if it can be
done.
I am trying to manipulate the log files by using perl scripts through a
web browser. I would like to know if it is possible or not.
Could someone maybe send me some example perl code for the above
examples if possible.
I would greatly appreciate your help
Thank You
William Krige
9435697@ml.petech.ac.za
------------------------------
Date: Thu, 24 Apr 1997 23:24:52 GMT
From: kokopelli@radix.net (Kokopelli)
Subject: set noclobber
Message-Id: <5joq44$1rg_004@kokopelli.radix.net>
How can I determine if a user has set noclobber? Basically, in pseudocode I
want to something like this:
if set noclobber = true
set clobflag=true
else
set clobflag=false
unset noclobber
run myprogram
if clobflag=true
set noclobber
If you have any suggestions, please e-mail to kokopelli@radix.net
////
(o o) E-Mail: kokopelli@radix.net
--o0O--(_)--O0o--
| / / ___ | |__ ___ ___ ___ | || |<_>
| \ / . \| / // . \| . \/ ._>| || || |
|_\_\\___/|_\_\\___/| _/\___.|_||_||_|
|_|
------------------------------
Date: Thu, 24 Apr 1997 17:18:26 -0500
From: Bruce Bromberek <bromberek@cems.umn.edu>
Subject: shells, system, and pipes
Message-Id: <335FDC32.41C6@cems.umn.edu>
Greetings-
I'm a perl-hacker-in-training-wannabe who probably has a very simple
question that I'm asking in a rather longwinded way.
I wrote once before regarding I problem I had with the system command. I
was using it to communicate with an external serial device ie
system"stage -a 1000 1000";
The problem is that the stage controller is slow and takes a variable
amount of time to complete it's task so that
system"stage -a 1000 1000";
system"stage -a 5000 5000";
will produce an equipment error.
To date my solution has been to use sleep commands liberally throughout
my script.
I thought I had a solution by opening a pipe to a csh via
open(CMD, "|csh -s > raster.log");
print CMD "stage -a 1000 1000\n";
but after 4 or 5 commands i still get the the equipment error.
(and if I string 4 or 5 commands in a shell via ; the same things
happens)
So then I thought, Ahha! I will deal with these commands in a subroutine
and not return until I've read the the result of the command like
sub stagecmds{
print "in the loop from hell\n";
open(CMDS, "stage -a 1000 1000 |");
c$ = join('',<CMDS>);
# code to check contents of c$
close CMDS;
}
But this dies because the stage command with options does not like |
So what I need (I guess) is a way to get the output of a command into
perl without using the above contruction.
Suggestions?
(p.s. I'd rewite the controller in perl if I had the time and an example
of RS232 comunications on a SGI in Perl)
------------------------------
Date: Thu, 24 Apr 1997 22:52:59 GMT
From: niksun@lconn.net (Niksun)
Subject: Verifying URL's
Message-Id: <335fe415.9925868@news.inetw.net>
Is there a way to verify URL's in Perl? For instance, let's say I
have a form and someone submits a URL to my Perl script. I want my
script to check out and see if the URL is valid. Is this possible?
Niksun
------------------------------
Date: Thu, 24 Apr 1997 19:19:38 -0400
From: "Wesley H. Peace [MVP]" <wesley.peace@ncons.com>
Subject: Re: What's the equivalent to sendmail with NT?
Message-Id: <01bc5105$f7713890$323aefce@hawk>
NT does not natively have a sendmail equivalent. You might want to get a
copy of blat or many of the other freeware applications that run on NT.
--
---------------------------------------------------------
Wesley.Peace@ncons.com
Microsoft BackOffice - MVP
Persistent people begin their success where others end in failures.
-Edward Eggleston
ranger@onramp.net (Gregory Reddin) wrote in article
<335ebd3e.818655@news.onramp.net>...
> Hi all:
>
> I've moved from a Unix based web server to Windows NT. Now, my perl
> scripts that use sendmail don't work anymore. What can I use on NT
> that's the equivalant to sendmail?
>
> Also, each of these scripts used to create a log file but this doesn't
> work either.
>
> Any help would be greatly appreciated.
>
> Gregory
>
------------------------------
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 366
*************************************