[10937] in Perl-Users-Digest
Perl-Users Digest, Issue: 4538 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 3 16:07:13 1999
Date: Sun, 3 Jan 99 13:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 3 Jan 1999 Volume: 8 Number: 4538
Today's topics:
DynaLoader and dylperl: To link a c function to PERL ? <blackk@dial.oleane.com>
Re: Editor <gellyfish@btinternet.com>
failed tests for perl5.005_02 Bart.Haezeleer@nospam.pobox.com
Re: faking the referer in HTTP::Request::Form (brian d foy)
Re: fetch pages (brian d foy)
Re: Formatting Dates (Searching for date + 30) webmaster@entrepreneur-online.com
Freelance Perl writer needed ! <abc@abc.com>
Re: Is interpolation/parsing in s/// possible? <dgris@moiraine.dimensional.com>
Re: looking for perl programmer (brian d foy)
Re: Make Gif/jpeg file (brian d foy)
Re: need short delay <tchrist@mox.perl.com>
Re: new to PERL..need help <hutch@ma.nospamplease.ultranet.com>
Re: Newbie - OPEN() gives sh error - why? <gellyfish@btinternet.com>
Re: noop (Abigail)
Re: Problem Retreiving Web documents using User Agent M (brian d foy)
Re: Problem with read and eof (TheLaser)
Re: Problem with read and eof (TheLaser)
Re: Quick operator question <gellyfish@btinternet.com>
Re: Quick operator question <aidan@salvador.blackstar.co.uk>
Re: Server misconfiguration error (Abigail)
Re: Shipping Script??? Help? <webmaster@2webspinners.com>
strange behaviour of m/\G.../g regular expression <freak001@mmp.lu>
Re: strange behaviour of m/\G.../g regular expression (brian d foy)
Re: uppercase (Abigail)
Virtual Stores Built w/ Perl 5 "Active Perl" and Cold F <webmaster@2webspinners.com>
Wanted Perl Programmer/Design House <david@tvml.co.uk>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 3 Jan 1999 18:57:44 +0100
From: "Black K" <blackk@dial.oleane.com>
Subject: DynaLoader and dylperl: To link a c function to PERL ?
Message-Id: <76ob75$qg6$1@minus.oleane.net>
Hye,
I am looking to link a .a file to perl programs to call a c function from
PERL with input and output parameters.
I thought to use Dynaloader but the manual says: "the DynaLoader, by itself,
is practically useless for accessing non-Perl libraries... A
ExtUtils::Dynalib module is available from .... which performs that function
for some common system types"
I am a newbie in PERL. Did anyone test this ? What is the specific process
to perform ? Any example on the Net ?
What about dylperl ? any example ?
It seems to me quite a heavy work to link a .a file to Perl ?
Does anyone have any clue to make it easier ? Performing a c program calling
the c function included in the .a file and the calling this new program from
PERL ?
Thanks for all of you,
KB
------------------------------
Date: 3 Jan 1999 18:29:52 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Editor
Message-Id: <76ocv0$hu$1@gellyfish.btinternet.com>
On Sun, 03 Jan 1999 12:49:36 -0500 Bob Nugent wrote:
> Would somebody suggest a proper language/script editor
> for Win95? I was trying to get a bbs working when my
> sysad said that all the perl files have 2 returns " ^M "
> after #!/usr/bin/perl. All I have is Wordpad, Notepad
> and Fusion. None of which show those characters. I need
> to edit a bunch of files before sending to the server.
>
In order to avoid one of the regular lengthy Editor Advocacy threads
I would suggest that you should check out:
<URL:http://reference.perl.com/query.cgi?editors>
There are listed there various editor resources and you probably find one
that is to your taste.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 03 Jan 1999 18:40:21 GMT
From: Bart.Haezeleer@nospam.pobox.com
Subject: failed tests for perl5.005_02
Message-Id: <368fb56c.115874517@news.ping.be>
I'm a newbie on upgrades perl, but for some programs I need perl 5.005
or higher.
I found a TAR.GZ ball with version 5.005_02
Some of the test fails and I can't figure out why ?
The compilation when very well. Other scripts work very well.
My configuration : Slackware 2.0.35 + glibc2
These are the tests that fails:
op/goto_xs.........FAILED at test 0
pragma/locale......FAILED at test 0
lib/anydbm.........FAILED at test 0
lib/db-btree.......FAILED at test 0
lib/db-hash........FAILED at test 0
lib/db-recno.......FAILED at test 0
lib/dumper-ovl.....FAILED at test 0
lib/dumper.........FAILED at test 0
lib/filecopy.......FAILED at test 6
lib/filehand.......FAILED at test 0
lib/io_dup.........FAILED at test 0
lib/io_pipe........FAILED at test 0
lib/io_sock........FAILED at test 0
lib/io_taint.......FAILED at test 0
lib/io_tell........FAILED at test 0
lib/io_udp.........FAILED at test 0
lib/io_xs..........FAILED at test 0
lib/ipc_sysv.......FAILED at test 0
lib/ndbm...........FAILED at test 0
lib/opcode.........FAILED at test 0
lib/open2..........FAILED at test 0
lib/open3..........FAILED at test 0
lib/ops............FAILED at test 0
lib/ph.............FAILED at test 0
lib/posix..........FAILED at test 0
lib/safe1..........FAILED at test 0
lib/safe2..........FAILED at test 0
lib/sdbm...........FAILED at test 0
lib/socket.........FAILED at test 0
lib/thread.........FAILED at test 0
To check the tests one by one I ran them as follow :
#cd /usr/src/perl5.005_2/t
#perl op/goto_xs.t
1..0
# Fcntl unavailable, can't test XS goto.
#op/goto_xs.t
Segmentation fault
myconfig output:
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=linux, osvers=2.0.35, archname=i486-linux-thread
uname='linux pc00 2.0.35 #2 tue oct 20 16:30:58 met dst 1998 i486
'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O2', gccversion=2.7.2.1
cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL -DSTRUCT_TM_HASZONE
-DHINT_SC_
EXIST -I/usr/local/include'
ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL -DSTRUCT_TM_HASZONE
-DHINT_SC_
EXIST -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lpthread -lc -lposix
-lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
ldd ../perl output:
libnsl.so.1 => /lib/libnsl.so.1 (0x40002000)
libgdbm.so.1 => /lib/libgdbm.so.1 (0x40008000)
libdb.so.2 => /lib/libdb.so.2 (0x4000e000)
libdl.so.1 => /lib/libdl.so.1 (0x4001c000)
libm.so.6 => /lib/libm.so.6 (0x4001f000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40038000)
libc.so.6 => /lib/libc.so.6 (0x40045000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x400e9000)
Please reply also via email because I can't read allways the
newsgroups.
------------------------------
Date: Sun, 03 Jan 1999 15:13:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: faking the referer in HTTP::Request::Form
Message-Id: <comdog-ya02408000R0301991513420001@news.panix.com>
In article <368F37DD.743529DB@link-maker.com>, webmaster@link-maker.com posted:
> I need to set the http_referer in a script that uses HTTP::Request::Form.
>
> When I dump() the script returns the base as the correct referer but
> when I check the referer on the recieving end there is nothing...
>
> I tried using HTTP::Headers, but had no luck...
>
> Any help would be great!
God helps those who help themselves. perhaps you'd like to share
a bit of your code so we might recognize the problem?
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
HTTPeek <URL:http://www.smithrenaud.com/public/httpeek.shtml>
------------------------------
Date: Sun, 03 Jan 1999 15:22:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: fetch pages
Message-Id: <comdog-ya02408000R0301991522170001@news.panix.com>
In article <Pine.GSO.4.03.9901010236010.21952-100000@virtue.csis.hku.hk>, help <wclui@virtue.csis.hku.hk> posted:
> Suppose I am connected to the Internet through PPP and I want to write a
> perl script and run in my local machine.
>
> Suppose I have a URL, say
> http://xxx.com/xxx.jpg
> How can I open a connection to the site and fetch the image?
> N.B. I have to fetch the page through the proxy server, e.g. yyy.
use the LWP module. see the docs for details. good luck :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 03 Jan 1999 19:07:09 GMT
From: webmaster@entrepreneur-online.com
To: ebohlman@netcom.com
Subject: Re: Formatting Dates (Searching for date + 30)
Message-Id: <76of4t$6e7$1@nnrp1.dejanews.com>
In article <ebohlmanF4zCy5.M5s@netcom.com>,
Eric Bohlman <ebohlman@netcom.com> wrote:
> webmaster@entrepreneur-online.com wrote:
> : Scenario: Using the code below, I pieced together a date reminder script
that
> : supposed to allow a visitor to enter a date and store it into a flat file
> : database. The third field is the $dateStamp and the line in the db looks
like
> : this:
> : |1|19990101|Jan. 1, 1999|New Year's Day|
>
> The testable form of the date is in your second field...
Your right, the testable field is the second.
>
> : Each time the script loads, it is required to SEARCH the date.txt and see if
> : any particular date is within future 30 days of the current date and PRINT
> : that date on the resulting html in the form of a checkbox.
>
> : Problem: The script has/will print to screen dates which are from 1998 but
not
> : from 1999. Where did I make the error and/or where can I locate information
on
> : formatting dates?
>
> : Code:
>
> : if ($dateStamp %10000 <200)
> : { $startDate = $dateStamp -8500;
> : }
> : if ($dateStamp %10000 >200)
> : { $endDate = $dateStamp +8800;
> : }
>
> : open (Event,"<$event") || &endIt;
> : while ($LINE = <Event>)
> : { @terms = split(/\|/,$LINE);
> : if ($startDate <= $terms[2] && $endDate >=$terms[2])
>
> But you're making your comparison on your third field. Unless you tell
> perl otherwise (and you didn't), Perl arrays are zero-based.
>
> : { print "<LI> <INPUT TYPE=CHECKBOX NAME=\"$terms[1]\"><INPUT TYPE=hidden
> : NAME=\"$terms[2]\">";
> : print "$terms[3] -- $terms[4]";
>
> All your other field indices are off by one. $terms[4] is undefined.
I disagree. The fourth field is defined or none of the dates would be printed
to the screen, including dates from 1998. Because it did print dates from
1998 but will no longer print dates of any kind, the error must be in the
dating portion of the script.
In a database delimited in the following fashion:
|1|19990101|Jan. 1, 1999|New Year's Day|
The field indices would be:
0= undefined
1= entry number
2= $dateStamp
3= $realDate
4= $eventDate
>
> : }
> : }
> : close (Event);
>
--
Sincerely,
April Melton
------------------------
Owner
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 3 Jan 1999 18:28:24 GMT
From: "Ken" <abc@abc.com>
Subject: Freelance Perl writer needed !
Message-Id: <01be3746$af30c540$51051f26@mobile>
Not really a question, but a help wanted ad!!
Cameo One, LLC is in need of a knowledgeable, experienced
and RELIABLE Perl writer for our Adult Site's scripting.
We are currently moving our site to new servers, and need
a writer to help with the transition, as well as compile
some administrative scripts for our Customer/User DB's.
Future long-term work is also possible, with timely payment
for timely, professional work. If interested and available
soon, please post here and/or call Ken @ 1-800-900-5640.
Thank you!
------------------------------
Date: 03 Jan 1999 11:33:22 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Is interpolation/parsing in s/// possible?
Message-Id: <m3yankfbpp.fsf@moiraine.dimensional.com>
bady@primenet.com (Mark Badolato) writes:
> Previously, tadmc@metronet.com (Tad McClellan) wrote:
> > You don't use $1 in a regex, you use \1 instead...
> Even in a substitution as being used above?
> $_ = "this is a test";
> s/(\w+)/<$1>/g; # $_ is now "<this> <is> <a> <test>"
>
> Which is used when? (sorry, im still just getting the hang regex stuff)
s/// has a regex on the left side and a sort of double quotish
thing on the right. If you need to reference a previous capturing
group in the regular expression (the left side) you need to use \1.
If you need to reference the group from the replacement (the left
side) then you use $1.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sun, 03 Jan 1999 15:19:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: looking for perl programmer
Message-Id: <comdog-ya02408000R0301991519370001@news.panix.com>
In article <19990101002820.01032.00001285@ng-cg1.aol.com>, parplex@aol.com (Parplex) posted:
> i am looking for an intermediate-expert perl programmer to do some programming
> for my Co. in return you get 20 megs, cgi-bin, front page support, and much
> more..possable money depending on how good. Email parplex@aol.com.
> HURRY
translation: we don't have any money because we're a new or failing
business. we want to screw you. HURRY.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 03 Jan 1999 15:20:52 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Make Gif/jpeg file
Message-Id: <comdog-ya02408000R0301991520520001@news.panix.com>
In article <368C1B8C.B76DE340@xs4all.nl>, Frank de Bot <debot@xs4all.nl> posted:
> How can I make with a perlscript from 2 files (1.gif and 2.gif) one
> image with Perl? I've downloaded some counters that do that, but I still
> don't know how it works. Please give a simple example
besides the other solutions mentioned, you might like Image::Magick.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 3 Jan 1999 18:41:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: need short delay
Message-Id: <76odkd$82s$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, "jupp" <jupp@media-point.de> writes:
:Hi, does anybody know a short delay, so around 200-500 ms instead of the
:unprecise Sleep 1 ?
In what sense is sleep(1) imprecise? The fact that you cannot
guarantee when it will go off? Because of time-sharing issues
and how you only know that it be at least that long, but may
be longer? Because we don't have real-time guarantees?
Because you can't mix sleep and alarm? Because you're already
using itimers for something else? Because you haven't read
about the select() function in the perlfunc manpage and how
it can be used for fine-grained timeouts?
:Or has anybody a better idea how to deal with the fast networks ?
Um, what does the network speed (bandwidth, latency?) have to do
with anything?
--tom
--
I believe in the waterbed theory of linguistics.
If you push down here, it pops up there.
-- <1993Jan20.181244.8680@netlabs.com>
------------------------------
Date: Sun, 3 Jan 1999 12:48:55 -0500
From: "Hutch" <hutch@ma.nospamplease.ultranet.com>
Subject: Re: new to PERL..need help
Message-Id: <76ob0l$g6p$1@strato.ultra.net>
>I use ATT Worldnet as an ISP. They don't have a cgi-bin. Can I still use a
>PERL script?
<snip>
> I don't have PERL on my machine and I don't know if ATT does either. Do
you need it to run the
>script?
You don't need Perl on your own machine to write a Perl script, but you
would need your ISP to have Perl, so you can upload/test remotely. If they
don't allow CGI scripts, then I would think that Perl is out of the
question.
Many many ISPs offer Perl, so it shouldn't be too hard for you to find a
more competitive host that satisfies your needs.
Hutch
------------------------------
Date: 3 Jan 1999 17:44:01 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Newbie - OPEN() gives sh error - why?
Message-Id: <76oa91$c9$1@gellyfish.btinternet.com>
On Sun, 3 Jan 1999 10:20:38 -0600 Tad McClellan wrote:
> Jonathan Stowe (gellyfish@btinternet.com) wrote:
> : On Thu, 31 Dec 1998 17:23:38 GMT Philip de Lisle wrote:
>
> : > I have to open a pipe to a program and pass it some parameters which could
> : > contain spaces so they need to be in quote marks. My code looks like
> : >
> : > $Name = "Philip de Lisle";
> : > $user = "pdelisle";
> : > $password = "dsfas/wrh431";
> : > open(UA, "| /usr/sbin/useradd -M -c '$Name' -p $password $user") || die
> : > "open: $!";
> : > close(UA);
>
>
> : You would also have a problem with the *single* quotes around $Name which
> : would prevent its interpolation by Perl and thus the literal '$Name' will
> ^^^^^^^^^^^^^^^^^^^^^^^^^
> : get passed to the shell for interpolation and almost certainly there isnt
> : one so thus you error. When you have to mix quotes like this it is better
> : to use the generalized quoting methods (see perlsyn).
>
>
> Eh?
>
>
> -------------------------
> #!/usr/bin/perl -w
>
> $Name = 'Philip de Lisle';
> $user = 'pdelisle';
> $password = 'dsfas/wrh431';
>
> print "| /usr/sbin/useradd -M -c '$Name' -p $password $user", "\n";
> -------------------------
>
> prints:
>
> | /usr/sbin/useradd -M -c 'Philip de Lisle' -p dsfas/wrh431 pdelisle
>
>
>
> Single quotes inside of double quotes are just plain characters,
> they don't suppress interpolation...
>
>
Oops. Yes as a quick look at the relevant parts of the perlop manpage
would have reminded me - Obviously the new year celebrations have wiped
clean parts of my brain :-)
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 3 Jan 1999 20:11:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: noop
Message-Id: <76oitt$k4b$1@client3.news.psi.net>
EVILjosh (engineer@noorg.org) wrote on MCMLI September MCMXCIII in
<URL:news:368F0170.715D6D96@noorg.org>:
++ Hi folks,
++
++ Is there any kind of a noop keyword in Perl?
++ Thank you.
{;}
Abigail
------------------------------
Date: Sun, 03 Jan 1999 15:21:41 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem Retreiving Web documents using User Agent Module
Message-Id: <comdog-ya02408000R0301991521410001@news.panix.com>
In article <19981231174936.08434.00004242@ng-fu1.aol.com>, tommy1452@aol.com (Tommy1452) posted:
> I am writing a program to retrieve several, actually 100's of web documents
> from a server, the problem is the program freezes after the seventh request.
> How do I fix this?
find out what the problem is then fix it. we might be able to help
with either of those if you give more information :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 03 Jan 1999 19:51:04 GMT
From: prjohnsonat@utahlinxdot.com (TheLaser)
Subject: Re: Problem with read and eof
Message-Id: <368fc9fa.11171670@209.66.79.182>
On Sun, 03 Jan 1999 12:47:03 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:
>TheLaser wrote:
>
>>I'm very new to perl and am having trouble with the read function. I seem
>>to be hitting eof too early (only 131 bytes in for a 430 byte file, 155
>>bytes in for a 20473 byte file). I'm using read(SOURCE,$in,1); to get the
>>file one byte at a time inside a while loop. If if matters I'm running
>>perl under win95. Anybody seen this before?
>
>binmode
>
>I bet there's a chr(26) in there somewhere.
Hey thanks everyone, I'll take a look at it when I get a minute.
--
TheLaser <prjohnson at utahlinx dot com>
------------------------------
Date: Sun, 03 Jan 1999 19:59:18 GMT
From: prjohnsonat@utahlinxdot.com (TheLaser)
Subject: Re: Problem with read and eof
Message-Id: <368fcbf6.11679897@209.66.79.182>
On Sun, 03 Jan 1999 19:51:04 GMT, prjohnsonat@utahlinxdot.com (TheLaser)
wrote:
>On Sun, 03 Jan 1999 12:47:03 GMT, bart.lateur@skynet.be (Bart Lateur)
>wrote:
>
>>TheLaser wrote:
>>
>>>I'm very new to perl and am having trouble with the read function. I seem
>>>to be hitting eof too early (only 131 bytes in for a 430 byte file, 155
>>>bytes in for a 20473 byte file). I'm using read(SOURCE,$in,1); to get the
>>>file one byte at a time inside a while loop. If if matters I'm running
>>>perl under win95. Anybody seen this before?
>>
>>binmode
>>
>>I bet there's a chr(26) in there somewhere.
>
>Hey thanks everyone, I'll take a look at it when I get a minute.
Just to let you know, putting binmode SOURCE; in there fixed everything.
Thanks for your help.
--
TheLaser <prjohnson at utahlinx dot com>
------------------------------
Date: 3 Jan 1999 18:18:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Quick operator question
Message-Id: <76oc8t$en$1@gellyfish.btinternet.com>
On 3 Jan 1999 15:52:20 GMT Aidan Rogers wrote:
> Is there a quicker way to do the following?
>
> $foo = 50 if $foo > 50;
>
There isnt a much quicker way - an alternative is
$foo = ($foo > 50 ? 50 : $foo );
As it appears that the BenchMeisters are out of town I guess I'll have to do
the right thing:
#!/usr/bin/perl -w
use Benchmark;
$foo = $ARGV[0];
timethese (262144, {
simple => sub { $foo = 50 if $foo > 50; },
conditional => sub { $foo = ($foo > 50 ? 50 : $foo) },
} );
Giving :
gellyfish@gellyfish:/home/gellyfish/clpmtest > ternbench.pl 50
Benchmark: timing 262144 iterations of conditional, simple...
conditional: 3 wallclock secs ( 2.39 usr + 0.00 sys = 2.39 CPU)
simple: 3 wallclock secs ( 2.14 usr + 0.00 sys = 2.14 CPU)
gellyfish@gellyfish:/home/gellyfish/clpmtest > ternbench.pl 75
Benchmark: timing 262144 iterations of conditional, simple...
conditional: 3 wallclock secs ( 2.39 usr + 0.00 sys = 2.39 CPU)
simple: 3 wallclock secs ( 2.15 usr + 0.00 sys = 2.15 CPU)
gellyfish@gellyfish:/home/gellyfish/clpmtest > ternbench.pl 45
Benchmark: timing 262144 iterations of conditional, simple...
conditional: 1 wallclock secs ( 2.42 usr + 0.00 sys = 2.42 CPU)
simple: 1 wallclock secs ( 2.14 usr + 0.00 sys = 2.14 CPU)
So it seems that the obvious method *is* quicker. Moreover its performace
is pretty consistent where the conditional operator seems to depend
on the sense of the comparison.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 3 Jan 1999 19:01:37 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Re: Quick operator question
Message-Id: <76oeqh$95t$1@nclient3-gui.server.ntli.net>
Thanks guys :)
Aidan
------------------------------
Date: 3 Jan 1999 20:13:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Server misconfiguration error
Message-Id: <76oj20$k4b$2@client3.news.psi.net>
Madenet (msantull@dimensione.com) wrote on MCMLI September MCMXCIII in
<URL:news:76nqp3$aeu@dante.italia.com>:
++ I wrote a PERL cgi which works without problems on W95 Perl 32.
++
++ It doesn't work in BSDI UNIX even if other Perl script work.
++
++ Do you know this problem ?
You have an error in line 17 of your code.
Abigail
------------------------------
Date: Sun, 3 Jan 1999 14:18:36 -0500
From: "Pittsburgh Web Spinners" <webmaster@2webspinners.com>
Subject: Re: Shipping Script??? Help?
Message-Id: <prPj2.722$qW6.226566@news.sgi.net>
is that all? seems a little steep!
www.2WebSpinners.com
Rich Grise wrote in message <367C8D1A.23F89951@entheosengineering.com>...
>vivekvp@hotmail.com wrote:
>>
>> Hello!
>>
>> I want a script that lists shipping costs. I would like it to be a drop
down
>> menu that would list ups or fedex...land, air...and their costs for each.
>>
>> this price - depending on selection would be tacked on to the total price
of
>> the item i want to sell..
>>
>> any help on this or where i could look?
>>
>> thanks!!
>
>Well, since this has nothing to do with perl, this probably isn't the
>place to
>ask about this. But e-mail me at richgrise@entheosengineering.com
>sometime
>after Monday Morning, and I'd be happy to write you a script for only
>$US75.00
>per hour, with an estimated completion time of 40 hours.
>
>Cheers!
>--
>Rich Grise
>off-duty@entheosengineering.com
>(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Sun, 03 Jan 1999 18:15:45 +0200
From: Matthias Schmitt <freak001@mmp.lu>
Subject: strange behaviour of m/\G.../g regular expression
Message-Id: <freak001-030119991815451098@mars.mmp.lu>
Hello,
I discovered a strange behavior of the \G option in a regular
expression. The following program tries to parse SSI commands in HTML
text. The program intends to process the string part-by-part to handle
each SSI command separately. It should list all SSI commands and its
preceding code inside HTML text, but it does not find a single one.
while (1) {
if ($html_code =~ /\G<!--#(.*?)-->/gcs) {
print "\nleading text:\n$`";
print "\nfound $1";
} else {
print "\nthe rest of it:\n $html_code";
last;
}
}
The next program does exactly what I want, without the \G option. To
simulate the exact position where the previous m//g left off, I am
using the $' variable to cut off the part before the previous match.
while (1) {
if ($html_code =~ /<!--#(.*?)-->/gcs) {
print "\nleading text:\n$`";
print "\nfound $1";
$html_code = $';
} else {
print "\nthe rest of it:\n $html_code";
last;
}
}
Does anybody know why the \G option fails in the first program ?
Matthias Schmitt
------------------------------
Date: Sun, 03 Jan 1999 15:10:47 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: strange behaviour of m/\G.../g regular expression
Message-Id: <comdog-ya02408000R0301991510470001@news.panix.com>
In article <freak001-030119991815451098@mars.mmp.lu>, Matthias Schmitt <freak001@mmp.lu> posted:
> while (1) {
> if ($html_code =~ /\G<!--#(.*?)-->/gcs) {
> print "\nleading text:\n$`";
> print "\nfound $1";
> } else {
> print "\nthe rest of it:\n $html_code";
> last;
> }
> }
> Does anybody know why the \G option fails in the first program ?
remember that \G anchors where the regex can start matching. looks
like you are seeing \G do exactly what it is documented to do.
however, it doesn't look like a problem that requires its use :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
HTTPeek <URL:http://www.smithrenaud.com/public/httpeek.shtml>
------------------------------
Date: 3 Jan 1999 20:15:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: uppercase
Message-Id: <76oj54$k4b$3@client3.news.psi.net>
imchat@ionet.net (imchat@ionet.net) wrote on MCMLI September MCMXCIII in
<URL:news:368eeafd.122081513@news.ionet.net>:
++ For some reason this bit of code is ignoring all files that start with
++ an uppercase letter. Any reason why its doing that? The code works
++ great except for the uppercase filenames.
++
++ @filenames = grep(/\.gif/,readdir(COP));
Looks like you ignore all all caps filenames here....
Abigail
------------------------------
Date: Sun, 3 Jan 1999 14:43:39 -0500
From: "Pittsburgh Web Spinners" <webmaster@2webspinners.com>
Subject: Virtual Stores Built w/ Perl 5 "Active Perl" and Cold Fusion.
Message-Id: <SOPj2.733$qW6.227135@news.sgi.net>
This Email is to notify you of a Special Offer on our new product that can
be of great savings in the E-commerce world. 100% AuthorizeNet compatible
and pre-configured, Browser Maintained (merchant info, tax rate, items,
categories, look, and layout), Unlimited Items, Unlimited Shopping Carts,
Save Cart features, Transaction risk-minimization plus many more feature,
all developed by Pioneers in Web Design and Development, Pittsburgh Web
Spinners.
Available in a Month to Month lease or one-time User License.
Weve developed the new product/application to plug-in to any web site and
be the sum of other web sites! It is called the VS2000 and is the Virtual
Store 2000. Built with Enterprise level technologies, Cold Fusion 4;
Javascript; and Perl 5 Active Perl. The VS2000 leads the way to setting
the standard on business friendly and human friendly web design and
development in the E-commerce arena.
Check it out at www.2webspinners.com/storefront/index.cfm or also at
www.ArtsSportStop.com to see them in action. The Program allows you to
upload items via the web browser(Netscape 3+ or IE4+ needed) into unlimited
Categories and sub-categories. A secure checkout is used to take payment
info when done shopping or send to AuthNet for online processing. The look
and layout are also controlled via the Store Manager to suit any and every
level of the business owner or site operator.
We have a special this month for only $800.00 for a User License or $45.00
per month with a $1.00 buyout after 24 months.
For more information please visit our Web Site at
www.2WebSpiners.com/virtual.htm
Thanks for your time,
-Michael Davis
General Partner/Webmaster
Pittsburgh Web Spinners
Spider@2webspinners.com
------------------------------
Date: Sun, 3 Jan 1999 19:35:42 -0000
From: <david@tvml.co.uk>
Subject: Wanted Perl Programmer/Design House
Message-Id: <76ofpk$gab$1@news8.svr.pol.co.uk>
Hello, we are looking for a web design house to build a database driven web
site.
This is our first very brief spec. We will be working on it this week to
smooth out the edges !
I have put the first prototype online for you to see at
<http://onlinegames.net/uktown>.
At present the links only work from the start page and some of these are
dead.
It is very rough but i now have to got and party !
The site is a listing guide for a UK town.
Basically I want all the content to come from the database and allow
individual users to add items - diary entries, business etc. Ie. it is a
very interactive site where the user updates the content.A basic listing
entry is free but a user must pay for a full entry - therefore a supervisor
needs to enable an account to have a full listing.
Sections
{denotes database fields}
1. News will be used to display local news - stories need the following
fields
{Date, Title, Story}
2. Local Information - displays a simple list of telephone nos etc
{Name, Address, Tel, Fax, Email, Web Page, Description}
3. Maps - Displays a list of available maps (can be only updated by the
supervisor). These point to external URL's that display the maps
{Name, Description, URL}
4. Diary. A list of events for the month. Any user can post an event.
Supervisors can remove any entry.
{Date, Description, URL}
5. Accomodation - list of hotels, flats etc. each one links to a new page
that displays a full page for the entry
{Name, Type, Price Band, Address, Tel, Fax, Email, Web Page, Description}
Full Entry Photo Page
{Photo1, Description1}
{photo2, Description}
6. Restaurants - as above
7. Entertainment.
Undecided at present
8. Classifieds. Allows a user to post an advert for a given page within a
given section. Supervisor can add sections - i.e.
{date, Section, title, description, price, name, contact (either email or
phone no) }
Add a special case for a personal advert
{Name, age, Sex, Hair Colour, Body Type,contact, description}
Would like to add a special case for a house
{datge, Area, No Bedrooms, Type, Price, Agent}
9. Forums - as per your standard forum software
10. Local Business - a business directory,
A-Z listing of sections - Accountancy, Advertising etc (we will provide this
list)
A basic listing and a full entry.
{Name, section, , Address, Tel, Fax, Email, Web Page, Description}
Full Entry Photo Page
{Photo1, Description1}
{photo2, Description}
11. The Full Entry Photo page should allow the user to upload a photo, a
thumnail plus a description and then choose a template (restaurant,
personal) - . This will probably reside on a seperate server
12. Postcard page - Very simple allows a user to send a postcard.
I am looking for a fixed price quote for the job split into 3 phases :-
Phase 1 : Prototype
(using our rough graphics)
Phase 2: Implementation and Changes
Once we are happy with the functionality we will commission professional
pages
Phase 3: Final Implementation
If you are interested please send me some details of previous commercial web
work
Thank you
David Wainwright
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4538
**************************************