[16944] in Perl-Users-Digest
Perl-Users Digest, Issue: 4356 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 18 09:05:30 2000
Date: Mon, 18 Sep 2000 06:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969282310-v9-i4356@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 18 Sep 2000 Volume: 9 Number: 4356
Today's topics:
Re: 'Listen' option on sockets <r.schwebel@zeutec.de>
[Q] Two Questions (Farooq Azam)
Re: [Q] Two Questions (Martien Verbruggen)
Re: Can not read arrays from <STDIN> <undergronk@my-deja.com>
Re: Can not read arrays from <STDIN> <e.roselli@volusoft.com>
Re: Copying Files <-EViL-DOC-@BLUR.COM>
Re: Copying Files <olthoff@multiboard.com>
Emacs modules for Perl programming (Jari Aalto+mail.perl)
Finding the width and height of a GIF <fb@geo-guide.com>
Re: Finding the width and height of a GIF (Gwyn Judd)
Re: Finding the width and height of a GIF <c4jgurney@my-deja.com>
Re: Finding the width and height of a GIF (Martien Verbruggen)
Re: Finding the width and height of a GIF (Gwyn Judd)
HELP on NetServer::Generic <arolfes@dds.nl>
Re: HELP on NetServer::Generic <carvdawg@patriot.net>
Help: Problem making DBD::Oracle v0.44 <verbunroX@Xiquip.nl>
How to do that ? <ken@aboutmedia.com.tw>
intermittent glob error <m_j_o@my-deja.com>
Re: Is this terribly inefficient? <bart.lateur@skynet.be>
Re: Is this terribly inefficient? (Martien Verbruggen)
Re: Life of a perl script (Martien Verbruggen)
Re: Module for CGI Session Management? <ubl@schaffhausen.de>
Re: Newbie - Should I learn Perl or Javascript <ubl@schaffhausen.de>
Re: perl and web (Tony L. Svanstrom)
Re: perl and web (Martien Verbruggen)
Serial port and threads <r.schwebel@zeutec.de>
Re: Serial port and threads (Eric Bohlman)
single line regex and multi-line regex without resettin (Eric Smith)
Re: sprintf() rounding problem mexicanmeatballs@my-deja.com
Re: sprintf() rounding problem <fb@geo-guide.com>
Re: sprintf() rounding problem <e.roselli@volusoft.com>
type=password ... null problem? bte@umich.edu
Re: Using range operator mexicanmeatballs@my-deja.com
Using SSI in PERL-CGI a_b_c_d_e_fsadas@my-deja.com
Using SSI in PERL-CGI a_b_c_d_e_fsadas@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 Sep 2000 11:45:29 +0200
From: Robert Schwebel <r.schwebel@zeutec.de>
Subject: Re: 'Listen' option on sockets
Message-Id: <39C5E439.B2A46C66@zeutec.de>
Uri Guttman wrote:
> because the listen socket is still active, it will let connections get
> started.
Thanks for the hint, it works now.
Robert
--
_
/ \ _ Dipl.-Ing. Robert Schwebel r.schwebel@zeutec.de
--/ \ / \/--------------------------------------------------------
\_/ ZEUTEC Opto-Elektronik GmbH www.zeutec.de
Kieler Str. 211, 24786 Rendsburg, Germany
Phone: +49-4331-136-653 Fax: +49-4331-136-651
+++ Neue Adresse! +++ New Address! +++ Neue Adresse! +++ New Address!
++++
------------------------------
Date: 18 Sep 2000 12:19:27 GMT
From: azam@birch.ee.vt.edu (Farooq Azam)
Subject: [Q] Two Questions
Message-Id: <8q518f$g67$1@solaris.cc.vt.edu>
Hello,
I have two questions for which I could not find an answer to from the
books I have.
1- What will happen if I specify a number like 0.123 or
00.123. As far as I understand, the numbers that start with
0 in Perl are treated as octal numbers whereas these
numbers are floating point decimal format numbers.
2- In Perl, varibales can be represented as $x or ${x}. What
is the significance or reason for exitance of the second
notation?
Thanks for your time
-Farooq
------------------------------
Date: Mon, 18 Sep 2000 23:34:56 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: [Q] Two Questions
Message-Id: <slrn8sc2vg.ntr.mgjv@martien.heliotrope.home>
On 18 Sep 2000 12:19:27 GMT,
Farooq Azam <azam@birch.ee.vt.edu> wrote:
> Hello,
>
> I have two questions for which I could not find an answer to from the
> books I have.
>
> 1- What will happen if I specify a number like 0.123 or
> 00.123. As far as I understand, the numbers that start with
> 0 in Perl are treated as octal numbers whereas these
> numbers are floating point decimal format numbers.
Only integers
$ perl
$foo = 077;
$bar = 0.123;
print "$foo $bar\n";
__END__
63 0.123
> 2- In Perl, varibales can be represented as $x or ${x}. What
> is the significance or reason for exitance of the second
> notation?
One reason is
$ perl
for $foo qw(monkey horse)
{
print "2 ${foo}s\n";
}
__END__
2 monkeys
2 horses
In other words, it's a way of separating the variable name from any
other things that otherwise would be considered to be a part of the
name.
s/match${regex}other_characters/$foo;
Use it whenever you need to make really clear where the variable name
starts and ends.
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Mon, 18 Sep 2000 11:16:09 GMT
From: Scott Kirk <undergronk@my-deja.com>
Subject: Re: Can not read arrays from <STDIN>
Message-Id: <8q4the$33j$1@nnrp1.deja.com>
In article <20000917173040.29221.00000011@ng-fp1.aol.com>,
yzzus1@aol.com (YzzuS1) wrote:
> Hello
Hello.
> I am very new to Perl and programming. I am using Windows 95
> and Perl 5.22.
This probably means you are using ActiveState Perl binary build 522.
This is actually Perl 5.005_03
> When I try to read and array from <STDIN> by using control-D
> or control-Z I dump the program. Is there another control character
> in Windows to just state end of file?
Ctrl-Z works just fine for me. I can't really tell what the problem is
without seeing your code..
Why not set your loop to exit when you type in a particular character,
rather than a control key?
#!/usr/bin/perl -w
system('cls');
do {
$_ = <STDIN>;
chomp;
print $_;
} while ($_ ne "x");
NB You need to chomp() the input because it will have a carriage return
at the end.
> Also, how do you clear the screen? In basic the command is clr.
The locals get upset if you ask two unrelated questions in the same
message. But since you asked nicely..
In Perl you can do anything in a script that you can do from the
command line with the system() function. The command to clear the
screen under DOS is 'cls' so you could try
system('cls');
then make sure you read perlfaq8 - How do I clear the screen
perldoc perlfaq8
perlfaq8 also gives some other tips on how to handle keyboard inputs.
HTH
--
Scott Kirk
My deja.com mailbox is full of spam. Use this instead:
perl -e '$_ = "znvygb: haqretebax\@lnubb.pbz";
tr/A-Za-z/N-ZA-Mn-za-m/; print;'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 14:52:27 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Re: Can not read arrays from <STDIN>
Message-Id: <8q53ek$grn$1@wanadoo.fr>
YzzuS1 a écrit dans le message
<20000917173040.29221.00000011@ng-fp1.aol.com>...
>Hello,
> I am very new to Perl and programming. I am using Windows 95 and
Perl
>5.22. When I try to read and array from <STDIN> by using control-D or
control-Z
>I dump the program.
I too am relatively inexperienced in the matter, and others here will advise
you better than me. However, I met the same problem using the same tools as
you.
I got round it by entering my data as a string, separating the entries with
a ":" or other character unlikely to be needed in the data itself. I could
then take that apart with a "split" function on said character and affect
each element of the resulting array to a different variable.
See, here is how I got a program to split up a line of <STDIN> such as
4:11:22:20 into separate values representing eleven degrees, 22 minutes and
twenty seconds of the 4th astrological sign (Cancer), and then converting
these to a single value in seconds for use in further arithmetical
caluclations:
sub readZodVal{
@zodValArray = ();
$line = (<STDIN>);
chomp $line;
@zodValArray = split (/:/, $line);
return @zodValArray;
}
sub convertToSec {
$Sign = $_[0];
$Degree = $_[1];
$Minute = $_[2];
$Second = $_[3];
$SecValue = $Sign * 108000 + $Degree * 3600 + $Minute * 60 + $Second;
return $SecValue + 0;
}
Admittedly, this is only practical with short, easily typed entries to an
array of fixed and limited length. If you're typing in a whole table of
contents, it would hardly be practical to doit all on one line!
Hope that helps a little,
Elisa Francesca Roselli
------------------------------
Date: Mon, 18 Sep 2000 19:09:07 +1000
From: "-EViL-DOC-" <-EViL-DOC-@BLUR.COM>
Subject: Re: Copying Files
Message-Id: <8q4i9n$t5r$1@nina.pacific.net.au>
isnt it
copy src dest >nul
?
<gtown97@my-deja.com> wrote in message news:8pup9n$hi4$1@nnrp1.deja.com...
> In article <39C2DBBF.A7D3A993@hotmail.com>,
> Patrick Connolly <patrickjos@hotmail.com> wrote:
> >
> > I'm trying to develop a perlscript to copy files (on windows nt) from
> > one directory to another. The simple requirements are:
> > 1. The timestamp of the file must NOT be modified.
> > 2. There must be no "noise" output to the screen.
> > 3. There should be a way to verify that the copy was successful.
> >
> > The problem:
> > 1. I've tried the copy() function from File::Copy module. On windows
> > NT, it modifies the timestamp to current time.
> > 2. I've tried using system("copy sourcefile destfile") but it prints
> > out noise to the screen for every file it copies.
>
> If it's just a matter of copying files on NT, you may want to see NT's
> copy documentation. It's probably got something in there about making
> it silent.
>
> copy /?
>
> Lauren
> --
> Call today for your copy of my latest book, "Giving off-topic answers".
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 08:45:27 -0400
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: Copying Files
Message-Id: <8q52p6$qf6$1@panther.uwo.ca>
Couldn't you spare the few lines of code and write the copy yourself?
"-EViL-DOC-" <-EViL-DOC-@BLUR.COM> wrote in message
news:8q4i9n$t5r$1@nina.pacific.net.au...
> isnt it
> copy src dest >nul
> ?
>
> <gtown97@my-deja.com> wrote in message news:8pup9n$hi4$1@nnrp1.deja.com...
> > In article <39C2DBBF.A7D3A993@hotmail.com>,
> > Patrick Connolly <patrickjos@hotmail.com> wrote:
> > >
> > > I'm trying to develop a perlscript to copy files (on windows nt) from
> > > one directory to another. The simple requirements are:
> > > 1. The timestamp of the file must NOT be modified.
> > > 2. There must be no "noise" output to the screen.
> > > 3. There should be a way to verify that the copy was successful.
> > >
> > > The problem:
> > > 1. I've tried the copy() function from File::Copy module. On windows
> > > NT, it modifies the timestamp to current time.
> > > 2. I've tried using system("copy sourcefile destfile") but it prints
> > > out noise to the screen for every file it copies.
> >
> > If it's just a matter of copying files on NT, you may want to see NT's
> > copy documentation. It's probably got something in there about making
> > it silent.
> >
> > copy /?
> >
> > Lauren
> > --
> > Call today for your copy of my latest book, "Giving off-topic answers".
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>
------------------------------
Date: 18 Sep 2000 10:19:25 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_969272286@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://home.eu.org/~jari/ema-keys.html
Maintainer: Jari Aalto <jari.aalto@poboxes.com>
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs
XEmacs/Emacs, is available to various platforms:
o Unix:
If you don't have one, bust your sysadm.
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
Emacs resources at http://home.eu.org/~jari/emacs-elisp.html
o W9x/NT:
http://www.gnu.org/software/emacs/windows/ntemacs.html
Emacs Perl Modules
Cperl -- Perl programming mode
.ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
.<olson@mcs.anl.gov> Bob Olson (started 1991)
.<ilya@math.ohio-state.edu> Ilya Zakharevich
Major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
starndard in newest Emacs.
TinyPerl -- Perl related utilities
.http://home.eu.org/~jari/tiny-tools-beta.zip
.http://home.eu.org/~jari/emacs-tiny-tools.html
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Load source code into Emacs, like Devel::DProf.pm
o Grep through all Perl manpages (.pod)
o Follow POD manpage references to next pod page with TinyUrl
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o TinyUrl is used to jump to URLs (other pod pages, man pages etc)
mentioned in POD pages. (It's a general URL minor mode)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in the tgz mentioned above]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example in the tgz (ema-tigr.ini) that shows
how to set up datatbases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to run the find for you, You can adjust
recursive grep options, ignored case, add user grep options.
You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
Check also ftp://ftp.ihs.com/pub/kevinr/
TinyCompile -- Browsing grep results in Emacs *compile* buffer
TinyCompile is minor mode for *compile* buffer from where
you can collapse unwanted lines, shorten the file URLs
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Mon, 18 Sep 2000 10:45:03 +0200
From: "Frode Bjerkholt" <fb@geo-guide.com>
Subject: Finding the width and height of a GIF
Message-Id: <lAkx5.2663$mq2.43201@news1.online.no>
Hi
Is there a command line utility to get the width and the height of a GIF out
there?
Or...a perl library other than GD that can do the same?
Thanks in advance to anyone who can give me a clue :-)
Best Regards
Frode Bjerkholt
------------------------------
Date: Mon, 18 Sep 2000 09:14:04 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Finding the width and height of a GIF
Message-Id: <slrn8sbn6q.gns.tjla@thislove.dyndns.org>
I was shocked! How could Frode Bjerkholt <fb@geo-guide.com>
say such a terrible thing:
>Hi
>
>Is there a command line utility to get the width and the height of a GIF out
>there?
>
>Or...a perl library other than GD that can do the same?
Image::Info
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Never worry about theory as long as the machinery does what it's
supposed to do.
-- Robert A. Heinlein
------------------------------
Date: Mon, 18 Sep 2000 09:27:46 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Finding the width and height of a GIF
Message-Id: <8q4n66$sak$1@nnrp1.deja.com>
In article <lAkx5.2663$mq2.43201@news1.online.no>,
"Frode Bjerkholt" <fb@geo-guide.com> wrote:
> Hi
>
> Is there a command line utility to get the width and the height of a
GIF out
> there?
>
> Or...a perl library other than GD that can do the same?
>
> Thanks in advance to anyone who can give me a clue :-)
>
Check out the Image::Size module on CPAN.
use Image::Size;
($x, $y) = imgsize("mypic.gif");
Will give you the x and y dimensions of your picture. It works with a
wide range of different image formats and sources. It's a very handy
module indeed.
Jeremy Gurney
SAS Systems Analyst | Protherics Molecular Design Ltd.
"When everything is coming your way, you're in the wrong lane."
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 21:24:05 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Finding the width and height of a GIF
Message-Id: <slrn8sbra5.ntr.mgjv@martien.heliotrope.home>
On Mon, 18 Sep 2000 09:14:04 GMT,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Frode Bjerkholt <fb@geo-guide.com>
> say such a terrible thing:
> >Hi
> >
> >Is there a command line utility to get the width and the height of a
> >GIF out there?
> >
> >Or...a perl library other than GD that can do the same?
>
> Image::Info
Slightly immature code, I believe? And it doesn't actually support GIF
(yet?).
I'd probably, at this time, recommend Image::Size, or
Image::Magick->Ping.
Martien
--
Martien Verbruggen |
Interactive Media Division | Think of the average person. Half of
Commercial Dynamics Pty. Ltd. | the people out there are dumber.
NSW, Australia |
------------------------------
Date: Mon, 18 Sep 2000 12:45:50 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Finding the width and height of a GIF
Message-Id: <slrn8sc3jr.hr9.tjla@thislove.dyndns.org>
I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
say such a terrible thing:
>On Mon, 18 Sep 2000 09:14:04 GMT,
> Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>> Image::Info
>
>Slightly immature code, I believe? And it doesn't actually support GIF
>(yet?).
Well my copy says it supports GIF (this is version 0.4 I believe).
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I'm very old-fashioned. I believe that people should marry for life,
like pigeons and Catholics.
-- Woody Allen
------------------------------
Date: Mon, 18 Sep 2000 12:00:47 +0200
From: MegaNerd <arolfes@dds.nl>
Subject: HELP on NetServer::Generic
Message-Id: <hOPFOcWESZFqTMGde=SBsLx+XSFa@4ax.com>
Hi there,
Trying to build a server which responses on requests to a specific
TCP-port.
I saw that NetServer::Generic can provide such a service. Has anyone a
working script? I can't get the examples in the documention to work.
TIA
------------------------------
Date: Mon, 18 Sep 2000 06:23:15 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: HELP on NetServer::Generic
Message-Id: <39C5ED13.8E92C92E@patriot.net>
IO::Socket works great. It could be that something is missing from your
setup...perhaps a module or some code that the NetServer::Generic relies
upon?
MegaNerd wrote:
> Hi there,
>
> Trying to build a server which responses on requests to a specific
> TCP-port.
>
> I saw that NetServer::Generic can provide such a service. Has anyone a
> working script? I can't get the examples in the documention to work.
>
> TIA
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Mon, 18 Sep 2000 13:04:49 +0200
From: "Roel Verbunt" <verbunroX@Xiquip.nl>
Subject: Help: Problem making DBD::Oracle v0.44
Message-Id: <8q4scn$1ifh$1@buty.wanadoo.nl>
Hi,
I've got a problem building a proper DBD::Oracle driver on this platform:
HP-UX 11.0
Oracle RDBMS: 7.3.4.
Perl 5.003
DBI 0.79
DBD::Oracle 0.44
(DBI/DBD came with Oracle Web Application Server 3.02)
Building this driver should "only" take a few steps.
1) perl Makefile.PL
2) make
3) make test
4) make install
The third step fails with these messages:
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage:
/usr/lib/libcl.2
/usr/lib/dld.sl: Exec format error
This libcl.2 is not a library I asked him to load (see chatr output below).
Who is?
I'm not an expert on C, make, shared libraries and that kind of stuff.
What's thread local storage?
The pre-installed version had this same problem. That's why I'm trying to
remake it.
The best solution could be to upgrade DBI/DBD to the most recent versions,
but these required at least Perl 5.004. Upgrading Perl is not supported by
Oracle. (neither is OWAS 3.0.2 :-(( ). Does someone know a place where I
could download the highest version of DBI/DBD for Perl 5.003? It's not on
CPAN anymore.
Because of problems I had in the first two steps with locating the
directories with all the required library files, so I messed up the file
system a little. I don't know where files should be located. Could some send
me a list of his file-system and the values of important environment
variables?
Here's some more info on my Oracle.sl:
$find . -name Oracle.sl
./ows/3.0/perl/lib/site_perl/PA-RISC1.1/auto/DBD/Oracle/Oracle.sl
./ows/3.0/perl/lib/site_perl/PA-RISC/auto/DBD/Oracle/Oracle.sl
./ows/3.0/perl/ext/dbd-oracle-0.44/blib/arch/auto/DBD/Oracle/Oracle.sl
$ cd ows/3.0/perl/lib/site_perl/PA-RISC1.1/auto/DBD/Oracle
$ chatr Oracle.sl
Oracle.sl:
shared library
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
dynamic /prd02/oraweb/rdbms/lib/libclntsh.sl
shared vtable support disabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
data page size: D (default)
instruction page size: D (default)
$ ls -l Oracle.sl
-rwxrwxrwx 1 oraweb oraweb 1554272 Sep 18 10:07 Oracle.sl
Thanks,
Roel
------------------------------
Date: Mon, 18 Sep 2000 18:25:22 +0800
From: "Ken Hu" <ken@aboutmedia.com.tw>
Subject: How to do that ?
Message-Id: <8q4qgk$bv@netnews.hinet.net>
Dear Friends :
I am trying to write a code that will scan a specific directly
iteratively and each time it finds a
new file coming , it will do something on that new file.
I guess it should be something like a daemon to do that , and after
finding a new file , it create
a new thread to do some tasks , does it make any sense ?
Would anyone please give me some advise to do the whole thing ? I have
no idea right now how to
implement this kind of program.
Thanks a lot !!
Ken
------------------------------
Date: Mon, 18 Sep 2000 12:45:28 GMT
From: Mike <m_j_o@my-deja.com>
Subject: intermittent glob error
Message-Id: <8q52p2$8tv$1@nnrp1.deja.com>
Hello,
I've got Perl 5.005_03 running on Solaris 7, and I'm getting an error
from a glob call, but only from time to time. The error is like so:
glob failed (child exited with status 1) at cycle.pl line 45, <_GEN_3>
chunk 534.
Does this sound familiar to anyone? I'm globbing a reasonably large
directory (often has 2000+ messages), and the directory may be growing
while the glob takes place. Are either of these characteristics a
problem for a glob call?
cheers,
mjo
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 09:14:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is this terribly inefficient?
Message-Id: <jvmbsso69nuv4nm4v24hbkl93hl9vfjscq@4ax.com>
Martien Verbruggen wrote:
>Since the year most likely is a four digit number, the pack template
>(and the substr index) should be slightly different..
>
>@sorted =
> map { substr $_, 4 }
> sort
> map { pack("C2 S", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
> @unsorted;
Whoops. You I think your turned the wrong number into a short. The year
is upfront.
And you better make *sure* that that your short is in big-endian order,
or you'd get weird sorting for some years! Well, maybe lucky for you,
not in this century.
The pack template then is:
pack 'NCC', $year, $month, $day
To be honest, I don't understand the GRT preference to turn everything
into binary strings. What is wrong with plain and simple preformatted
text strings?
sprintf "%04d%02d%02d", $year, $month, $day
--
Bart.
------------------------------
Date: Mon, 18 Sep 2000 21:04:58 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is this terribly inefficient?
Message-Id: <slrn8sbq69.ntr.mgjv@martien.heliotrope.home>
On Mon, 18 Sep 2000 09:14:19 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Martien Verbruggen wrote:
>
> >Since the year most likely is a four digit number, the pack template
> >(and the substr index) should be slightly different..
> >
> >@sorted =
> > map { substr $_, 4 }
> > sort
> > map { pack("C2 S", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
> > @unsorted;
>
> Whoops. You I think your turned the wrong number into a short. The year
> is upfront.
Oops, indeed :)
> And you better make *sure* that that your short is in big-endian order,
> or you'd get weird sorting for some years! Well, maybe lucky for you,
> not in this century.
I guess this is one of the reasons I normally stay away from pack. I get
too nervous around pack templates. When I'm nervous, I make silly
mistakes.
> The pack template then is:
>
> pack 'NCC', $year, $month, $day
ITYM "nCC", since we don't need more than a short. N is a long.
> To be honest, I don't understand the GRT preference to turn everything
> into binary strings. What is wrong with plain and simple preformatted
> text strings?
>
> sprintf "%04d%02d%02d", $year, $month, $day
Pack is faster in many cases, and sprintf methods become harder to do
when the domain for your integers is 0 .. 2^31 or something like that.
pack is still efficient there, and uses the same template for any
integer in the range. of course, as we saw, pack requires decent thought
about what sort of representation your data wil end up in.
Just for the record (same benchmark program as upthread, with these subs):
'split-GRT' => sub {
@sorted =
map { substr $_, 4 }
sort
map { pack("nCC", reverse split('/', (split /\|/)[3])).$_ }
@unsorted;
},
'split-sprintf' => sub {
@sorted =
map { substr $_, 8 }
sort
map { sprintf("%04d%02d%02d", reverse split('/', (split /\|/)[3])).$_ }
@unsorted;
},
split-GRT: 6 wallclock secs ( 5.26 usr + 0.01 sys = 5.27 CPU) @
3028.84/s (n=15962)
split-sprintf: 6 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU) @
2779.89/s (n=14789)
The pack _is_ slightly (10%) faster. And this difference will get
progressively larger when the integers involved are larger (and you have
to change the sprintf template to accomodate for more digits).
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Mon, 18 Sep 2000 21:28:28 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Life of a perl script
Message-Id: <slrn8sbric.ntr.mgjv@martien.heliotrope.home>
On Sun, 17 Sep 2000 13:53:30 GMT,
mufy@my-deja.com <mufy@my-deja.com> wrote:
> I want to run a perl script once every day.
You say you don't have cron, but have you asked? Cron really is the best
way to do this. If they do not give you cron access, you could use the
standard at command; have the script reschedule itself for the next day.
> I do not have cron access to the server where the
> script is hosted, so I was thinking of using
> something like a sleep or suspend in my script,
^^^^^
# perldoc -f sleep
This is the age of the self-answering questions. We've been getting
loads of these lately. Anyway, you can use the sleep function, but it's
all pretty unreliable. If a machine reboots or an admin script shoots
your jobs or something else goes wrong, your daily job is gone. Much
better to reply on system tools.
> Please mail responces to mufy@techie.com
Post here, read here.
Martien
--
Martien Verbruggen |
Interactive Media Division | System Administration is a dirty
Commercial Dynamics Pty. Ltd. | job, but someone said I have to do
NSW, Australia | it.
------------------------------
Date: Mon, 18 Sep 2000 14:12:28 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Module for CGI Session Management?
Message-Id: <39C606AC.C9BDB5D6@schaffhausen.de>
brian d foy schrieb:
> In article <39C2DEAE.FAA9DFA5@shentel.net>, Albert Dewey <timewarp@shentel.net> posted:
>
> > I made my own routines to do precisely this. I generate a session number upon the
> > user entering the site using rand( ) and put this value into a cookie.
>
> this sounds like there could be a chance for non-unique session
> numbers. you should be using a lot more than just rand(), which isn't
> really random.
you could do something like:
$session_number = rand($range)
while(session_number_exists($session_number)) {$session_number = rand($range)}
malte
------------------------------
Date: Mon, 18 Sep 2000 09:04:40 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Newbie - Should I learn Perl or Javascript
Message-Id: <39C5BE87.16A7B8C4@schaffhausen.de>
The best thing would be to learn how to code JavaScript with Perl.
Later,
malte
Jim Verzino schrieb:
> I am going to spend some time learning some programming for the web. I am
> not sure if I should invest in learning perl or javascript first. I have a
> business need that would make perl a little smarter from a practicality
> perspective but that can be avoided if need be.
>
> I am not new to programming and know some programming languages, but those
> are a few years out of date. I do know that learning a new language is
> considerable investment though and I want to make the right choice.
>
> Are these competitors or complimentary. What are the pros and cons of one
> over the other. Any help would be appreciated.
>
> Jim Verzino
------------------------------
Date: Mon, 18 Sep 2000 09:18:51 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: perl and web
Message-Id: <1eh5dsf.vkhoz1kqv523N%tony@svanstrom.com>
<daud11@hotmail.com> wrote:
> I installed Perl in my windows NT server. I wanted to use it from the web
> as a CGI program. At first I got it working ie I was able to execute it
> from the web server using http://www..../cgi-bin/script.pl.
>
> Now it is no longer working. When the above url is tested it seems to
> download the file. Why? and how do i fix it?
I just tried it and the error is... Eh, no, I didn't, because you didn't
give me anything to try nor any code to look at.
Now you've got a new problem, and that is trying to figure out why I
couldn't even try to help you. Let me know when you figure it out.
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Mon, 18 Sep 2000 21:32:35 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perl and web
Message-Id: <slrn8sbrq3.ntr.mgjv@martien.heliotrope.home>
On Mon, 18 Sep 2000 05:44:36 GMT,
daud11@hotmail.com <daud11@hotmail.com> wrote:
> Hi
>
> I installed Perl in my windows NT server. I wanted to use it from the
> web as a CGI program. At first I got it working ie I was able to
> execute it from the web server using http://www..../cgi-bin/script.pl.
>
> Now it is no longer working.
That is correct. It isn't working. lynx tells me:
$ lynx -dump http://www..../cgi-bin/script.pl
Looking up www...
Invalid hostname www..
Alert!: Unable to connect to remote host.
lynx: Can't access startfile http://www.../cgi-bin/script.pl
$
> When the above url is tested it seems to
> download the file. Why? and how do i fix it?
it doesn't download anything for me.
Anyway, even if it had, we would not be able to help you, unless you
show us a MINIMAL amount of code that displays the problem, and you
better make sure that all your CGI and HTML stuff is correct, or you
will probably be told to go to comp.infosystems.www.authoring.cgi.
> Sent via Deja.com http://www.deja.com/
It's really time I put deja back in my score file.
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Mon, 18 Sep 2000 13:34:59 +0200
From: Robert Schwebel <r.schwebel@zeutec.de>
Subject: Serial port and threads
Message-Id: <39C5FDE3.1216C5B9@zeutec.de>
Hi!
I have to communicate with a device on the serial port which uses "\r"
as a line separator.
The problem is that my application is multithreading with one thread
printing output to the terminal (which obviously has to use \n as line
separator) and another one communicating with a serial device (which
sends \r).
How can this be done? Setting $/ from the "serial" thread changes the
line separator for the terminal output as well and vice versa.
For the autoflush $| it is possible to select() the file handle for
which it should be changed, but this seems not to be possible with $/.
Any idea?
Robert
--
_
/ \ _ Dipl.-Ing. Robert Schwebel r.schwebel@zeutec.de
--/ \ / \/--------------------------------------------------------
\_/ ZEUTEC Opto-Elektronik GmbH www.zeutec.de
Kieler Str. 211, 24786 Rendsburg, Germany
Phone: +49-4331-136-653 Fax: +49-4331-136-651
+++ Neue Adresse! +++ New Address! +++ Neue Adresse! +++ New Address!
++++
------------------------------
Date: 18 Sep 2000 11:55:56 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Serial port and threads
Message-Id: <8q4vsc$10t$2@slb7.atl.mindspring.net>
Robert Schwebel (r.schwebel@zeutec.de) wrote:
: I have to communicate with a device on the serial port which uses "\r"
: as a line separator.
:
: The problem is that my application is multithreading with one thread
: printing output to the terminal (which obviously has to use \n as line
: separator) and another one communicating with a serial device (which
: sends \r).
:
: How can this be done? Setting $/ from the "serial" thread changes the
: line separator for the terminal output as well and vice versa.
:
: For the autoflush $| it is possible to select() the file handle for
: which it should be changed, but this seems not to be possible with $/.
$\ (I assume that $/ is a typo, as that's the *input* record separator)
isn't associated with any particular filehandle, as you've discovered.
The best solution, IMHO, is to localize it and set it to the appropriate
value whenever you have to output text. e.g. your output to the serial
device should be done something like:
{local $\="\r";
print SER "destroy city=$city";
}
and your output to the terminal like
{local $\="\n";
print "In the process of destroying $city";
}
------------------------------
Date: 18 Sep 2000 12:36:20 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: single line regex and multi-line regex without resetting $/
Message-Id: <slrn8sc323.ehf.eric@plum.fruitcom.com>
I have text that must be parsed line by line but also multi-line paragraphs
enclosed with the `[' `]' characters. I can either to the single line
matchine or the multi-line matching, the latter by undef-ing $/; Problem
is that I cannot get the single line groking to work even with locally
undef-ing the $/ and then redefining it again - once it is undefined, the
whole file is slurped of course.
I have tried the s///m and s///s operators but am obviously missing
something.
thanx for any help.
Eric Smith
------------------------------
Date: Mon, 18 Sep 2000 09:19:11 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: sprintf() rounding problem
Message-Id: <8q4mm4$roj$1@nnrp1.deja.com>
In article <969038332.1919104262@news.uklinux.net>,
David Hugh-Jones <davidhj@mail.com> wrote:
> On Thu, 14 Sep 2000, mexicanmeatballs@my-deja.com wrote:
>
> >
> >Arg, the whole jeopardy thing has confused me....
> >
> >How's this:
> >
> >$rounded_up = int($value)==$value? $value :
sprintf("%.0f",$value+0.5);
> >
> >Or have I got the wrong end of the stick?
> >You want an always round up right?
> >Surely this was too trivial for a newsgroup?
>
> no, I don't always want to round up, I want to round up on 0.5 or
more. And it
> probably is very trivial, but I am so inept that I haven't yet found a
> solution: feel free to offer one!
> cheers
> dave
>
Apologies for the throw away remark, about triviality, reading the
rest of the thread it appears that it isn't.
Round up if the fraction is greater than or equal to 0.5 (and the
value is positive):
$rounded = ($value-int($value))>=0.5? int($value)+1 : int($value);
There's apparently another issue with correctly calculating the
percentage in the first place, I'll leave that to people who know
their maths.
--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 12:20:09 +0200
From: "Frode Bjerkholt" <fb@geo-guide.com>
Subject: Re: sprintf() rounding problem
Message-Id: <vZlx5.2715$mq2.44223@news1.online.no>
I'm not sure if I have completly understood the problem...but this might be
a solution:
$rounded_up = int(int($value * 2.0 + 1.0) / 2);
<mexicanmeatballs@my-deja.com> wrote in message
news:8q4mm4$roj$1@nnrp1.deja.com...
> In article <969038332.1919104262@news.uklinux.net>,
> David Hugh-Jones <davidhj@mail.com> wrote:
> > On Thu, 14 Sep 2000, mexicanmeatballs@my-deja.com wrote:
> >
> > >
> > >Arg, the whole jeopardy thing has confused me....
> > >
> > >How's this:
> > >
> > >$rounded_up = int($value)==$value? $value :
> sprintf("%.0f",$value+0.5);
> > >
> > >Or have I got the wrong end of the stick?
> > >You want an always round up right?
> > >Surely this was too trivial for a newsgroup?
> >
> > no, I don't always want to round up, I want to round up on 0.5 or
> more. And it
> > probably is very trivial, but I am so inept that I haven't yet found a
> > solution: feel free to offer one!
> > cheers
> > dave
> >
>
> Apologies for the throw away remark, about triviality, reading the
> rest of the thread it appears that it isn't.
>
> Round up if the fraction is greater than or equal to 0.5 (and the
> value is positive):
>
> $rounded = ($value-int($value))>=0.5? int($value)+1 : int($value);
>
> There's apparently another issue with correctly calculating the
> percentage in the first place, I'll leave that to people who know
> their maths.
>
> --
> Jon
> perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 14:14:32 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Re: sprintf() rounding problem
Message-Id: <8q517h$9d0$1@wanadoo.fr>
mexicanmeatballs@my-deja.com a écrit dans le message
<8q4mm4$roj$1@nnrp1.deja.com>...
>Round up if the fraction is greater than or equal to 0.5 (and the
>value is positive):
>
>$rounded = ($value-int($value))>=0.5? int($value)+1 : int($value);
Doesn't that still leave aproblem with the hundredths? I.e. we want a
round-up at the second decimal place, not the first - 6.75 rounding up to
6.76 as it were. So adding one to a whole value isn't going to help, if I'm
understanding you correctly.
Elisa Francesca Roselli
------------------------------
Date: Mon, 18 Sep 2000 09:07:08 GMT
From: bte@umich.edu
Subject: type=password ... null problem?
Message-Id: <8q4lvk$r4k$1@nnrp1.deja.com>
Hi,
On my website, I have an HTML form that people can fill out. This form
submits to a perl script which inserts the data which the user entered into
an mSQL table. The vast majority of the fields that the user fills out go
into the mSQL table fine. However, the password and verification password
fields, which are the only 2 fields designated as "type=password", have a
high frequency of null entries.
The perl script is supposed to prevent null entries in the HTML form from
being processed (i.e inserted into the mSQL table). Is it possible that the
use of "type=password" (you know, the little bullets instead of characters)
is in some way responsible for the many null entries in the mSQL table?
I know that I can specify these fields as "NOT NULL" in the mSQL table, but I
don't want one out of four people who fill out my form to receive a
"designated not-null" error when they, in fact, filled out those fields in
the HTML form. Any help or insight would be greatly appreciated.
Please let me know if I wasn't clear in specifying my problem. I would be
happy to elaborate.
Thanks,
Brian
bte@umich.edu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 09:42:31 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: Using range operator
Message-Id: <8q4o25$ta7$1@nnrp1.deja.com>
In article <39C5597A.5AD3FA84@stomp.stomp.tokyo>,
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Randy wrote:
>
> > Is there a simple way to use the range operator to
> > check if a value falls within?
>
> > Something like:
>
> > $num=5;
> > print "In range\n" if ($num == (1..20));
>
> This is a simple numerical range check with
> three input arguments represented by $number,
> which represents a number to compare to a range
> and, $begin_range and $end_range, which sets
> an inclusive numerical range. Caution should
> be used regarding how large of a range is set.
> Memory can be eaten up for a very large range,
> if a range much like they have in Texas.
>
> #!/usr/local/bin/perl
>
> print "Content-type: text/plain\n\n";
>
> $number = 5;
> $begin_range = 0;
> $end_range = 10;
>
> for ($iterate = $begin_range; $iterate <= $end_range; $iterate++)
> {
> if ($iterate == $number)
> { print "$number is within a range of $begin_range to $end_range,
> inclusive."; last; }
> elsif ($iterate == $end_range)
> { print "$number is not within a range of $begin_range to
$end_range,
> inclusive."; }
> }
>
> exit;
>
Memory wont be eaten up with larger ranges, the memory usage of this
algorithm is static.
Still a stupid program though, I guess it's intended as a joke?
--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 11:27:28 GMT
From: a_b_c_d_e_fsadas@my-deja.com
Subject: Using SSI in PERL-CGI
Message-Id: <8q4u6i$3oa$1@nnrp1.deja.com>
I have a small(?) problem.
In one of my script i am opening a file that
contains some html.
I use this file as a header on my page.
But the problem is that in that file i have a SSI
command that executes another cgi-script.
And the when the perl script reads the file it
don't execute the SSI-command.
Is there anyone that know how to solve this
problem?
Peter J
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Sep 2000 11:27:28 GMT
From: a_b_c_d_e_fsadas@my-deja.com
Subject: Using SSI in PERL-CGI
Message-Id: <8q4u6i$3o9$1@nnrp1.deja.com>
I have a small(?) problem.
In one of my script i am opening a file that
contains some html.
I use this file as a header on my page.
But the problem is that in that file i have a SSI
command that executes another cgi-script.
And the when the perl script reads the file it
don't execute the SSI-command.
Is there anyone that know how to solve this
problem?
Peter J
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4356
**************************************