[17979] in Perl-Users-Digest
Perl-Users Digest, Issue: 139 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 25 06:05:33 2001
Date: Thu, 25 Jan 2001 03:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980420711-v10-i139@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 25 Jan 2001 Volume: 10 Number: 139
Today's topics:
ActivePerl Modules Installation Problems <chaus@ssu.samara.ru>
Allocating ports in perl ayeletma1@my-deja.com
Re: calling java from perl as a cgi <comdog@panix.com>
Re: Catching warnings from Getopt::Std (Johan Vromans)
Re: Converting text to html <Jerome.Abela@free.fr>
Re: database (Dirk Bernhardt)
Re: DOS commands with long directory names (Villy Kruse)
Dynaloader Perl compile problem <hsbirdi@creatus.com>
Re: exec cgi with parameters problem. Can any of you be <comdog@panix.com>
Re: FAQ 1.14: Where can I get a list of Larry Wall wi <comdog@panix.com>
Re: FileHandle Question? (Eric Bohlman)
HELP WANTED: perl ans oracle database <rmillet@enssat.fr>
Re: How can i delete an item in the middle of an array <Jerome.Abela@free.fr>
Re: huh? <comdog@panix.com>
Re: looping and string comparison egwong@netcom.com
Re: newbie question on exec command <comdog@panix.com>
Re: newbie question on exec command <comdog@panix.com>
Newbie question: unpacking a C structure prpr1685@my-deja.com
Re: Newbie question: unpacking a C structure egwong@netcom.com
pdf2html philhibbs@my-deja.com
Re: Perl is bad at (very) simple math! <nospam@nospam.com>
Re: Perl is bad at (very) simple math! <josef.moellers@fujitsu-siemens.com>
Re: Perl is bad at (very) simple math! <comdog@panix.com>
Re: stock market simulator <comdog@panix.com>
Re: use of defined, undef on references (DBI::DBD) <comdog@panix.com>
Re: use of defined, undef on references (DBI::DBD) <Peter.Dintelmann@dresdner-bank.com>
Re: use of defined, undef on references (DBI::DBD) <Peter.Dintelmann@dresdner-bank.com>
Re: write ignores $= <comdog@panix.com>
Re: Write me a perl program, please egwong@netcom.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Jan 2001 13:54:32 +0400
From: "Konstantin Chaus" <chaus@ssu.samara.ru>
Subject: ActivePerl Modules Installation Problems
Message-Id: <94ot65$2d92$1@berg.samara.net>
Hellow Everybody!
I have a problem (see subj). I've downloaded the latest version of
ActivePerl (www.activestate.com). There was a remark, that for correct work
of ppm I need to download the new version of 'XML-Parser'. Without it when I
tried to install any additional module (for Win32) I got an error that there
(in module pakadge) wasn't any win32 version of this module. After
installation the new ver of XML-Parser my PPM've stopped working. Every time
I try to launch it i got an error message
--
"Can't load 'C:/_ApacheWS/usr/site/lib/auto/XML/Parser/Expat/Expat.dll' for
module XML::Parser::Expat: load_file:One of the library files needed to run
this application cannot be found at C:/_ApacheWS/usr/lib/DynaLoader.pm line
200."
--
Though the Expat.dll is REALLY exists in this catalog.
Thanx to all people who will answer me.
--
Konstantin Chaus
Programmer @ UpPosition::Web Studio
URL: http://www.upp.da.ru
E-mail: chaus@ssu.samara.ru
------------------------------
Date: Thu, 25 Jan 2001 08:54:44 GMT
From: ayeletma1@my-deja.com
Subject: Allocating ports in perl
Message-Id: <94opki$ul6$1@nnrp1.deja.com>
I need to allocate a port and check port status from a perl script.
Is there a function or a package I can use?
Thanks,
Ayelet
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 03:09:12 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: calling java from perl as a cgi
Message-Id: <comdog-C875E6.03091225012001@news.panix.com>
In article <94nqrk$5gu$1@nnrp1.deja.com>, basoft@my-deja.com wrote:
> It works as expected from the unix command line but not when called
> from a web page. Both the perl and java programs have full executable
> attributes.
>
> The perl program contains the statement
> $response = `java myapplication.ja`;
> print "$response\n";
> print $?/256;
have you gone through all of the steps in the CGI troubleshooting
guides referenced in the CGI Meta FAQ?
http://www.sri.net/public/CGI_MetaFAQ.html
future CGI questions should go to comp.infosystems.www.authoring.cgi.
follow-ups set.
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: 25 Jan 2001 09:07:17 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Catching warnings from Getopt::Std
Message-Id: <wl366j4m4wa.fsf@plume.nl.compuware.com>
James Taylor <james@NOSPAM.demon.co.uk> writes:
> I'm trying to use Getopt::Std to process command line options
> with code similar to this:
>
> <snippet removed>
>
> However, when an unknown option is encountered Getopt::Std just
> removes it from @ARGV and displays the warning "Unknown option: x"
> which my program does not know about. I would like my program to be
> told when there are unknown options so that I can stop with a suitable
> error message. Any ideas anyone?
I'd suggest to use Getopt::Long instead. Despite the name, it handles
single-character options and bundling just like Getopt::Std.
use Getopt::Long;
Getopt::Long::Configure(bundling);
my $i;
GetOptions("i" => \$i) or USAGE;
...
-- Johan
------------------------------
Date: Thu, 25 Jan 2001 10:33:03 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Converting text to html
Message-Id: <3A6FFFE8.4E74D61D@free.fr>
pularis@my-deja.com a écrit :
> If a line begins with certain words ( i.e Server ) I want the line to
> be centred ( by including the line between <center> tags ) how can I do
> this ?.
s/Server (.*)/<center>$1<\/center>/;
> Also I would like to make all numbers bold ( by including em in
> <b>,</b> tag.
s/(\d+)/<b>$1<\/b>/g;
> What regular xpressions should i use to accomplish this task. thx
Use "perldoc perlre" to learn about perl regular expressions.
Jerome.
------------------------------
Date: 25 Jan 2001 08:25:11 GMT
From: nospam@krid.de (Dirk Bernhardt)
Subject: Re: database
Message-Id: <94ont7$7bt$1@nets3.rz.RWTH-Aachen.DE>
I don't know the book, but...
mellouet.ronan <mellouet.ronan@wanadoo.fr> wrote:
> sub init_words {
> while ( defined($filename=glob("*.secret")) ){
Look here -----------------------------^^^^^^^^
That matches all files in your current working directory ending with '.secret'.
> open (WORDLIST, $filename)|| die "couldn't open wordlist: $!";
> if(-M WORDLIST<7.0) {
>
> while ($name=<WORDLIST>){
> chomp ($name);
> $words=<WORDLIST>;
typo? ---------------^
Should be '$word', or?
> So the problem is for read the database wordlist : I' don't know wich
> name I should give to it. The program doesn't recognize it. I've tried
> "wordlist.txt" and "wordlist" but it doesn't work. The database is in the
> same directorie of my program Hello.pl.
Try e.g. "wordlist.secret".
HTH,
Krid
------------------------------
Date: 25 Jan 2001 09:57:47 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: DOS commands with long directory names
Message-Id: <slrn96vu4r.378.vek@pharmnl.ohout.pharmapartners.nl>
On Wed, 24 Jan 2001 18:11:55 -0000,
Chris Stith <mischief@velma.motion.net> wrote:
>Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote:
>> On Mon, 22 Jan 2001 18:28:42 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>>>lbieg@my-deja.com wrote:
>
>> BTW, DOS can accept slashes in pathnames either way, but COMMAND.COM
>> does not. Thus for system() you do need backslashes between path name
>> components. That is, of course, if system() calls the external program
>> using COMMAND.COM instead of directly. Even so, many DOS programs don't
>> like pathnames with forward slashes either.
>
>Even more clarification:
>
>DOS can accept forward slashes in a batch file, too. The following
>should work on your Windows system, or at least it does on my Win2k
>Professional at my desk at work:
>
> @if exist c:/windows/win.com echo It worked!
>
Win2000 is NT and not DOS, isn't it?
In any context where COMMAND.COM is looking for command flags you get a
problem. For example "dir /p" the /p is a flag to the dir command,
and not a directory name.
One of the DOS 2.2 releases had a command to change the flag character
so you could do "dir -p c:/xxx" instead of "dir /p c:\xxx". Only old
unix people, I assume, would ever appreciate this, though, and I suspect
that most of those old unix people was Microsoft people who has been
working with Xenix, the MS port of unix.
Villy
------------------------------
Date: Thu, 25 Jan 2001 01:20:50 -0800
From: "Harminder S. Virdi" <hsbirdi@creatus.com>
Subject: Dynaloader Perl compile problem
Message-Id: <Pine.SUN.4.30.0101250117530.1962-100000@thunder>
Hello,
I am trying to compile perl5.005_03 on a
Solaris2.6 with gcc 2.95.2, but I get the
following error, when the compile reached
the Dynaloader. Does anyone know what is
going on or how to get past this problem?
+ test ! -d ext/DynaLoader
+ echo Making DynaLoader (static)
Making DynaLoader (static)
+ cd ext/DynaLoader
makeargs=LINKTYPE=static CCCDLFLAGS=
target=all
+ test ! -f Makefile
+ test ! -f Makefile
+ config LIBPERL_A=libperl.a
ext/util/make_ext: config: not found
+ echo config failed, continuing anyway...
config failed, continuing anyway...
+ all LINKTYPE=static CCCDLFLAGS= LIBPERL_A=libperl.a
ext/util/make_ext: all: not found
+ exit
*** Error code 1
make: Fatal error: Command failed for target `lib/auto/DynaLoader/DynaLoader.a'
Any help would be truly appreciated. This issue is driving me crazy.
Thanks...
-- Harminder
------------------------------
Date: Thu, 25 Jan 2001 03:18:50 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: exec cgi with parameters problem. Can any of you beautiful people help?
Message-Id: <comdog-40B519.03185025012001@news.panix.com>
In article <3a6f4f41.47589361@news.btclick.com>,
webmaster@homecinemachoice.zerospam.com wrote:
> What I want to do is insert one of the forum pages into a page of one
> of the other domains.
> Obviously I can't #include virtual since the page being included is on
> the same server but in a different domain.
you could play tricks with DocumentRoot or FollowSymLinks.
> The only apparent solution is to run a cgi script to display the
> document :
> In the source page :
> <!--#exec cgi="/cgi-bin/review_comments.pl?page=000067.html" -->
most servers don't allow that syntax. if you are using apache
this is answered in the docs for mod_include.
this probably belongs in a servers group though.
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 03:10:55 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: FAQ 1.14: Where can I get a list of Larry Wall witticisms?
Message-Id: <comdog-F75A5D.03105525012001@news.panix.com>
In article <94ob19$h9a$4@216.155.32.165>, The WebDragon
<nospam@nospam.com> wrote:
> Thread :Bare Blocks
>
> Larry's comment : "This topic is dead. Don't feed the bears."
> *eyerolls*
> Do all tech-related people acquire a bizarre sense of humor eventually
> or is that a sub-function of Usenet in general? :)
it's the other way around. the bizarre people become techies.
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: 25 Jan 2001 08:19:24 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: FileHandle Question?
Message-Id: <94onic$7r6$2@bob.news.rcn.net>
Art Heyman <us004258@mindspring.com> wrote:
> One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
> One OS to find them | work: mv@pdv-systeme.de
> One OS to bring them all |
> http://www.pdv-systeme.de/users/martinv/
> And in the Darkness bind them.| home: martin@radiogaga.harz.de
> In the land of Mordor where the shadow lies ??? Yikes !
s/Mordor/Redmond/;
------------------------------
Date: Thu, 25 Jan 2001 12:05:29 +0100
From: Millet Regis <rmillet@enssat.fr>
Subject: HELP WANTED: perl ans oracle database
Message-Id: <3A700879.BED84139@enssat.fr>
hello,
could qnyone help me?
i'm trying to control an oracle database with perl under unix, but the
execution gives me the the error message:
install_driver(Oracle) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.005/alpha-dec_osf/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: dlopen: cannot load
/usr/local/lib/perl5/site_perl/5.005/alpha-dec_osf/auto/DBD/Oracle/Oracle.so
at /usr/local/lib/perl5/5.00502/alpha-dec_osf/DynaLoader.pm line 168.
i don't understqnd a single word, so if anybody knows the answer, could
he send it to me.
thanks a lot
------------------------------
Date: Thu, 25 Jan 2001 08:45:11 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: How can i delete an item in the middle of an array
Message-Id: <3A6FE6A0.425771FC@free.fr>
telecino a écrit :
> I have an array that is randomly composed each time some function is called.
> It contains many elements, each time in a different order, and it contains
> an item called "X" that i don't want there. I want to delet it from the
> array, but i don't know it's position, so i can't use splice.
Note that if you want to manipulate an unordered set of elements, using
the
keys of a hash would probably fit your need better than an array does.
delete $set{element_to_remove};
Jerome.
------------------------------
Date: Thu, 25 Jan 2001 03:11:28 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: huh?
Message-Id: <comdog-EAFBCE.03112825012001@news.panix.com>
In article <94nqru$5h1$1@nnrp1.deja.com>, hanja <hanja@my-deja.com>
wrote:
> I came across these two lines at the top of a script, and I am curious
> of what they mean.
> #!/bin/sh--#-*-perl-*-
> eval 'exec /usr/test/ap_cp/perl5/bin/perl -S $0 ${1+"$@"}' if 0;
please crosspost rather than posting the same message separately
to several groups. see my answer in the first group where i saw
this. ;)
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 08:24:00 GMT
From: egwong@netcom.com
Subject: Re: looping and string comparison
Message-Id: <AoRb6.18935$J%.1427621@news.flash.net>
Art Heyman <us004258@mindspring.com> wrote:
> Having read in a text file I need to compare changing values as I run
> down the "records" - easy enough in Dbase, Delphi , VB - but where is the
> "Skip", the "movenext" in Perl ? Where do I capture one line's variable to
> compare to the next line's ?
> open (f1, ">textfile");
> while ($line =<f1>)
> {
If you're opening a file to read, you'll want to use '<', rather than '>'
(which will truncate and open to write -- see "open" in the perlfunc
manpage and the perlopentoot manpage). Also, you'll want to check to
make sure that the open is successful. It's more common for filehandles
to be all caps (see perlstyle), but whatever makes you happy, non? :)
Anyhow it sounds like what you want something like this:
open( F, "<textfile" ) or die "Can't open textfile (@!)";
my $lastline = <F>;
while ( my $line = <F> ) {
if ( $lastline eq $line ) {
print $line;
}
$lastline = $line;
}
This will print out repeated lines from your file.
Note that the common perl idiom is to invert the 'if' block to have
a more "natural languagey" feel (see the perlsyn manpage for "if")
print $line if ( $lastline eq $line );
Note you can do the same thing from the command line with the one-liner:
% perl -ne 'print if $_ eq $last; $last = $_;' [filename]
(See the perlrun manpage to decipher the command line options available.)
Yes, it's a lot of reading of manpages, but I'm positive it'll be
worth it.
Good luck!
------------------------------
Date: Thu, 25 Jan 2001 03:22:43 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: newbie question on exec command
Message-Id: <comdog-1F41AC.03224325012001@news.panix.com>
In article <94o4u0$e2a$1@nnrp1.deja.com>, metamp@my-deja.com wrote:
> this script is causing error when called from a browser
> but run ok from shell
are you sure it is okay from the shell?
> #!/usr/bin/perl
>
> $a = exec pwd;
>
> print "content-type: text/html\n\n";
why doesn't that print from the shell?
take a look at the docs.
http://www.perldoc.com/perl5.6/pod/func/exec.html
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 03:23:22 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: newbie question on exec command
Message-Id: <comdog-721FF4.03232225012001@news.panix.com>
In article <94o5nc$ere$1@nnrp1.deja.com>, hanja <hanja@my-deja.com>
wrote:
> I don't believe a broswer can execute the exec command but I am not
> sure.
if you aren't sure, it is easy to check, and if you still aren't
sure, there is no reason to tell everyone ;)
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 08:42:04 GMT
From: prpr1685@my-deja.com
Subject: Newbie question: unpacking a C structure
Message-Id: <94ooss$u0e$1@nnrp1.deja.com>
I would like to use unpack to unpack a C structure such as the
following:
typedef struct {
/************************************************/
/* xxxxxxxxxxxxxxxxxxxxxx */
/************************************************/
char version [5+1];
/************************************************/
/* ...................... */
/************************************************/
char first_id [15+1];
char quantity [12+1];
char browser_type [128+1];
...
Will unpack ( 's6 s16 s13 s129...') do the trick or do I need to add
As, and/or xs? When do you use As and xs? Does it depend on the
compiler and the operating system which you are using?
The program that is going to supply a copy of the C structure listed
above to my Perl script has been compiled on Solaris 2.6 with gcc. Had
it been compiled on Windows 2000, would the padding in the structure
(were there any) be different between the resulting two structures?
Are there any documents available on the Web that dexcribe C-structure
padding in detail?
Many thanks.
Philippe de Rochambeau
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 10:00:39 GMT
From: egwong@netcom.com
Subject: Re: Newbie question: unpacking a C structure
Message-Id: <bPSb6.18951$J%.1434957@news.flash.net>
prpr1685@my-deja.com wrote:
> I would like to use unpack to unpack a C structure such as the
> following:
> typedef struct {
> char version [5+1];
> char first_id [15+1];
> char quantity [12+1];
> char browser_type [128+1];
> ...
>
> Will unpack ( 's6 s16 s13 s129...') do the trick or do I need to add
> As, and/or xs? When do you use As and xs? Does it depend on the
> compiler and the operating system which you are using?
unpack( 's6 ...) won't work here (unless you've got 16-bit chars).
Looking at "pack" and "unpack" in the perlfunc manpage, you'll see
for chars you want to use 'c' or 'C'. But since these look like
null-terminated strings, I think 'Z' in the unpack would be best.
my ($version, $first_id, $quantity, $browser_type) =
unpack( 'Z6 Z16 Z13 ...', $struct );
> The program that is going to supply a copy of the C structure listed
> above to my Perl script has been compiled on Solaris 2.6 with gcc. Had
> it been compiled on Windows 2000, would the padding in the structure
> (were there any) be different between the resulting two structures?
If all you've got in your struct are a bunch of arrays of chars, then
you should be okay. If you've for int's or float's, then you're going
to have to do a little more work to be sure that everything's read
properly (i.e. int's have to be read big-endian or little-endian.)
> Are there any documents available on the Web that dexcribe C-structure
> padding in detail?
???
There are tons of books (and web pages I'm sure) that go into excrutiating
detail about all manner of C data structures.
------------------------------
Date: Thu, 25 Jan 2001 10:33:21 GMT
From: philhibbs@my-deja.com
Subject: pdf2html
Message-Id: <94ovdh$2i5$1@nnrp1.deja.com>
I'm trying to convert a large (2MB, 700 pages) PDF file (unprotected)
to HTML. I've used the Adobe web service, which appears to be a perl
script, but it gets it all wrong. Any hyphenated or underscored term
(such as dynamic_cast, it's the ISO C++ standard) gets a space
inserted, many of the <TT> and most the </TT> tags are in the wrong
place, paragraphs all have <BR>'s at the end of each "printed" line,
etc. All in all, it's going to take me several days of hard work just
to identify all the errors, even if I use regexes to fix them (which I
am, but I'm only a journeyman-level grepper). Is anyone aware of a
better way to do the conversion?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 25 Jan 2001 08:30:55 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <94oo7v$q7d$1@216.155.33.13>
In article <t6ui3ecdn4pn39@corp.supernews.com>, Chris Stith
<mischief@velma.motion.net> wrote:
| I wouldn't call that failing. Figure out for yourself how to
| represent 0.1 in binary.
|
| There is such a thing as arbitrary precision mathematics, but
| computer hardware tend snot to support it. Perl uses the math
| capabilities present in the host platform.
as clear a description of Windows as I've ever heard. And probably the
most useful function to apply Windows to.
...but I digress.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 25 Jan 2001 10:28:27 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <3A6FF1BB.21B51224@fujitsu-siemens.com>
Chris Stith wrote:
> =
> Michael Stopp <stopp@eye.ch> wrote:
> > Can anybody explain why a perl script as simple as this can fail?
> =
> > $a =3D 5.1;
> > $b =3D 5;
> > print $a-$b, "\n";
> =
> > This produces:
> =
> > 0.0999999999999996
> =
> I wouldn't call that failing. Figure out for yourself how to
> represent 0.1 in binary.
> =
> There is such a thing as arbitrary precision mathematics, but
> computer hardware tend snot to support it. Perl uses the math
> capabilities present in the host platform.
Even with "arbitrary precision math", you will never be able to
correctly represent all results. You will just push the border further
up the road.
Switching to decimal math will prevent you from representing 1/3,
staying with binary will not allow you to correctly represent 1/10 etc.
The main problem of the OP is that he is fixed on this sequence of
digits.
AAMOF, the precision of the result is better than 10^-14! Only integer
math is precise.
The only solution would be some kind of symbolic math or lazy evaluation
where 1/3 would be represented as ... 1/3, not 0.333333333333...
Computers are not perfect, even if a lot of people strongly believe this
and would bet their life on it. Add to this the imprefection of the
people programming them and using them and you're heading for disaster
if you don't recognize this. Sad, but true.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Thu, 25 Jan 2001 04:55:35 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <comdog-49AC2B.04553525012001@news.panix.com>
In article <94oo7v$q7d$1@216.155.33.13>, The WebDragon
<nospam@nospam.com> wrote:
> In article <t6ui3ecdn4pn39@corp.supernews.com>, Chris Stith
> <mischief@velma.motion.net> wrote:
> | I wouldn't call that failing. Figure out for yourself how to
> | represent 0.1 in binary.
> |
> | There is such a thing as arbitrary precision mathematics, but
> | computer hardware tend snot to support it. Perl uses the math
> | capabilities present in the host platform.
> as clear a description of Windows as I've ever heard. And probably the
> most useful function to apply Windows to.
this has nothing to do with Windows. it's a digital computer thing.
--[339]$ perl -le 'print 5.1 - 5'
0.0999999999999996
--[340]$ uname -a
NetBSD ---- 1.4.3 NetBSD 1.4.3 (-----USER) #0: Tue Dec 19 12:25:51 EST 2000 root@juggler.panix.com:/devel/netbsd/1.4.3/src/sys/arch/i386/compile/PANIX-USER i386
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 03:13:58 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: stock market simulator
Message-Id: <comdog-D873D6.03135825012001@news.panix.com>
In article <3A6F29DC.5A7EFEDC@datashaping.com>, Vincent Granville
<vincentg@datashaping.com> wrote:
> I have it written in C. Anyone interested in a Perl version. I plan to
> distribute it free from my website (http://www.datashaping.com ), and
> will put a Perl version if enough people are interested.
i'm interested. my new purpose in life is stock market data.
is code available?
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 03:31:57 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: use of defined, undef on references (DBI::DBD)
Message-Id: <comdog-2AE887.03315725012001@news.panix.com>
In article <94ol3e$qf6$1@nnrp1.deja.com>, upuautiii@my-deja.com wrote:
> I'm using DBI::DBD features...
> I'm using fetchrow_hashref in subroutines.
> I'd like to 'return' the undefined value if a sql stmt returns no rows.
> I'm doing the following, but it's not working.
> return undef if $numRows == 0;
perhaps you want
return if ...
otherwise, in list context you return a list of one
element (which is undef) which is probably not what you
want.
what does "not working" mean?
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 09:35:32 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: use of defined, undef on references (DBI::DBD)
Message-Id: <94ooi7$6rj2@intranews.bank.dresdner.net>
Hi,
<upuautiii@my-deja.com> wrote in message news:94ol3e$qf6$1@nnrp1.deja.com...
> in MAIN.pl
> my $info = getUserInfo($key1);
> if (!defined $info)
> {
> print "no match";
> }
>
>
> in require1.pl
> sub getUserInfo
> {
> my $key = shift;
> $dbh = ...;
> $sth = ....;
please give us the full code.
> $sth->execute();
> my $numRows = $sth->rows();
> return undef if $numRows == 0;
>
> $row = $sth->fetchrow_hashref();
> return $row
> }
1. if execute() is successful, a true value will be returned
2. for _non-SELECTs_ execute() returns the number of rows
where '0 rows' is returned as 0E0 (0 but true)
3. for SELECTs execute() starts the query and does _not_ return
the number of rows (docu: "because most databases can't tell
in advance") but simply a true value.
I suspect you are using a SELECT and your test always succeeds.
Regards,
Peter Dintelmann
------------------------------
Date: Thu, 25 Jan 2001 10:04:42 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: use of defined, undef on references (DBI::DBD)
Message-Id: <94oq90$6ri2@intranews.bank.dresdner.net>
Sorry for giving the wrong info.
I read the message and kept the wrong thing
(execute() instead of rows() in mind).
Anyway one point remains true - the distinction
between SELECTs and non-SELECTs. The docu
recommends not to use rows() with SELECTs.
Peter
Just ignore my previous post.
------------------------------
Date: Thu, 25 Jan 2001 03:25:51 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: write ignores $=
Message-Id: <comdog-5BED3D.03255125012001@news.panix.com>
In article <SoJb6.123237$Z2.1522645@nnrp1.uunet.ca>, "Paul Williams"
<paulw@accesscable.net> wrote:
> I'm trying to break a report at record length (38 lines). I have a
> REPORT_FILE format and REPORT_FILE_TOP. I tried a global $= = 38; (and 10
> for exaggeration) but I always get a new _TOP every 60 lines. Any idea why?
did you select the right filehandle first? the format special
variables aren't truly global - each filehandle has its own
version of them.
see perlform
http://www.perldoc.com/perl5.6/pod/perlform.html
--
brian d foy <comdog@panix.com>
no longer for hire ;)
------------------------------
Date: Thu, 25 Jan 2001 10:22:21 GMT
From: egwong@netcom.com
Subject: Re: Write me a perl program, please
Message-Id: <x7Tb6.18953$J%.1435400@news.flash.net>
Buck <buck@private.mil> wrote:
> I am in need of a perl program that fixes a Y2K bug in my wife's Email
> program. Don't ask, Dude! She ain't NEVER gonna change. She's
> running a Win98 box and I've tried to fix the Y2K bug in that
> application with zero success, so I think the easiest way to handle
> this is to intercept what is sent and fix it "on the fly".
Man alive. Love is blind. Are you sure postfix itself can't fix the
date for you?
Anyhow, here's a Quick One-Page Hack that uses Net::Daemon (available from
CPAN (http://cpan.org)). All it does it act as a simple bridge between
ports 10025 and 10026, trying to fix any bad 'Date' headers it finds.
Good luck.
---------------------------------------------
package Filter::Mail::Date;
use strict;
use Net::Daemon;
use IO::Socket;
@Filter::Mail::Date::ISA = qw / Net::Daemon /;
sub Run {
my $self = shift();
my $sock = $self->{socket};
my $to = IO::Socket::INET->new(PeerAddr => 'localhost:10026')
or die "Can't connect to 10026";
while ( my $line = $sock->getline() ) {
if ( $line =~ /^Date: / ) {
my @header = split( /\s+/, $line );
$header[4] += 1900 if $header[4] < 2000;
$line = join( ' ', @header ) . "\n";
}
$to->print( $line );
}
$to->close();
}
package main;
use strict;
my $server = Filter::Mail::Date->new( {
localport => '10025',
logfile => 'STDERR',
pidfile => 'none',
proto => 'tcp',
}, \@ARGV );
$server->Bind();
---------------------------------------------
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 139
**************************************