[25568] in Perl-Users-Digest
Perl-Users Digest, Issue: 7812 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 22 11:05:57 2005
Date: Tue, 22 Feb 2005 08:05:26 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 22 Feb 2005 Volume: 10 Number: 7812
Today's topics:
ANNOUCE: Data::Page::Viewport V 1.02 <ron@savage.net.au>
ANNOUNCE: Image::Magick::Tiler V 1.00 <ron@savage.net.au>
Re: clpannounce problem <noreply@gunnar.cc>
Re: Correct way to inherit from 3rd party class (Anno Siegel)
Re: cubic root subroutine <1usa@llenroc.ude.invalid>
Re: cubic root subroutine <richard@zync.co.uk>
Re: cubic root subroutine <do-not-use@invalid.net>
Re: cubic root subroutine <1usa@llenroc.ude.invalid>
Re: DBI not generating expected error messages <pat@patmail.com>
Re: DBI not generating expected error messages <pat@patmail.com>
Re: Need help with CGI/ DBI error (permissions?) <pat@patmail.com>
Re: Need help with CGI/ DBI error (permissions?) <pat@patmail.com>
Re: Need help with CGI/ DBI error (permissions?) <1usa@llenroc.ude.invalid>
Re: Need help with CGI/ DBI error (permissions?) <pat@patmail.com>
Re: Need help with CGI/ DBI error (permissions?) <1usa@llenroc.ude.invalid>
perl null value ? <alexj@floor.ch>
Re: perl null value ? <jurgenex@hotmail.com>
RE explanation <Noname@hot.com>
Re: RE explanation <1usa@llenroc.ude.invalid>
Re: Regular expression problem (Anno Siegel)
Re: Regular expression problem <gwillem@gmail.com>
Re: Web Application Installation Script ioneabu@yahoo.com
Re: What Is This ".pureftpd-rename.47188.a1518ccc" File <tadmc@augustmail.com>
Re: What Is This ".pureftpd-rename.47188.a1518ccc" File <scobloke2@infotop.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Feb 2005 09:04:58 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUCE: Data::Page::Viewport V 1.02
Message-Id: <ICBDsF.22ME@zorch.sf-bay.org>
The pure Perl module Data::Page::Viewport V 1.02
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.02 Mon Feb 21 15:06:00 2005
- Add an option to sub new() to allow or disable old/new style scrolling.
Read the POD for a full explanation of these styles.
Note: The default is new style scrolling, because I feel it is more DWIM
--
Cheers
Ron Savage, ron@savage.net.au on 21/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company
------------------------------
Date: Tue, 22 Feb 2005 10:35:05 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: Image::Magick::Tiler V 1.00
Message-Id: <ICBDsp.22ru@zorch.sf-bay.org>
The pure Perl module Image::Magick::Tiler V 1.00
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
Slice an image into N x M tiles.The geometry option is NxM+x+y,
where x and y offsets can be used to change the size of the tiles.
x and y can be negative.
Further, the width of each tile is ( (width of image) / N) + x pixels,
and the height of each tile is ( (height of image) / M) + y pixels.
For example, if you specify 2x3, and the vertical line which splits the image
goes through an interesting part of the image, you could then try 2x3+50, say,
to move the vertical line 50 pixels to the right.
This is what I do when printing database schema generated with GraphViz::DBI.
--
Cheers
Ron Savage, ron@savage.net.au on 22/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company
------------------------------
Date: Tue, 22 Feb 2005 14:04:34 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: clpannounce problem
Message-Id: <380oujF5fi2bgU1@individual.net>
brian d foy wrote:
> Gunnar Hjalmarsson wrote:
>> Could somebody please enlighten me on what's involved to get a post
>> through on clpannounce?
>
> Randal has to approve it, but you have to get your email past his
> spam filters. You should use a real email address that he can
> respond to.
Thanks for your reply. I received a private message from Randal, which
basically told me the same, so hopefully my fourth post will now make it. :)
FYI: Below please find the content of the automated message that is sent
in response to a comp.lang.perl.announce post:
<QUOTE>
Your posting for comp.lang.perl.announce has been received and queued.
I will send you a message when I choose to either accept or reject the
posting. I try to process the postings at least once every seven
days, but generally it has been a lot more often than that (within
minutes if I'm on-line, for example).
The approved charter says "comp.lang.perl.announce will be a
low-volume, moderated group for announcements of new releases of perl
or its extensions (oraperl, sybperl, etc.) and periodic postings
related to perl."
I have interpreted this charter as follows:
(1) your article must contain the word "perl", (this is my de-spamming
filter :-) , and
(2) your article must be of the form "I have a solution to your problem",
not "I have a problem that needs solving", and
(3) you must not use a spam-proofed email address (of course, you
won't see this message if you do!), and
(4) for software, the article must be describing something in which
the fact that it is *written* in Perl is significant (in other words,
a tool that could just as easily be in Object Oriented COBOL as far
as the users are concerned *does not* qualify), and
(5) the article must *not* be commercial in nature (general rule
for the comp.* hierarchy, not specific to this group). This
includes *all* job and resume postings, and
(6) if it's Perl software, it must be mirrored into the CPAN and
announced as such, unless you can convince me that it's an extremely
unusual case.
Please do not include actual source code, unless it is part of an
example for documentation. If you need to find a home for your code,
you may wish to contact the Perl archivist mailing list at
packrats@history.perl.org or the Comprehensive Perl Archive Network
(CPAN) administrators at cpan-adm@ftp.funet.fi after first having read
<http://www.cpan.org/modules/04pause.html>.
Please do not include the *entire* documentation of your item. An
*announcement* is not a user's guide!
If your article is rejected, you may consider posting your article to
comp.lang.perl.misc, comp.lang.perl.modules, comp.lang.perl.moderated,
or comp.lang.perl.tk instead, if it is appropriate.
Thank you,
Randal L. Schwartz
merlyn@stonehenge.com
chief moderator, comp.lang.perl.announce
</QUOTE>
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 22 Feb 2005 13:35:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Correct way to inherit from 3rd party class
Message-Id: <cvfcek$r9t$1@mamenchi.zrz.TU-Berlin.DE>
jonnytheclown <jonny@windmillwalton.demon.co.uk> wrote in comp.lang.perl.misc:
> What is the correct (recommended) way to inherit from an arbitrary
> class when I know nothing about its internals (and don't want to know)
> but need to hold additional instance variables. The next question is
> how should I implement a class that allows other programmers to inherit
> from it and hold their own instance variables.
Let me answer the second question first.
The rule is simple: To make a class easy to inherit from, identify
(document) a set of accessors. The set will usually include a creator
method (->new), methods that read or set object variables, plus class
methods to control class variables if such are used. The set should be
kept as small as reasonably possible.
Then write all other methods in terms of these. No exceptions, no cutting
corners.
If a class is written this way, a derived class must define (override)
exactly the accessor methods to guarantee that all methods of the base
class will work with derived objects. It is free to add its own accessors
to additional object (or class-) variables.
To inherit from an arbitrary class that doesn't define such a set of
accessors, you will have to take a look at the implementation to identify
an equivalent set (i.e. a set of methods all others are defined in terms
of). Use that as described above. If you're unlucky, the set will be
large -- it may comprise all methods for an exceptionally badly written
class. In that case, the class can't be usefully inherited from.
Anno
------------------------------
Date: Tue, 22 Feb 2005 12:46:20 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: cubic root subroutine
Message-Id: <Xns96054F10B78DCasu1cornelledu@127.0.0.1>
Arndt Jonasson <do-not-use@invalid.net> wrote in
news:yzdwtt1yotm.fsf@invalid.net:
>
> Scott Bryce <sbryce@scottbryce.com> writes:
>> Arndt Jonasson wrote:
>>
>> > You may want to handle the sign separately, since letting $foo be
>> > negative results in NaN ("Not a number"), at least here, on
>> > Solaris 2.8 x86.
>>
>> Same on Win32.
>>
>> > Also, it may be worth making sure that the cube of an integer
>> > always comes back as an integer, and not with a little
>> > rounding-error,
>>
>> I assume you mean that the cube root of a cube comes back an
>> integer. That doesn't appear to be a problem on my machine.
>
> Yes, I meant "comes back from the cube root subroutine". But it is a
> problem on my machine:
>
> perl -e 'printf "%d\n", int(64**(1/3))'
> 3
int EXPR
int Returns the integer portion of EXPR. If EXPR is omitted,
uses $_. You should not use this function for rounding: one
because it truncates towards 0, and two because machine
representations of floating point numbers can sometimes
produce counterintuitive results. For example,
"int(-6.725/0.025)" produces -268 rather
than the correct -269; that's because it's really more like
-268.99999999999994315658 instead. Usually, the "sprintf",
"printf", or the "POSIX::floor" and "POSIX::ceil" functions
will serve you better than will int().
These calculations necessary to calculate the power of a number are
performed in floating point by Perl. If you are going to use the number
in other calculations, you should leave it as it is instead of jumping
through a bunch of hoops.
On the other hand, if you just wanted to report results in integers:
D:\> perl -e "printf q{%.0f}, ((64)**(1/3))"
4
Sinan.
------------------------------
Date: Tue, 22 Feb 2005 12:47:59 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: cubic root subroutine
Message-Id: <pan.2005.02.22.12.47.58.894982@zync.co.uk>
On Sat, 19 Feb 2005 21:37:11 +0000, Dan van Ginhoven wrote:
> Hi.
>
> I needed a cubic root subroutine but didn´t find one at a quick search.
> So I wrote a simple one.
> It seems pretty fast and accurate enough.
> Any ideas how to improve it,
> or point me to better solutions.
> /dg
>
<SNIP>
Here's one using Newton-Raphson:
(http://www.sosmath.com/calculus/diff/der07/der07.html)
#!/usr/bin/perl
use strict;
use warnings;
# Program to find the cubic root of a number using the Newton-Raphson
# method for approximating the roots of polynomials
#
# Here, f(x) = x**3 - n where n is the number to be rooted
# thus f'(x) = 3x**2
#
# [ f'(x) is the first differential of f(x) wrt x ]
my $findcubicrootof = $ARGV[0] || 27;
my $first_guess = $findcubicrootof / 3;
my $accuracy = 0.000000000000001;
# Arbitrarily set to what works on my machine. YMMV
die "Accuracy exceeds machine limits\n" if ($accuracy < 1e-15);
print "The cubic root of $findcubicrootof is ",
nr($first_guess,$findcubicrootof,$accuracy),
" +/- $accuracy\n";
sub nr {
my ($guess,$n,$accuracy) = @_;
# Find delta
my $delta = fofx($guess,$n) / fdashofx($guess,$n);
if (abs($delta) < $accuracy) {
return $guess;
} else {
return nr($guess - $delta,$n,$accuracy);
}
}
# Returns f(x)
sub fofx {
my ($x,$n) = @_;
return $x ** 3 - $n;
}
# Returns f'(x)
sub fdashofx {
my ($x,$n) = @_;
return 3 * $x ** 2;
}
------------------------------
Date: 22 Feb 2005 14:57:35 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: cubic root subroutine
Message-Id: <yzdsm3ozohc.fsf@invalid.net>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> writes:
> Arndt Jonasson <do-not-use@invalid.net> wrote in
> news:yzdwtt1yotm.fsf@invalid.net:
>
> >
> > Scott Bryce <sbryce@scottbryce.com> writes:
> >> Arndt Jonasson wrote:
> >>
> >> > You may want to handle the sign separately, since letting $foo be
> >> > negative results in NaN ("Not a number"), at least here, on
> >> > Solaris 2.8 x86.
> >>
> >> Same on Win32.
> >>
> >> > Also, it may be worth making sure that the cube of an integer
> >> > always comes back as an integer, and not with a little
> >> > rounding-error,
> >>
> >> I assume you mean that the cube root of a cube comes back an
> >> integer. That doesn't appear to be a problem on my machine.
> >
> > Yes, I meant "comes back from the cube root subroutine". But it is a
> > problem on my machine:
> >
> > perl -e 'printf "%d\n", int(64**(1/3))'
> > 3
>
> int EXPR
> int Returns the integer portion of EXPR. If EXPR is omitted,
> uses $_. You should not use this function for rounding: one
> because it truncates towards 0, and two because machine
> representations of floating point numbers can sometimes
> produce counterintuitive results. For example,
> "int(-6.725/0.025)" produces -268 rather
> than the correct -269; that's because it's really more like
> -268.99999999999994315658 instead. Usually, the "sprintf",
> "printf", or the "POSIX::floor" and "POSIX::ceil" functions
> will serve you better than will int().
>
> These calculations necessary to calculate the power of a number are
> performed in floating point by Perl. If you are going to use the number
> in other calculations, you should leave it as it is instead of jumping
> through a bunch of hoops.
>
> On the other hand, if you just wanted to report results in integers:
>
> D:\> perl -e "printf q{%.0f}, ((64)**(1/3))"
> 4
Call me dense, but I'm not sure if you're taking issue with my
statement, or just providing additional information.
------------------------------
Date: Tue, 22 Feb 2005 14:19:57 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: cubic root subroutine
Message-Id: <Xns96055EEE27C5Aasu1cornelledu@127.0.0.1>
Arndt Jonasson <do-not-use@invalid.net> wrote in
news:yzdsm3ozohc.fsf@invalid.net:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> writes:
>> >> Arndt Jonasson wrote:
>> > Yes, I meant "comes back from the cube root subroutine". But it is
>> > a problem on my machine:
>> >
>> > perl -e 'printf "%d\n", int(64**(1/3))'
>> > 3
>>
>> int EXPR
>> int Returns the integer portion of EXPR. If EXPR is omitted,
>> uses $_. You should not use this function for rounding:
...
>> These calculations necessary to calculate the power of a number are
>> performed in floating point by Perl. If you are going to use the
>> number in other calculations, you should leave it as it is instead
>> of jumping through a bunch of hoops.
>>
>> On the other hand, if you just wanted to report results in integers:
>>
>> D:\> perl -e "printf q{%.0f}, ((64)**(1/3))"
>> 4
>
> Call me dense, but I'm not sure if you're taking issue with my
> statement, or just providing additional information.
I am taking issue with your statement "it is a problem on my machine".
You seem to think there is a problem when in actuality, the behavior you
are observing is only due to the fact that you used the '%d' format for
printf instead of the more appropriate '%.0f' format.
There is nothing you can do about the fact that:
perl -e "printf q{%.16f}, ((64)**(1/3))"
will print something like
3.9999999999999996
i.e. it is impossible to:
<quoted from another message of yours>
... it may be worth making sure that the cube of an integer always
comes back as an integer, and not with a little rounding-error,
</quoted from another message of yours>
For values used in interim calculations, you should not bother "fixing"
anything. For values that are printed, you should use the appropriate
printf format.
Sinan.
------------------------------
Date: Tue, 22 Feb 2005 14:26:00 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: DBI not generating expected error messages
Message-Id: <YhHSd.86316$pc5.7494@tornado.tampabay.rr.com>
Hmmm.... might be a good call. How do I find out?
I d/l the ActiveState binary for Perl 5.8 (using MSI). I'm not sure where I
got the DBD:Oracle module and exactly what version it is- Like I said I'm
new to this, and I just did a lot of searching online and finally found
something that worked (or seemed to work for the most part) ;)
Thanks for your effort!
patrick
"Brian McCauley" <nobull@mail.com> wrote in message
news:cv7n8g$kf$1@sun3.bham.ac.uk...
>
>
> patrickg wrote:
>
> > Hey all - new to Perl and DBI, so just trying to get an understanding of
> > things. I copied some sample code from the Perl DBI book in the error
> > checking section, but I can't seem to get any of the error messages that
I
> > expect. Instead, the program crashes and I get the popup box stating "
Perl
> > Command Line Interpreter has encountered a problem and needs to close.".
Can
> > someone tell me why none of these error messages are are being displayed
> > when I deliberately make a typo (ie. bad password, malformed SQL, etc)
to
> > cause an error? (I've tried all the combinations of setting the
PrintError
> > and RaiseError).
>
> I read you post a couple of times looking hard at your code examples and
> couldn't see why RaiseError and PrintError were not working. Then I
> read your post again and realised you said Perl was crashing hard. Well
> there's your reason - DBI is unable to return errors in any normal way
> because Perl has already crashed. Such crashes are usually due to
> library version incompatibilities.
>
> Did you build the DBD youself from sources or download a binary? If you
> got a binary it may be it's linked against a different version of the
> database client library.
>
------------------------------
Date: Tue, 22 Feb 2005 14:31:10 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: DBI not generating expected error messages
Message-Id: <OmHSd.99252$qB6.66649@tornado.tampabay.rr.com>
Additional info...
ppm> query *oracle*
Querying target 1 (ActivePerl 5.8.6.811)
1. DBD-Oracle [1.16] Oracle database driver for the DBI module
2. DBD-Oracle9 [1.16]
Does this help?
"patrickg" <pat@patmail.com> wrote in message
news:YhHSd.86316$pc5.7494@tornado.tampabay.rr.com...
> Hmmm.... might be a good call. How do I find out?
>
> I d/l the ActiveState binary for Perl 5.8 (using MSI). I'm not sure where
I
> got the DBD:Oracle module and exactly what version it is- Like I said I'm
> new to this, and I just did a lot of searching online and finally found
> something that worked (or seemed to work for the most part) ;)
>
> Thanks for your effort!
> patrick
>
>
> "Brian McCauley" <nobull@mail.com> wrote in message
> news:cv7n8g$kf$1@sun3.bham.ac.uk...
> >
> >
> > patrickg wrote:
> >
> > > Hey all - new to Perl and DBI, so just trying to get an understanding
of
> > > things. I copied some sample code from the Perl DBI book in the error
> > > checking section, but I can't seem to get any of the error messages
that
> I
> > > expect. Instead, the program crashes and I get the popup box stating "
> Perl
> > > Command Line Interpreter has encountered a problem and needs to
close.".
> Can
> > > someone tell me why none of these error messages are are being
displayed
> > > when I deliberately make a typo (ie. bad password, malformed SQL, etc)
> to
> > > cause an error? (I've tried all the combinations of setting the
> PrintError
> > > and RaiseError).
> >
> > I read you post a couple of times looking hard at your code examples and
> > couldn't see why RaiseError and PrintError were not working. Then I
> > read your post again and realised you said Perl was crashing hard. Well
> > there's your reason - DBI is unable to return errors in any normal way
> > because Perl has already crashed. Such crashes are usually due to
> > library version incompatibilities.
> >
> > Did you build the DBD youself from sources or download a binary? If you
> > got a binary it may be it's linked against a different version of the
> > database client library.
> >
>
>
------------------------------
Date: Tue, 22 Feb 2005 14:12:09 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <Z4HSd.105709$JF2.8605@tornado.tampabay.rr.com>
Thanks...
User 'Everyone' has Read and Execute permissions on that file.
User 'System' has Full permissions.
Of course there are other user/ groups that have perms too, but I thought
one of those would be the key. Who do I need to give permissions to, and
what perms??
Thanks again!
patrick
"Todd W" <toddrw69@excite.com> wrote in message
news:7wBRd.9948$hU7.6018@newssvr33.news.prodigy.com...
>
> "patrickg" <pat@patmail.com> wrote in message
> news:zwtRd.91704$qB6.11946@tornado.tampabay.rr.com...
> > Hey all... I'm still fairly new to Perl, and having problems getting CGI
> and
> > DBI to work together (although I'm getting the hang of them working
> > independently). I'm running Perl 5.8.6 on WinXP using the scaled down
IIS.
> >
> > For this first step, I just want to connect to an Oracle db (10g) as
> > scott/tiger and retrieve the list of user tables, and return that to a
web
> > page. Simple, right??
> >
> > My code looks like this:
> >
> <snip />
>
> > Am I forgetting something???Thanks for any help!patrick g.
>
> Short answer:
>
> The process running the program doesent have permissions to open the file
> 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll', the error message is
printed
> before the http header and the server dosent like using the error message
as
> a http header.
>
> Todd W.
>
>
------------------------------
Date: Tue, 22 Feb 2005 14:05:41 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <V_GSd.86311$pc5.21919@tornado.tampabay.rr.com>
Thanks - good point regarding the header. However, I got the same message as
before.
Can you expand a little more about when you say "use the CGI module?" I
thought I was, no??
Thanks!
"James Willmore" <jwillmore@adelphia.net> wrote in message
news:IKadnY0Bp89664rfRVn-sw@adelphia.com...
> patrickg wrote:
> <snip>
> >
> > my $dbh = DBI->connect( 'dbi:Oracle:orcl', 'scott', 'tiger', {
RaiseError =>
> > 1, PrintError => 1 } ) or print "<p>Error connecting to database: " .
> > $DBI::errstr . "</p>", exit;
>
> my $dbh = DBI->connect( 'dbi:Oracle:orcl', 'scott', 'tiger', {
> RaiseError => 1, PrintError => 1 } ) or print "Content-type:
> text/html\n\n <p>Error connecting to database: " . $DBI::errstr .
> "</p>", exit;
>
> Notice that a HTTP header is issued in the 'print' statement. You could
> just 'die' at this point versus using a 'print' and an 'exit' and get
> the same results.
>
> Remember, STDOUT (meaning, where the "stuff" is sent from the script) is
> going through HTTP, not a console. So, you *need* to send an HTTP
> header when using 'print'.
>
> Another way to do it is to just have the following *before* any other
> 'print' statements:
>
> print "Content-type: text/html\n\n";
>
> Then, if you use any 'print' statements later on in the script, you
> don't need to remember to send the HTTP header.
>
> Or ... use the CGI module :-)
>
> HTH,
>
> Jim
------------------------------
Date: Tue, 22 Feb 2005 14:50:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <Xns9605641F057B9asu1cornelledu@127.0.0.1>
"patrickg" <pat@patmail.com> wrote in
news:IuHSd.86320$pc5.77547@tornado.tampabay.rr.com:
[ please do not top-post ]
> "Brian Wakem" <no@email.com> wrote in message
> news:37n76iF5egpkjU1@individual.net...
>> patrickg wrote:
>>
>> > I'm running Perl 5.8.6 on WinXP using the scaled down IIS.
>>
>> Perl 5.8, OK.
>>
>> > #!/usr/local/ActivePerl-5.6/bin/perl -w
>>
>> Perl 5.6. hmmmmmmm.
...
>> Different versions of Perl?
> Good catch... however, I sort of got the impression that that first
> line really doesn't do anything when running Perl on Windows. That
> directory doesn't even exist, and originally the first line read:
> #!C:Perl\bin\perl -w But I get the same results (on all my perl
> scripts) regardless of what it says.
Well, I don't know about IIS but it sure makes a difference when running
Apache. This should tell you that you no longer have a Perl issue but a
web server configuration issue. I'd advise you to find an appropriate
forum.
Sinan.
------------------------------
Date: Tue, 22 Feb 2005 15:27:26 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <ybISd.105725$JF2.95728@tornado.tampabay.rr.com>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns9605641F057B9asu1cornelledu@127.0.0.1...
> "patrickg" <pat@patmail.com> wrote in
> news:IuHSd.86320$pc5.77547@tornado.tampabay.rr.com:
>
> [ please do not top-post ]
>
> > "Brian Wakem" <no@email.com> wrote in message
> > news:37n76iF5egpkjU1@individual.net...
> >> patrickg wrote:
> >>
> >> > I'm running Perl 5.8.6 on WinXP using the scaled down IIS.
> >>
> >> Perl 5.8, OK.
> >>
> >> > #!/usr/local/ActivePerl-5.6/bin/perl -w
> >>
> >> Perl 5.6. hmmmmmmm.
> ...
> >> Different versions of Perl?
>
> > Good catch... however, I sort of got the impression that that first
> > line really doesn't do anything when running Perl on Windows. That
> > directory doesn't even exist, and originally the first line read:
> > #!C:Perl\bin\perl -w But I get the same results (on all my perl
> > scripts) regardless of what it says.
>
> Well, I don't know about IIS but it sure makes a difference when running
> Apache. This should tell you that you no longer have a Perl issue but a
> web server configuration issue. I'd advise you to find an appropriate
> forum.
>
> Sinan.
When you say it makes a difference when running Apache, are you referring to
Apache on Windows or Apache on *nix??
Reason I'm asking is because even when I run the script from a command line
(therefor not using any webserver at all), it still doesn't make a
difference as to my results. So maybe the difference is regarding the OS,
not the webserver. (?)
------------------------------
Date: 22 Feb 2005 16:04:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <Xns960570AA8443Casu1cornelledu@132.236.56.8>
"patrickg" <pat@patmail.com> wrote in
news:ybISd.105725$JF2.95728@tornado.tampabay.rr.com:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns9605641F057B9asu1cornelledu@127.0.0.1...
...
>> Well, I don't know about IIS but it sure makes a difference when
>> running Apache. This should tell you that you no longer have a Perl
>> issue but a web server configuration issue. I'd advise you to find an
>> appropriate forum.
...
> When you say it makes a difference when running Apache, are you
> referring to Apache on Windows or Apache on *nix??
Windows.
> Reason I'm asking is because even when I run the script from a command
> line (therefor not using any webserver at all), it still doesn't make
> a difference as to my results. So maybe the difference is regarding
> the OS, not the webserver. (?)
No.
There are three ways to invoke a Perl script on the command line in
Windows:
1. perl myscript
In this case, the first perl executable in the PATH is used. The
interpreter you specify in the shebang line is irrelevant. However, the
options you specified in the shebang line will be respected by the
interpreter.
2. start myscript.pl
Assuming the .pl extension is associated with a perl interpreter, that
interpreter will be invoked to run the script. Again, the interpreter
specified on the shebang line will be irrelevant.
3. Put .pl or whatever extension you use for Perl scripts in the PATHEXT
(Win2k and higher) environment variable. In this case, you can run
myscript.pl simply by entering
myscript
on the command line. Once again, assuming the file extension is
associated with a perl interpreter, the interpreter specified on the
shebang line becomes irrelevant.
Apache, however, uses the shebang line to determine the interpreter to be
used to run the script in the absence of any directives telling it
otherwise.
I am trying very, very hard to stay away from a discussion of how *your*
web server should be configured. You should find an appropriate forum.
Sinan.
------------------------------
Date: Tue, 22 Feb 2005 16:38:41 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: perl null value ?
Message-Id: <cvfjlv$ggc$1@news.hispeed.ch>
Hi how can make a test if ($var ne null) { print "not null"; } when I'm
doing that I got the following error msg :
bareword "NULL" not allowed while "strict subs" in use at
thx in advance
------------------------------
Date: Tue, 22 Feb 2005 15:47:00 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: perl null value ?
Message-Id: <UtISd.34719$uc.3835@trnddc08>
Alexandre Jaquet wrote:
> Hi how can make a test if ($var ne null) { print "not null"; } when
> I'm doing that I got the following error msg :
>
> bareword "NULL" not allowed while "strict subs" in use at
If you want to compare the value of $var against a string then you have to
tell Perl that you are using a string and not e.g. function call:
if ($var ne 'null') { print "not null"; }
Note: this still may not do what you want it to do. Somehow this null looks
suspiciously like you want to compare against the empty string, a \000, or
the numerial value 0.
But because you didn't tell us what you actually want to do there is no for
us to say how to do it.
jue
------------------------------
Date: Tue, 22 Feb 2005 13:27:25 GMT
From: "Noname" <Noname@hot.com>
Subject: RE explanation
Message-Id: <xn0dyt26a9wbocu001@news.europe.nokia.com>
Hi
I have following re
$Test="5-15";
my (@sid)= ($Test=~/(\d+)-(\d+)/?($1..$2):$_);
which polulate the @sid with 5 to 15 numbers,
what I don't understand is
?($1..$2):$_) how does this work
------------------------------
Date: Tue, 22 Feb 2005 13:38:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: RE explanation
Message-Id: <Xns960557EA5CB6Dasu1cornelledu@127.0.0.1>
"Noname" <Noname@hot.com> wrote in news:xn0dyt26a9wbocu001
@news.europe.nokia.com:
> Hi
> I have following re
> $Test="5-15";
> my (@sid)= ($Test=~/(\d+)-(\d+)/?($1..$2):$_);
> which polulate the @sid with 5 to 15 numbers,
> what I don't understand is
> ?($1..$2):$_) how does this work
Please do not ask thousands of people to read the documentation for you.
From
perldoc perlop:
Conditional Operator
Ternary "?:" is the conditional operator, just as in C. It works much
like an if-then-else. If the argument before the ? is true, the
argument before the : is returned, otherwise the argument after the :
is returned.
Now, I personally would hope that I would never write anything like
this. Assuming $_ supposedly holds some default value, I would re-write
this as:
#! perl
use strict;
use warnings;
my $default = 1;
my $test = '5-15';
my @range;
if($test =~ /^(\d+)-(\d+)$/) {
@range = ($1 .. $2);
} else {
@range = ($default);
}
print "@range\n";
__END__
I don't know where the $test string is coming from, but you probably
want to perform some additional bounds checking on the variables. What
happens to your program if $test contains:
'0-2000000000'
Sinan
------------------------------
Date: 22 Feb 2005 12:23:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular expression problem
Message-Id: <cvf87o$ok2$1@mamenchi.zrz.TU-Berlin.DE>
Willem <gwillem@gmail.com> wrote in comp.lang.perl.misc:
> I would like to make a tool that assists in generating ClamAV signatures
> [1]. However, I'm stuck with the regular expression required to
> transform some, but not all of the signature to hex.
>
> Suppose this signature:
>
> xxxxversion(1|3|5.7)xxxxxxxx
>
> I would like to encode anything _but_ the control characters (,|,) to
Technically these are not control characters.
> hex. However, I only want to protect these control characters that are
> included in the following expression: m#\([\d\.|]\)#. In words: the (, )
> and | that are used to mark alternatives for version numbers need to
> remain unaltered.
Your (less than clear) verbal descriptions don't match up with the one
given as a regex. Do you want to transform digits or don't you? Make
up your mind.
You don't say what you mean by "transform to hex". Start with this:
s/([^(|)])/sprintf "%2x", ord $1/eg;
Anno
------------------------------
Date: Tue, 22 Feb 2005 13:55:29 +0100
From: Willem <gwillem@gmail.com>
Subject: Re: Regular expression problem
Message-Id: <421b2bc1$0$28981$e4fe514c@news.xs4all.nl>
Anno Siegel wrote:
> Your (less than clear) verbal descriptions don't match up with the one
> given as a regex. Do you want to transform digits or don't you? Make
> up your mind.
> You don't say what you mean by "transform to hex". Start with this:
>
> s/([^(|)])/sprintf "%2x", ord $1/eg;
Thanks! This would transform "a(1|2)b" to "61(31|32)62", which is indeed
what I want. However, I want to exclude the case where parentheses do
surround other characters than [\d\.\|]. To illustrate
a(1|2)b should yield 61(31|32)62
a(12)b should yield 612831322962
I don't know how to put this condition in a regular expression (if it is
possible at all?). Maybe it is also possible to transform everything to
hex, and then work the other way around by matching
(28)(.+?)(7c)(.+?)(29) => ($1|$2)
hex 28 = (
hex 7c = |
hex 29 = )
But this way I cannot limit my (.+?) match to (ascii) digits and dots so
this is a suboptimal solution.
Thanks again for any help.
Willem
------------------------------
Date: 22 Feb 2005 05:07:45 -0800
From: ioneabu@yahoo.com
Subject: Re: Web Application Installation Script
Message-Id: <1109077665.935975.126600@l41g2000cwc.googlegroups.com>
Andres Monroy-Hernandez wrote:
> You could ship your web application with Perl and Apache binaries
> already configured to work with your web app. You will save a lot of
> time during the installation because it will be just unpacking a tar
> file. This can be more complicated if you have to support a lot of
> OS's. But it's an option.
>
> --
> Andres Monroy-Hernandez
> Ex Libris Inc.
There's one software package I was looking at that is basically a
website that interfaces with MySQL via PHP. One vendor wants to come
to your location to do the complex installation and another one sells
it already set up on a hard drive.
If you ship it with with Perl and Apache binaries already configured,
what if you mess up what people are already running? If your
application will be the only one running, why not bundle the whole
configured OS in an image file?
I have had the same problem with Perl modules. What if you don't have
access to the internet during setup? What if you ship with all of the
modules needed, but you were not aware of some dependencies on other
modules that are not standard?
Recently, I used Switch.pm just to be cool and I had trouble moving the
script to a machine without internet access because Switch.pm depends
on some other modules I didn't save to disk. I just went back to if,
elsif... I guess avoiding non-standard modules unless absolutely
necessary improves portability.
***Why not make cpan modules available as a DVD image? Project
Gutenburg does it with their files. You won't always get the newest
stuff, but at least you get all of the important stuff. Or for profit,
somebody could sell subscriptions to up to date DVDs.
2005-02-22 online since 1995-10-26
2784 MB 271 mirrors
4187 authors 7662 modules
wana
------------------------------
Date: Tue, 22 Feb 2005 00:02:27 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: What Is This ".pureftpd-rename.47188.a1518ccc" File?
Message-Id: <slrnd1linj.t4d.tadmc@magna.augustmail.com>
mary <> wrote:
> What is this file?
> .pureftpd-rename.47188.a1518ccc
What is your Perl question?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Feb 2005 14:42:59 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: What Is This ".pureftpd-rename.47188.a1518ccc" File?
Message-Id: <cvfgdi$dc3$1@titan.btinternet.com>
mary wrote:
> Sure stupid. Do you have something better to do?
These things make it less likely you'll get a helpful response:
- off-topic.
- rudeness.
- top posting.
I recommend reading the FAQ.
>
> On Tue, 22 Feb 2005 06:31:02 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
>
>
>>mary wrote:
>>
>>>There is a 7MEG file in my cgi-bin directory,
>>>chmod 600, which I cannot delete. What is this file?
>>>Its name:
>>>
>>>.pureftpd-rename.47188.a1518ccc
I guess either your ISP is using FTP server software named PureFTPD or
you are using FTP client software named PureFTP.
Presumably, this file is left over from an aborted upload of
site-content to your webspace. Its not uncommon for files to be uploaded
using a temporary name so that they don't get used by the web-server
whilst the file is incomplete. If I am correct, on completion of the
upload the file would have been renamed.
>>
>>It's a 7MEG file named .pureftpd-rename.47188.a1518ccc
>>
>>Do you have a Perl question, too?
<OP responded with a personal insult>
I'd have recognised this as useful advice to post my web-hosting
question to somewhere more appropriate than a programming language forum.
In my view, a rude reply to the above merely compounds the error and
gets you added to the killfiles of people otherwise likely to be of help
to you in future. I'd apologise if I'd done that.
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7812
***************************************