[23283] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5503 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 15 03:06:07 2003

Date: Mon, 15 Sep 2003 00:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 15 Sep 2003     Volume: 10 Number: 5503

Today's topics:
        ---Module Installation Image::Info <bzhaoa@yahoo.com.cn>
        Can't call method "uri" on an undefined value (chad phillips)
    Re: Clean user input from CGI for output to WIN32::ODBC (Max Harvey)
    Re: closed filehandle <jurgenex@hotmail.com>
    Re: closed filehandle <samj@austarmetro.com.au>
    Re: closed filehandle <jurgenex@hotmail.com>
        dbm problem  HELP! <tom@nosleep.net>
        locale games - looking for portable ways to get a list  <doom@kzsu.stanford.edu>
        location of regular expression match (bob)
    Re: location of regular expression match <zoooz@gmx.de>
    Re: location of regular expression match <zoooz@gmx.de>
    Re: location of regular expression match <mooseshoes@gmx.net>
    Re: Newbie Help with Hashes <mooseshoes@gmx.net>
    Re: Optimising performance of Perl binary <mrbean@nospam.net>
    Re: Pattern Match Question.. <tim@vegeta.ath.cx>
    Re: Perl 5 for MS-DOS (Chas Friedman)
        Tie::DBI Quickie Question <mooseshoes@gmx.net>
    Re: Tring to kill my kids, but they are stuborn little  <grazz@pobox.com>
    Re: Tring to kill my kids, but they are stuborn little  <eric@dmcontact.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 15 Sep 2003 10:03:46 +0800
From: Bill Zhao <bzhaoa@yahoo.com.cn>
Subject: ---Module Installation Image::Info
Message-Id: <3F651E02.3040101@yahoo.com.cn>

Hi, Dear all

   I am old starter of per and is showing a program to my boss but
the program error without Image::Info
I then start to install this module but the result is wrong.
The beow is screen copy:

  Somebody can help me to fix this progrmam.

Bill Zhao


==========================Screencopy================================
[root@bz2003 mapivi0144]# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.59_54)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install Image::Info
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
   Database was generated on Sun, 14 Sep 2003 15:45:40 GMT
Running install for module Image::Info
Running make for G/GA/GAAS/Image-Info-1.12.tar.gz

   CPAN: MD5 security checks disabled because MD5 not installed.
   Please consider installing the MD5 module.

Scanning cache /root/.cpan/build for sizes
Image-Info-1.12/
Image-Info-1.12/test.ppm
Image-Info-1.12/test.png
Image-Info-1.12/Changes
Image-Info-1.12/test.xpm
Image-Info-1.12/MANIFEST
Image-Info-1.12/t/
Image-Info-1.12/t/exif.t
Image-Info-1.12/t/string.t
Image-Info-1.12/t/dim.t
Image-Info-1.12/t/png.t
Image-Info-1.12/t/bmp.t
Image-Info-1.12/lib/
Image-Info-1.12/lib/Image/
Image-Info-1.12/lib/Image/Info/
Image-Info-1.12/lib/Image/Info/XBM.pm
Image-Info-1.12/lib/Image/Info/BMP.pm
Image-Info-1.12/lib/Image/Info/TIFF.pm
Image-Info-1.12/lib/Image/Info/XPM.pm
Image-Info-1.12/lib/Image/Info/GIF.pm
Image-Info-1.12/lib/Image/Info/JPEG.pm
Image-Info-1.12/lib/Image/Info/PPM.pm
Image-Info-1.12/lib/Image/Info/PNG.pm
Image-Info-1.12/lib/Image/Info/SVG.pm
Image-Info-1.12/lib/Image/TIFF.pm
Image-Info-1.12/lib/Image/Info.pm
Image-Info-1.12/test.txt
Image-Info-1.12/test.xbm
Image-Info-1.12/test.jpg
Image-Info-1.12/test.svg
Image-Info-1.12/test.pbm
Image-Info-1.12/test.pgm
Image-Info-1.12/exifdump
Image-Info-1.12/imgdump
Image-Info-1.12/test.gif
Image-Info-1.12/Info.pm.tmpl
Image-Info-1.12/Makefile.PL
Image-Info-1.12/README
Image-Info-1.12/test.rle
Removing previously used /root/.cpan/build/Image-Info-1.12

   CPAN.pm: Going to build G/GA/GAAS/Image-Info-1.12.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Image::Info
cp lib/Image/Info/BMP.pm blib/lib/Image/Info/BMP.pm
cp lib/Image/Info/SVG.pm blib/lib/Image/Info/SVG.pm
cp lib/Image/Info/TIFF.pm blib/lib/Image/Info/TIFF.pm
cp lib/Image/Info.pm blib/lib/Image/Info.pm
cp lib/Image/Info/XBM.pm blib/lib/Image/Info/XBM.pm
cp lib/Image/Info/GIF.pm blib/lib/Image/Info/GIF.pm
cp lib/Image/Info/JPEG.pm blib/lib/Image/Info/JPEG.pm
cp lib/Image/Info/PNG.pm blib/lib/Image/Info/PNG.pm
cp lib/Image/Info/XPM.pm blib/lib/Image/Info/XPM.pm
cp lib/Image/Info/PPM.pm blib/lib/Image/Info/PPM.pm
cp lib/Image/TIFF.pm blib/lib/Image/TIFF.pm
Manifying blib/man3/Image::Info::XPM.3pm
Manifying blib/man3/Image::Info::BMP.3pm
Manifying blib/man3/Image::Info::SVG.3pm
Manifying blib/man3/Image::Info.3pm
Manifying blib/man3/Image::Info::XBM.3pm
   /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib 
-I/usr/lib/perl5/5.6.1/i386-linux -I/usr/lib/perl5/5.6.1 -e 'use 
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/bmp...............ok 

t/dim...............ok 

t/exif..............dubious 

	Test returned status 0 (wstat 11, 0xb)
t/png...............ok 

t/string............dubious 

	Test returned status 0 (wstat 11, 0xb)
Failed Test Status Wstat Total Fail  Failed  List of Failed
--------------------------------------------------------------------------------
t/exif.t   	   0    11    ??   ??       %  ??
t/string.t 	   0    11    ??   ??       %  ??
Failed 2/5 test scripts, 60.00% okay. 0/8 subtests failed, 100.00% okay.
make: *** [test_dynamic] Error 2
   /usr/bin/make test -- NOT OK
Running make install
-----------------------------------------------------------------------------------
===================Screen copy end===========================



------------------------------

Date: 14 Sep 2003 21:29:00 -0700
From: chad@windmeadow.com (chad phillips)
Subject: Can't call method "uri" on an undefined value
Message-Id: <1e6ea9f6.0309142029.4f40a279@posting.google.com>

I am trying to get Auth::Cookie to work and keep getting this error?

Can't call method "uri" on an undefined value at /path/login.pl line
6.

This is on a solaris box, with Apache 1.3.28.

The code is pretty straight forward:
#!/usr/bin/perl

use CGI qw(:standard :html3);
my $r = Apache->request;
$r->status(200);
my $uri = $r->prev->uri;

print redirect("http://mydomain.org/cgi-bin/askforsurvey.pl?uri=$uri");

This same script works just fine on my test machine, but not on my
production box.  My guess is that something in the environment/apache
compile is different.  Does anyone have any pointers as to where I
should look to fix this problem?

thanks
chad


------------------------------

Date: 14 Sep 2003 21:18:34 -0700
From: google@DELTAL.org (Max Harvey)
Subject: Re: Clean user input from CGI for output to WIN32::ODBC
Message-Id: <7a09b211.0309142018.1ec0bfdb@posting.google.com>

James Willmore <jwillmore@cyberia.com> wrote in message news:<20030914164204.768ea317.jwillmore@cyberia.com>...
> On Sun, 14 Sep 2003 08:45:11 -0600
> Ron Reidy <r_reidy@comcast.net> wrote:
> > Look qt quote() in perldoc DBI
> > 
> > Max Harvey wrote:
> > > I have a simple script which takes input from CGI, and outputs it
> > > to a database with WIN32::ODBC.
>                               ^^^^^^^^^^^^
> > > 
> > > The problem is when I encounter input with a single quote in it,
> > > it messes up the SQL statement for the Win32::ODBC module.
> > > 
> > > How can I clean/phrase the input ($comments), so that it can be
> > > used as part of my SQL statement?



Thaks for everybodys help.

One of the early responces was to use my $sth = $dbh->prepare(sql);

This is actually DBI ot Win32::ODBC as far as I can tell.

Anyhow, the CGI script I was creating wasn't that large, so switching
from Win32::ODBC to DBI and DBD::ODBC wasn't to much work.

I have now done as advised/suggested, and I haven't managed to find
any combination of user input which will kill my script.

I have tried no input (underrun), lots and lots of input (overrunn),
weird not standard charests etc., and the script seems to hold its
own.

Also I guess now I am usng DBI, a change of backend won't be to
difficult if the script starts getting more work that it was expected
to.


Once again, thanks for all those who assisted.


Max.


------------------------------

Date: Mon, 15 Sep 2003 03:48:27 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: closed filehandle
Message-Id: <fEa9b.9804$1D5.494@nwrddc02.gnilink.net>

Sam wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:Cj_8b.11126$NX3.9947@nwrddc01.gnilink.net...
>> Sam wrote:
>>> when I run the code below I get
>>> readline() on closed filehandle DATA at practice.plx line 6.
>>>
>>> use warnings;
>>> use strict;
>>> open DATA, 'home/username/data/avg' || die $!;
>>
>> There are two problems in this one line:
>> Due to precedence rules it will be evaluated as
>>     open DATA, ('home/username/data/avg' || die $!);
>>
>> If you change this to
>>     open DATA, 'home/username/data/avg' or die $!;
>> then probably you will get a runtime error "File does not exist"
>> which points to the second problem:
>> I'm guessing but probably you meant to open
>> '/home/username/data/avg', not just 'home/username/data/avg'.
>>
>>> while (<DATA>) {
>>> print $_;
>>> }
>>
>>
>
>  #!/usr/bin/perl
>  use warnings;
>  use strict;
>
> my $file = "home/user/data/avg";
>  open DATA, $file or die $!;
>  while (<DATA>) {
>  print $_;
>  }
>
> when I run it I get
> No such file or directory at practice.plx line 6.

Well, yes. Exactly as I predicted.
Does that surprise you in any way? Did you actually read the second part of
my reply?

jue




------------------------------

Date: Mon, 15 Sep 2003 05:25:26 GMT
From: "Sam" <samj@austarmetro.com.au>
Subject: Re: closed filehandle
Message-Id: <3f654d46@news.comindico.com.au>


"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message
news:Xns93F6B553F2AD2asu1cornelledu@132.236.56.8...
> "Sam" <samj@austarmetro.com.au> wrote in
> news:3f64d3da@news.comindico.com.au:
>
> >
> > "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message
> > news:Xns93F6A46C9676Easu1cornelledu@132.236.56.8...
> >> "Sam" <samj@austarmetro.com.au> wrote in
> >> news:3f64b27b@news.comindico.com.au:
> >>
> >> >
> >> > "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> >> > news:Cj_8b.11126$NX3.9947@nwrddc01.gnilink.net...
> >> >> Sam wrote:
> >> >> > when I run the code below I get
> >> >> > readline() on closed filehandle DATA at practice.plx line 6.
> >> >> >
> >> >> > use warnings;
> >> >> > use strict;
> >> >> > open DATA, 'home/username/data/avg' || die $!;
> >>
> >> <snip>
> >>
> >> >> If you change this to
> >> >>     open DATA, 'home/username/data/avg' or die $!;
> >> >> then probably you will get a runtime error "File does not exist"
> >> >> which points to the second problem:
> >> >> I'm guessing but probably you meant to open
> >> >> '/home/username/data/avg', not just 'home/username/data/avg'.
> >>
> >> <snip>
> >> >
> >> >  #!/usr/bin/perl
> >> >  use warnings;
> >> >  use strict;
> >> >
> >> > my $file = "home/user/data/avg";
> >> >  open DATA, $file or die $!;
> >> >  while (<DATA>) {
> >> >  print $_;
> >> >  }
> >> >
> >> > when I run it I get
> >> > No such file or directory at practice.plx line 6.
> >>
> >> You don't really read the responses apparently. Please read what
> >> Jurgen pointed out as the second problem with the open call, and see
> >> if fixing that solves your issue.
> >>
> >> Sinan.
> >
> > yes I did read all the posts, sorry that I didn't give that impression
> >
> > [Quote]*************************************
> > There are two problems in this one line:
> > Due to precedence rules it will be evaluated as
> >     open DATA, ('home/username/data/avg' || die $!);
> >
> > If you change this to
> >     open DATA, 'home/username/data/avg' or die $!;
> > then probably you will get a runtime error "File does not exist" which
> > points to the second problem:
> > I'm guessing but probably you meant to open '/home/username/data/avg',
> > not just 'home/username/data/avg'.
> > ********************************************
> >
> > the suggestion to use the 'or' instead '||' has been tried for no
> > avail, but knowing the || has a precedence over 'or' so I used 'or'
> > with my second version of the program (open DATA, $file or die $!;)
> >
> > the second suggestion 'guess' states (open '/home/username/data/avg'),
> > well where is the file handler DATA so I didn't understand how to
> > implement that solution.
>
> OK, maybe this is an English problem (on your part).
>
> <quote author="Jurgen">
> > I'm guessing but probably you meant to open '/home/username/data/avg',
> > not just 'home/username/data/avg'.
> </quote>
>
> That is an English sentence, not a Perl statement (notice the 'you meant
> to open' part).
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> # BTW, where is the actual file located?
> open(DATA, '/home/user/data/avg') || die $!;
> while (<DATA>) {
>   print;
> }
>
>
> -- 
> A. Sinan Unur
> asu1@c-o-r-n-e-l-l.edu
> Remove dashes for address
> Spam bait: mailto:uce@ftc.gov

the file name is avg and it is located at /home/<username>/data directory




------------------------------

Date: Mon, 15 Sep 2003 05:35:21 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: closed filehandle
Message-Id: <tcc9b.9890$1D5.4139@nwrddc02.gnilink.net>

Sam wrote:
> the file name is avg and it is located at /home/<username>/data
> directory

Then why are you trying to open
        home/user/data/avg
instead of
        /home/user/data/avg

Or did you make sure that your CWD is the root directory?
At least I didn't see any code for that anywhere in your previous code
samples.

jue




------------------------------

Date: Sun, 14 Sep 2003 22:09:44 -0700
From: "Tom" <tom@nosleep.net>
Subject: dbm problem  HELP!
Message-Id: <3f6548dc$1@nntp0.pdx.net>

I can write to, close aand reopen a dbm file with hashes of hasjed of hashes
and everything is OK.
Data I write is read back just fine.
However, when I run the program again later on and use the same exact code
to reopen the dbm, al the data is gone.

Here is a snippet of what I am doing:

dbmopen (%nd,$ndbfile,0666) || die "Can't dbmopen $ndbfile: $!";

$stk = "ABC";
$datecode = "20030914";
$druntime = "700";
$data = "12345";

$nd{$stk}{$datecode}{$druntime}{Data} = $data;

dbmclose (%nd) || die "Can't dbmclose $ndbfile: $!";

dbmopen (%nd,$ndbfile,0666) || die "Can't dbmopen $ndbfile: $!";
print "Data: $nd{$stk}{$datecode}{$druntime}{Data}\n";
dbmclose (%nd) || die "Can't dbmclose $ndbfile: $!";

-------
Data: 12345
-------

However, if I rerun the script with just the following, I get this:

$stk = "ABC";
$datecode = "20030914";
$druntime = "700";
$data = "12345";

dbmopen (%nd,$ndbfile,0666) || die "Can't dbmopen $ndbfile: $!";
print "Data: $nd{$stk}{$datecode}{$druntime}{Data}\n";
dbmclose (%nd) || die "Can't dbmclose $ndbfile: $!";

Use of unitialized value in concatenation (.) at C: blah, blah, blah
Date:

Apparently, there is a problem accessing the dbm file, though it is there.
Any help would be greatly appreciated, thanks,
Tom






------------------------------

Date: 14 Sep 2003 17:27:19 -0700
From: Joseph Brenner <doom@kzsu.stanford.edu>
Subject: locale games - looking for portable ways to get a list of valid locales
Message-Id: <m33ceyaobc.fsf@crack.nonagon.org>


I think the question I want to ask here is: "Is there any
portable way of getting a listing of valid locales on the
current system?"  I've been reading perllocale, and it looks
like the best they can do is point you at a dozen things
that might work on a given machine, but aren't guaranteed.

The reason I'm wondering with this has to do with the fact that a
CPAN tester is reporting a failure for a module I've been working
on ("Text::Capitalize"):

   http://nntp.x.perl.org/group/perl.cpan.testers/101269

The trouble is pretty clearly that the module does a "use
locale" so that it can handle accented characters correctly,
and my tests include some cases to cover this.  For example,
the capitalize_title function transforms "über maus" to
"Über Maus", at least under the "en_US" LANG setting on my
box.  My presumption is that it's failing on this sun
machine because it has a different locale setting (possibly
"C" or "Posix"... I would think "de" would work).  It's
reporting things like this:

   t/002-captitle-default............................#     Failed test (t/002-captitle-default.t at line 22)
   #          got: 'üBer Maus'
   #     expected: 'Über Maus'

This failure is not a big deal from my point of view (if the user
wants the code to work with the full iso-8859 character set,
they'll presumably choose an appropriate locale, if they don't
have one by default).  But still, I'd prefer to clean up the
warning, and I think there are two obvious ways the test could be
re-written: (1) check the locale setting and skip the test if it
doesn't look like it's appropriate or (2) set the locale
correctly for the test, and then revert to the original setting
afterwards.

Both approaches have their problems.  The second sounds better to me,
but what if there is no "en_US" setting on the machine?  It might not
be installed, or it might be called something else.  I gather that
these are all possiblities: "En_US", "en_US.ISO8859-1",
"en_US.iso88591", "en_US", "en" and so on (?)... (I love standards).

So I would *think* that what I need is some way of getting a list of
valid locales, and I don't see any way of doing that out on CPAN.  

But if that doesn't exist, I would guess I can try something like: 

require 5.004;
use POSIX qw(locale_h);
BEGIN {
  @american = qw( en_US.ISO8859-1 en_US.iso88591 en_US en En_US en_us );
  foreach $en (@american) { 
     eval{ setlocale(LC_CTYPE, $en) };
     unless ($@) {  # $!?
       $true_american = $en;
       last;
     }
  }
}

Though that, of course, would limit it to POSIX compliant systems...
It also limits it to american english, but I don't mind that too
much, since at the moment at least "Text::Capitalize" is a fairly
parochial English-centric module.

So what do you folks think?  Is there a better way of doing
it that I'm missing?



------------------------------

Date: 14 Sep 2003 16:01:40 -0700
From: utsuxs@hotmail.com (bob)
Subject: location of regular expression match
Message-Id: <51c3a5d3.0309141501.12ef88ff@posting.google.com>

I apologize for another newbie question.  How does one obtain the
starting character position of all regular expression matches in a
line or a paragraph?
Thank you.


------------------------------

Date: Mon, 15 Sep 2003 01:43:39 +0200
From: Amir Kadic <zoooz@gmx.de>
Subject: Re: location of regular expression match
Message-Id: <bk2uj6$ogisu$1@ID-142982.news.uni-berlin.de>

bob wrote:

> I apologize for another newbie question.  How does one obtain the
> starting character position of all regular expression matches in a
> line or a paragraph?

One way I can think of is using pos() in a loop:


foreach $token (qw#foo bar#) {
        $position= pos($line),"\n" if $line =~ /$token/g;
        # now do something with it
}

I _hope_ there is a more elegant WTDI.

Amir



------------------------------

Date: Mon, 15 Sep 2003 01:48:49 +0200
From: Amir Kadic <zoooz@gmx.de>
Subject: Re: location of regular expression match
Message-Id: <bk2ut0$o9q4p$1@ID-142982.news.uni-berlin.de>

I wrote:

>         $position= pos($line),"\n" if $line =~ /$token/g;

Please forget the q(,"\n")

This was originally a print(), but then I thought,
'that man wants to _obtain_, not print the positions'...:)

Amir



------------------------------

Date: Mon, 15 Sep 2003 02:02:07 GMT
From: mooseshoes <mooseshoes@gmx.net>
Subject: Re: location of regular expression match
Message-Id: <z499b.4164$wV3.521@newssvr27.news.prodigy.com>

<snip>

> I apologize for another newbie question.  How does one obtain the
> starting character position of all regular expression matches in a
> line or a paragraph?
> Thank you.


It is stored in the @- array (ie. $-[0] is the position at the start of a
match).  Use //g modifier and \G anchor as needed.  Check out perlretut and
perlre for more info.

Moose


------------------------------

Date: Mon, 15 Sep 2003 01:06:58 GMT
From: mooseshoes <mooseshoes@gmx.net>
Subject: Re: Newbie Help with Hashes
Message-Id: <Sg89b.185$vv3.15572138@newssvr14.news.prodigy.com>

<snip>

 What I really want to do is to be able to have
> "irregular" numbers of subprojects under each project, and gracefully
> handle them with my code. For example, if Project1 contained a
> subdirectory "Excel" in addition to Visio,Word,Schematic, and Verilog,
> I'd like the program to be able to handle that rather than having a
> "fixed number" of subprojects. My code is shown below, where the my
> %row hash is the problem. I want to be able to make proj1, proj2,
> proj3 a "dynamic size". I'm a newbie at perl, please forgive my
> approach if another is clearly more obvious.

<<< It appears that you may be in need of data strucure with an extra
dimension.  Consider using an HoAoA so you can have varying numbers of
items per project.  The best way to think of this data structure is a "hash
whose value references an array which references a second array."  That
should help you add and extract items from it.  Be sure to check out
various helpful perldocs on data structures and references.

Moose


------------------------------

Date: Mon, 15 Sep 2003 11:47:34 +1000
From: "Neil Griffin" <mrbean@nospam.net>
Subject: Re: Optimising performance of Perl binary
Message-Id: <bk35n9$q3n$2@mws-stat-syd.cdn.telstra.com.au>

The developers are indeed moving to Mod-Perl, but aren't quite there yet.
The re-architecting of application to support Mod-Perl and other changes is
part of the reason why the performance has gone backwards :-(

I'm just trying to wring the most out of the platform that I can... 5-10%
here or there would be useful.

Thanks for the feedback.

Bob Walton wrote in message <3F64C4A6.6010602@rochester.rr.com>...
>Neil Griffin wrote:
>
>> Hi,
>>     currently we are hosting a Perl 5.6.1 based Intranet application on a
>> Sun 6x750MHz v880/Solaris 8 (64bit) server. The application performs a
lot
>> of CGI/DBI (Oracle DBD) interactions apart from the required 'business'
>> processing. To try and improve the perfomance of this application after a
>> recent upgrade, I am looking at recompiling Perl and associated modules
with
>> more agressive optimising and targeting of the platform. The developers
are
>> also attempting to squeeze more cycles out of the application.
>>
>> Originally the Perl was compiled with gcc 2.95.3 on a Sun Ultra 1/Solaris
8
>> (32bit) with the default optimisation. I am recompiling with Sun Forte v7
on
>> an UltraSparc II/Solaris 8 (64bit) server
>>
>> My questions are:
>>
>> 1. Am I going to gain any performance compiling as a 64bit app, or should
I
>> stick with 32bit. The O/S and Oracle are 64bit.
>>
>> 2. Are there any performance advantages moving to Perl 5.8? I read mixed
>> reports on this.
>>
>> 3. I am looking at using the Sun compiler options
of -fast -xtarget=ultra3.
>> Are there any others that I should consider (safe) with Perl? The
>> appropriate spec.org reports indicate a number of other switches.
>>
>> 4. Are there any advantages using third party (malloc) libraries like
>> SmartHeap?
>>
>> 5. Are there any other compilation/configuration issues I should
consider?
>>
>...
>
>
>I would be amazed if you gain enough from compiler optimizations and the
>like to make it worth the time and effort involved (and the time spent
>fighting potential compiler bugs in the fancier optimizations).  You
>don't mention the use of mod_perl.  If you are not using mod_perl or
>something equivalent, you could gain speed by orders of magnitude by
>using it.  You would need to move to the Apache web server.
>Well-written Perl CGI scripts need no modification.  This basically
>functions by holding a Perl interpreter and a compiled Perl process
>ready-to-go for new CGI requests, with no need to start a process, load
>the Perl interpreter and script, and compile the script each time.  It
>just goes right to running the script.  Also, a connection to your
>database is held open so that doesn't need to be established each time
>either.  The result is a truly dramatic improvement in performance.
>
>--
>Bob Walton
>




------------------------------

Date: 13 Sep 2003 16:10:23 -0700
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: Pattern Match Question..
Message-Id: <slrnbm78tb.o81.tim@vegeta.ath.cx>

John W. Krahn graced us by uttering:
> Rodney wrote:
> >  I want to replace all instances of the combination of   \"
> >  with  \&quot;
> >  
> >  Using the Regex code below, I end up replacing ALL  "  with
> >  &guot;  and all \"  with  \&guot; How can I make it ONLY
> >  replace the combination of  \" ?
> >  
> >  $TextBlockToConvert =~ s/\"/\quot;/g;

What this actually does is change all <"> to <&quot;>; the <\> is
ignored.

> The backslash character is special in double quoted strings so
> you have to escape it if you want a literal backslash
> character.
> 
> $TextBlockToConvert =~ s/\\"/&quot;/g;

The left side is right, but I think the OP wanted a <\> in his
result as well.  If that's the case, the following will work:

    $block_to_cnvt =~ s#\\"#\\&quot;#g;

or

    # uses capturing parens to reduce
    # ambiguity in replacement string
    $block_to_cnvt =~ s#(\\)"#$1&quot;#g;

HTH,
Tim Hammerquist
-- 
Last year in Oregon, Summer fell on a *tuesday*.
That was it. One day. Big shiny thing in the sky.
Some people thought it was a UFO.
    -- Randal L. Schwartz, comp.lang.perl.misc


------------------------------

Date: Mon, 15 Sep 2003 01:34:23 +0000 (UTC)
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: Perl 5 for MS-DOS
Message-Id: <bk34uv$mo5$1@geraldo.cc.utexas.edu>



  rudi.langhanki@web.de (Rudi Langhanki) wrote:
>Hello,
>
>I'm trying to run Perl 5 under MS-DOS. Until now I found out that
>there are two serious ports of Perl 5 available:
>
>one of Laszlo Molnar. This is a MSDOS/DJGPP port of perl 5.004_02.
>The other is Ilya Zakharevich's OS/2 port of Perl.
 ...

 Siemens port of perl available at http://www.cpan.org/authors/id/G/GR/GRAHAMC/
has worked well for me. You basically unpack it and it's ready to run. You
might have to set your path so binaries can be found, but that's about all.
It comes with a LOT of modules installed.
chas
--
for((112,97,99,107)){$s.=chr $_};
($z="``'=``:=`~,=``~=``{=;'=``'=+}=++=`~}=;".
"'=;+=++=:'=;+=::=:~=,,=,'=::=,'=,:=::=,:=,;".
"=::=,'=,:=::=,{=:_=::=,'=,:=::=,,=,~=::=,'=,".
":=::=:+=:_=:`=,+=`~")=~tr/~`';:,{}_+=/0-9i/; 
eval "\$_=$s 'c*', qw/@{[split /i/,$z]}/;";print;



------------------------------

Date: Mon, 15 Sep 2003 01:11:58 GMT
From: mooseshoes <mooseshoes@gmx.net>
Subject: Tie::DBI Quickie Question
Message-Id: <yl89b.186$vv3.15572138@newssvr14.news.prodigy.com>

All:

Is an assignment to a Tie::DBI hash variable the equivalent to a database
connection (is there a 1:1 relationship?) or is there conservation of
server hits with its use?  I can put up with a bit of lag by using it but
it wouldn't be worth it if the number of connections to the server was the
same.

Thanks for your thoughts in advance.

Best,

Moose


------------------------------

Date: Sun, 14 Sep 2003 23:31:10 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Tring to kill my kids, but they are stuborn little bastards!
Message-Id: <2T69b.2859$Kt4.2086@nwrdny02.gnilink.net>

Eric Frazier <eric@dmcontact.com> wrote:
> I am running on perl 5.8
> 
>   $SIG{CHLD} = \&REAPER;
> 
>   while (my $connection = $listen_socket->accept()) {

The "deferred signal" system introduced in 5.8.0 doesn't use SA_RESTART
when installing %SIG handlers (and you didn't use it with sigaction() 
in the bit I snipped).  This means that the accept() syscall will fail
when it's interrupted by any of those handled signals.

I'm not sure whether this matches the symptoms you were trying to describe,
since the result will be that the parent exits after the first signal 
arrives, but it's certainly something to consider.  The simplest solution 
is to rewrite the loop with an extra test for EINTR.

    use Errno;

    while (1) { 
      my $con = $sock->accept() or do {
        next if $!{EINTR};
        last;
      };
    }

-- 
Steve


------------------------------

Date: Mon, 15 Sep 2003 03:59:07 GMT
From: Eric Frazier <eric@dmcontact.com>
Subject: Re: Tring to kill my kids, but they are stuborn little bastards!
Message-Id: <3F650B5B.7563ED3A@dmcontact.com>

Hi,

The parent is not getting killed. At least I am pretty sure it is not. 
I will do some reading, I don't know about EINTR at all. 

What I see happening is that I start the server, I telnet to it and run
a command, exit with quit.
then do a ps and see 2 perl processes, both look the same, neither has
the (perl) which I thought ment that it was a child. If I do this same
process of connect/exit connect/exit I will build up more and more of
these processes. 

root    5356  0.0  0.6  7232 6704  p3  I     9:27AM   0:00.21
/usr/bin/perl -w ./franken_socket.pl
root    5364  0.0  0.6  7360 6716  p3  I     9:27AM   0:00.01
/usr/bin/perl -w ./franken_socket.pl
root    5369  0.0  0.6  7296 6712  p3  I     9:27AM   0:00.00
/usr/bin/perl -w ./franken_socket.pl

The above results from starting the server and connecting twice. 

I also may be getting a little confused because I did do some of this
work on a machine with 5.6 and I know there have been a lot of changes. 


Thank you for your response.

Eric 

Steve Grazzini wrote:
> 
> Eric Frazier <eric@dmcontact.com> wrote:
> > I am running on perl 5.8
> >
> >   $SIG{CHLD} = \&REAPER;
> >
> >   while (my $connection = $listen_socket->accept()) {
> 
> The "deferred signal" system introduced in 5.8.0 doesn't use SA_RESTART
> when installing %SIG handlers (and you didn't use it with sigaction()
> in the bit I snipped).  This means that the accept() syscall will fail
> when it's interrupted by any of those handled signals.
> 
> I'm not sure whether this matches the symptoms you were trying to describe,
> since the result will be that the parent exits after the first signal
> arrives, but it's certainly something to consider.  The simplest solution
> is to rewrite the loop with an extra test for EINTR.
> 
>     use Errno;
> 
>     while (1) {
>       my $con = $sock->accept() or do {
>         next if $!{EINTR};
>         last;
>       };
>     }
> 
> --
> Steve


------------------------------

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 5503
***************************************


home help back first fref pref prev next nref lref last post