[19036] in Perl-Users-Digest
Perl-Users Digest, Issue: 1231 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 2 14:05:35 2001
Date: Mon, 2 Jul 2001 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <994097109-v10-i1231@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 2 Jul 2001 Volume: 10 Number: 1231
Today's topics:
Re: anonymous subroutines - why? <bart.lateur@skynet.be>
Re: anonymous subroutines - why? <m.grimshaw@salford.ac.uk>
Re: arrays in XS... (Anno Siegel)
Re: arrays in XS... <jrl@ast.cam.ac.uk>
Re: chmod xxx > where to put the command? (Randal L. Schwartz)
Comparing strings in Perl <joachim.rose@psi.ch>
Re: Comparing strings in Perl <mbudash@sonic.net>
Re: Comparing strings in Perl <gnarinn@hotmail.com>
Re: Comparing strings in Perl <ren@tivoli.com>
Re: Counting occurences of a character <ren@tivoli.com>
Re: Counting occurences of a character <holland@origo.ifa.au.dk>
Re: FAQ 9.15: How do I decode a CGI form? newbie ?s <flavell@mail.cern.ch>
Re: limiting cgi input from specific IP's (Alan Barclay)
Newbie Question <ted_godwin@mindspring.com>
Re: Newbie Question <rsherman@ce.gatech.edu>
Re: Open or Die - is die the only choice? <bernie@fantasyfarm.com>
Re: Open or Die - is die the only choice? (Craig Berry)
OT: GD::Graph, PNG files and slow loading in web browse <djberge@uswest.com>
perl and progress DB (raj)
Persistent DB connections (^CooL^)
Re: Persistent DB connections <gnarinn@hotmail.com>
Please help newbie! <newsman@-takethisout-brol.org.uk>
Re: Please help newbie! (Randal L. Schwartz)
Re: Please help newbie! <rsherman@ce.gatech.edu>
Re: Query: PERL v.s. Perl ==> What's the difference?? <holland@origo.ifa.au.dk>
SMTP help <syed_altaf@yahoo.com>
Re: SMTP help <tony_curtis32@yahoo.com>
Subroutine prototype syntax for passing typeglob? <mnemotronic@mind\no-spam/spring.com>
Re: timing can make the difference: (Craig Berry)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Jul 2001 15:46:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: anonymous subroutines - why?
Message-Id: <3d51kt079i10fto2i5vkr1sg6sr0ut2jb9@4ax.com>
Mark Grimshaw wrote:
>I'm asking a general question on the usefulness of anonymous subroutines
>possibly combined with coderefs. In the way I've used it, would, for
>example, calling the coderef many times be more efficient than calling a
>subroutine directly many times?
I don't understand your example... but anyway: no, in general, jumping
through coderefs are going to be just a bit *slower* than calling a sub
directly. I'd estimate the overhead of the call to be in the 10-20%
range. But that's just an unfounded estimate.
>i.e. what are the advantages to anonymous subroutines?
The advantages are mainly in dynamic generation of code, I would say.
Check out closures. The idea is that you can have a few very similar
subs, but all dedicated to one paricular task. For example, take a UTF8
to any single byte character converter. All such converters are very
similar in structure, but the conversion table is different. So, I can
imagine doing:
$utf8_to_mac = UTF8::decoder('macintosh'); #code ref 1
$utf8_to_win = UTF8::decoder('cp-1252'); #code ref 2
$mactext = $utf8_to_mac->($utf8text); #call anon sub 1
$wintext = $utf8_to_win->($utf8text); #call anon sub 2
--
Bart.
------------------------------
Date: Mon, 02 Jul 2001 18:28:56 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: anonymous subroutines - why?
Message-Id: <3B40AF58.D37F227E@salford.ac.uk>
understood - thanks.
------------------------------
Date: 2 Jul 2001 15:17:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: arrays in XS...
Message-Id: <9hq39p$pmr$2@mamenchi.zrz.TU-Berlin.DE>
According to Jim Lewis <jrl@ast.cam.ac.uk>:
> Hi,
>
> Consider the following:
>
> a C subroutine...
>
> extern int aaa(char *a[]) {
> .
> .
> .
> }
>
> How do I write the interface .xs routine so that I can call this from
> perl using:
>
> $returnval = &aaa(\@array);
What have you tried?
Anno
------------------------------
Date: Mon, 02 Jul 2001 16:30:49 +0100
From: Jim Lewis <jrl@ast.cam.ac.uk>
Subject: Re: arrays in XS...
Message-Id: <3B4093A9.4EAA2321@ast.cam.ac.uk>
Anno Siegel wrote:
> According to Jim Lewis <jrl@ast.cam.ac.uk>:
> > Hi,
> >
> > Consider the following:
> >
> > a C subroutine...
> >
> > extern int aaa(char *a[]) {
> > .
> > .
> > .
> > }
> >
> > How do I write the interface .xs routine so that I can call this from
> > perl using:
> >
> > $returnval = &aaa(\@array);
>
> What have you tried?
>
> Anno
So far nothing much. Just doing
int
cir_test(yuk)
char ** yuk
CODE:
RETVAL = cir_test(yuk);
OUTPUT:
RETVAL
fails with an error like 'unable to call XS_unpack_charPtrPtr'
Jim
------------------------------
Date: 02 Jul 2001 08:20:16 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: chmod xxx > where to put the command?
Message-Id: <m14rsv9x3j.fsf@halfdome.holdit.com>
>>>>> "Tad" == Tad McClellan <tadmc@augustmail.com> writes:
Tad> Matt was not a Real Programmer when he wrote most of his "popular"
Tad> programs, and he does not maintain them. He was a teenager when
Tad> he wrote most of them.
Not that there's anything wrong with being a teenager and writing
code. You can acquire good programming practices at almost any age.
But there are some that didn't, and perhaps that's what you meant.
Just another guy who did his first programming for hire at age 15, :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 02 Jul 2001 18:10:10 +0200
From: Joachim Rose <joachim.rose@psi.ch>
Subject: Comparing strings in Perl
Message-Id: <3B409CE2.F087B165@psi.ch>
Hello,
I've got a problem in comparing strings in Perl.
I must check, if one string($a) is a substring of another string($b).
These strings can be of any value, they can even appear as regex as
shown in the example below, but they should be treated just like pure strings.
Example:
$a = '[]';
$b = 'ABC[]';
if ($b =~ /$a/) {
print "$a is a substring of $b";
}
I was expecting that $a is a substring of $b.
But it will be compiled as a regex.
Can anybody tell me how to accomplish to decide, that $a is a substring of $b ?
I feel, that this could be fairly easy, but I don't have any idea.
No flames please :-)
Best regards,
Achim
------------------------------
Date: Mon, 02 Jul 2001 16:21:59 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Comparing strings in Perl
Message-Id: <mbudash-4ECC9F.09220002072001@news.sonic.net>
In article <3B409CE2.F087B165@psi.ch>, joachim.rose@psi.ch wrote:
> Hello,
>
> I've got a problem in comparing strings in Perl.
> I must check, if one string($a) is a substring of another string($b).
> These strings can be of any value, they can even appear as regex as
> shown in the example below, but they should be treated just like pure
> strings.
>
> Example:
>
> $a = '[]';
> $b = 'ABC[]';
>
> if ($b =~ /$a/) {
> print "$a is a substring of $b";
> }
>
> I was expecting that $a is a substring of $b.
> But it will be compiled as a regex.
> Can anybody tell me how to accomplish to decide, that $a is a substring
> of $b ?
>
if ($b =~ /\Q$a/) {
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Mon, 2 Jul 2001 16:37:15 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Comparing strings in Perl
Message-Id: <994091835.333172699436545.gnarinn@hotmail.com>
In article <mbudash-4ECC9F.09220002072001@news.sonic.net>,
Michael Budash <mbudash@sonic.net> wrote:
>In article <3B409CE2.F087B165@psi.ch>, joachim.rose@psi.ch wrote:
>
>> Hello,
>>
>> I've got a problem in comparing strings in Perl.
>> I must check, if one string($a) is a substring of another string($b).
>> These strings can be of any value, they can even appear as regex as
>> shown in the example below, but they should be treated just like pure
>> strings.
>>
>> Example:
>>
>> $a = '[]';
>> $b = 'ABC[]';
>>
>> if ($b =~ /$a/) {
>> print "$a is a substring of $b";
>> }
>>
>> I was expecting that $a is a substring of $b.
>> But it will be compiled as a regex.
>> Can anybody tell me how to accomplish to decide, that $a is a substring
>> of $b ?
>>
>
>if ($b =~ /\Q$a/) {
>
It might be more appropriate to use the function index()
see perldoc -f index
gnari
------------------------------
Date: 02 Jul 2001 11:21:12 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Comparing strings in Perl
Message-Id: <m3lmm7paiv.fsf@dhcp9-173.support.tivoli.com>
On Mon, 02 Jul 2001, joachim.rose@psi.ch wrote:
> I've got a problem in comparing strings in Perl. I must check, if
> one string($a) is a substring of another string($b). These strings
> can be of any value, they can even appear as regex as shown in the
> example below, but they should be treated just like pure strings.
Use index().
> Example:
>
> $a = '[]';
> $b = 'ABC[]';
>
> if ($b =~ /$a/) {
> print "$a is a substring of $b";
> }
if (index($b, $a)) {
print "$a is a substring of $b\n";
}
> I was expecting that $a is a substring of $b. But it will be
> compiled as a regex. Can anybody tell me how to accomplish to
> decide, that $a is a substring of $b ?
You could also use a regex with \Q:
if ($b =~ /\Q$a/) {
print "$a is a substring of $b\n";
}
but when index() is sufficient, it is best.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 02 Jul 2001 10:19:51 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Counting occurences of a character
Message-Id: <m3bsn3qrxk.fsf@dhcp9-173.support.tivoli.com>
On 2 Jul 2001, ebohlman@omsdev.com wrote:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
>> $_ .= ',' x ( 9 - tr/,// );
>
> And why bother concatenating when print takes a list:
>
> while ( <DATA> ) {
> chomp;
> print $_, ',' x (9-tr/,//), "\n";
> }
And why bother chomp-ing just to put the newline back:
while ( <DATA> ) {
s/$/','x(9-tr|,||)/e;
print;
}
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 02 Jul 2001 19:59:17 +0200
From: Steve Holland <holland@origo.ifa.au.dk>
Subject: Re: Counting occurences of a character
Message-Id: <w47ithbw6tm.fsf@origo.ifa.au.dk>
Ren Maddox <ren@tivoli.com> writes:
> On 2 Jul 2001, ebohlman@omsdev.com wrote:
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> $_ .= ',' x ( 9 - tr/,// );
> > And why bother concatenating when print takes a list:
> > while ( <DATA> ) {
> > chomp;
> > print $_, ',' x (9-tr/,//), "\n";
> > }
> And why bother chomp-ing just to put the newline back:
> while ( <DATA> ) {
> s/$/','x(9-tr|,||)/e;
> print;
> }
I like to use use chomp and then add the newline back because it
makes it obvious to anyone who tries to read my code that the cursor
moves to a new line after printing. In this example it is not a big
deal, but in some routines there are print statments that are not
meant to move the cursor to the next line mixed in with print
statements that do. Having the "\n" explicitly typed at the end of
print statements makes it clear that the cursor advances to the next
line.
=====================================================================
To find out who and where I am look at:
http://www.nd.edu/~sholland/index.html
=====================================================================
------------------------------
Date: Mon, 2 Jul 2001 17:16:28 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: FAQ 9.15: How do I decode a CGI form? newbie ?s
Message-Id: <Pine.LNX.4.30.0107021700390.9843-100000@lxplus003.cern.ch>
On Mon, 2 Jul 2001, Tad McClellan wrote:
> Jason Goodrow <@opencity.com> wrote:
> >
> >I've had trouble with CGI.pm and ended up rolling my own for instances
> >where I didn't want to de-url-encode input.
I have to say frankly that I think you are digging a hole for
yourself. As time goes by and you add features to your scripts,
you're likely to find that hole getting deeper, and the unnoticed
security exposures growing. Unless, that is, you are skilled enough
to write a package like CGI.pm for yourself. But then you wouldn't be
needing to tell folks here that you were having trouble using CGI.pm
for your purposes ;-}
> >This FAQ has given me some (probably healthy) parinoia
Me too; a little paranoia does no harm when you're confronted with
an internet full of crackers trying out exploits on your CGI scripts.
My response to that is to avoid writing one-off code for routine
tasks, when peer-reviewed libary code is available.
> >- a my beginners
> >instinct says continue rolling my own rather than study CGI.pm to cover
> >my code.
>
> I don't follow. A beginner's instinct says to write your own function
> rather than use an already written-reviewed-debugged function?
Bizarre, isn't it?
[...]
> > They don't deal
> > with GET/POST combinations where query fields are in more than one
> > place.
Well, if that's the way the problem is set, then CGI.pm can indeed
solve it; but IMHO this is going outside of what the CGI specification
itself is offering, and thus represents an additional risk factor, so
I'd prefer to avoid doing that if I had a choice.
All your examples were pointing the right way though, and I'd add that
CGI.pm deals with some other security exposure issues that
hand-knitted code rarely deals with - one of which I had been unaware
of myself until it was explained to me.
By the way, these security issues were unrecognized in the heyday of
cgi-lib.pl, so I'm afraid the claim that cgi-lib.pl is complete and
needs no further maintenance seems to me to be quite unconvincing.
Just as the troll's claim that CGI.pm's occasional bugfixes prove that
it's unreliable are also specious.
all the best
------------------------------
Date: 2 Jul 2001 14:21:20 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: limiting cgi input from specific IP's
Message-Id: <994083678.203854@elaine.furryape.com>
In article <3B404581.4F0FBC29@salford.ac.uk>,
Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
>I've read somewhere that REMOTE_ADDR may not be the IP of the client but
>possibly the IP of any proxy servers the client passes through. I may
>be wrong.
You're not wrong. In fact, it's the IP address of the proxy server
directly connecting to your server. This is all you can use though,
as the actual client may have a non-unique address, or might
not even have an IP address at all.
------------------------------
Date: Mon, 2 Jul 2001 13:45:42 -0400
From: "TedWeb" <ted_godwin@mindspring.com>
Subject: Newbie Question
Message-Id: <9hqc19$vv5$1@slb0.atl.mindspring.net>
Hello all,
Quick question...
Is it possible for a perl script to call an *.exe or *.bat file?
Many thanks,
TedWeb
------------------------------
Date: Mon, 02 Jul 2001 13:58:01 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Newbie Question
Message-Id: <3B403799.24CD663D@ce.gatech.edu>
TedWeb wrote:
> Hello all,
>
> Quick question...
> Is it possible for a perl script to call an *.exe or *.bat file?
>
> Many thanks,
>
> TedWeb
exec, system, or backticks...depends what your needs are.
------------------------------
Date: Mon, 02 Jul 2001 13:31:09 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Open or Die - is die the only choice?
Message-Id: <jkb1ktcpaa6haf6m0d9a5lml57p8073kkk@news.supernews.net>
Gary <gamtci@mpinet.net> wrote:
} Every book I have shows "open or die". Isn't there any other way
} to determine if the open succeeded? I have been checking for
} existence using if (-f $file) first, but I'd still rather know the
} open succeeded.
I dont' know what your question is. "open or die" is how you know the open
succeeded. Basically, if open returns 'undef' you lost... and that's the
*ONLY* way to tell that you lost. You don't necessarily have to 'or die'
but you _certainly_ have to test the returned value from 'open' *somehow,
because there is *NO* set of pre-open tests you can do that'll tell you,
apriori, whether a subsequent 'open' will succeed or not.
I suppose instead of open-or-die you could do:
unless (open FILESTUFF)
{ # File didn't open.... }
or something like that, but the principle is pretty much always the same
/bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Mon, 02 Jul 2001 17:39:05 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Open or Die - is die the only choice?
Message-Id: <tk1cdpk4s2pm15@corp.supernews.com>
Gary (gamtci@mpinet.net) wrote:
: Every book I have shows "open or die". Isn't there any other way
: to determine if the open succeeded? I have been checking for
: existence using if (-f $file) first, but I'd still rather know the
: open succeeded.
Doing -f first leaves you open to a race condition -- what if someone
deletes it between the test and the open? It also doesn't handle cases
in which the file is present, but you don't have permission to open it in
the required mode.
"open or die" is the norm because quite commonly the failure to open a
file is catastrophic; there's simply no reasonable way for the script to
limp forward from there. But there's nothing special or magical about it.
open() returns true on success, false on failure; you can use that result
in any sort of conditional you desire. For example:
if (open FOO, '< bar.baz') {
# Do stuff with the open FOO filehandle here
}
else {
# Do whatever you can without FOO being open here
}
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
Date: Mon, 02 Jul 2001 12:57:01 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: OT: GD::Graph, PNG files and slow loading in web browser
Message-Id: <3B40B5ED.C46EE951@uswest.com>
Hi all,
Perl 5.6.1, Bughat 6.2, GD 1.33, GDGraph 1.33. Possibly OT...
I created a bar chart using the GDGraph module, in PNG format, that
amounted to about 10k in size. I tried both interlaced and
non-interlaced. When I open the file in a browser, it loads *very*
slowly with both Netscape and IE.
Is this because of the filesize? The web browser? Something to do with
the way files are generated using GDGraph? Is there a way to improve
this (short of reducing the filesize)?
Thanks in advance for any info.
Regards,
Mr. Sunray
------------------------------
Date: 2 Jul 2001 08:09:18 -0700
From: sharda@hotmail.com (raj)
Subject: perl and progress DB
Message-Id: <ac4b6b9a.0107020709.9837d28@posting.google.com>
Guys,
is there any perl module to interact with Progress DB?
I gotta write a script (would love to write it in perl) which will
access a table in progress db, process its records, and then generate
an output file.
O Master(s), pls. enlighten this poor soul...!
thanks in advance.
regards.
------------------------------
Date: 2 Jul 2001 08:28:51 -0700
From: cool133@hotmail.com (^CooL^)
Subject: Persistent DB connections
Message-Id: <211c8e3f.0107020728.45e7c862@posting.google.com>
Hi.
I am using mod_perl and Oracle DBD driver to connect to an Oracle
server.
How can I create persistent connections to the database equivalent to
PHP's pconnect() function?
Regards,
Clyde.
------------------------------
Date: Mon, 2 Jul 2001 16:34:12 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Persistent DB connections
Message-Id: <994091652.566856546327472.gnarinn@hotmail.com>
In article <211c8e3f.0107020728.45e7c862@posting.google.com>,
^CooL^ <cool133@hotmail.com> wrote:
>Hi.
>
>I am using mod_perl and Oracle DBD driver to connect to an Oracle
>server.
>
>How can I create persistent connections to the database equivalent to
>PHP's pconnect() function?
>
Have you looked at Apache::DBI ?
gnari
------------------------------
Date: Mon, 2 Jul 2001 17:31:18 +0100
From: "Robin Abrol" <newsman@-takethisout-brol.org.uk>
Subject: Please help newbie!
Message-Id: <9hq7md$1em$1@news6.svr.pol.co.uk>
Hello all. Please excuse this newbie question!
I downloaded a web mail system written in Perl using CGI. I have placed it
in the cgi-bin, and the test cgi page ran fine. However, I keep getting the
following error :
Can't locate http://www.st.tees.org.uk/cgi-bin/common.pl in @INC (@INC
contains: c:/perl/lib c:/perl/site/lib .) The common.pl file is definately
there in my cgi-bin directory. At first I was using a local path in the cgi
file - just referring
to the file as "common.pl" in the code, but I altered it to the above.
Obviously this made no difference.
Being a newbie to cgi & Perl (I have used ASP until now), I am wondering
what is causing this error. What does the @INC part mean? There is nothing
in the code that seems to use this phrase.
My hosts use NT4 servers.
Do I need to ask the hosts to sort something out? It there a fault at their
end?
If you navigate to www.st.tees.org.uk/cgi-bin you will see the problem
yourself.
Many thanks in advance,
Robin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.261 / Virus Database: 131 - Release Date: 06/06/2001
------------------------------
Date: 02 Jul 2001 10:23:48 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Please help newbie!
Message-Id: <m11ynz8ct7.fsf@halfdome.holdit.com>
>>>>> "Robin" == Robin Abrol <newsman@-takethisout-brol.org.uk> writes:
Robin> Can't locate http://www.st.tees.org.uk/cgi-bin/common.pl in @INC (@INC
Robin> contains: c:/perl/lib c:/perl/site/lib .) The common.pl file is definately
Robin> there in my cgi-bin directory.
That's definitely a URL, not a filepath. You need to put the file
in either /perl/lib or /perl/site/lib, or alter @INC with "use lib".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 02 Jul 2001 13:27:50 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Please help newbie!
Message-Id: <3B403086.1F9F7E4B@ce.gatech.edu>
Robin Abrol wrote:
> Hello all. Please excuse this newbie question!
>
> I downloaded a web mail system written in Perl using CGI. I have placed it
> in the cgi-bin, and the test cgi page ran fine. However, I keep getting the
> following error :
>
> Can't locate http://www.st.tees.org.uk/cgi-bin/common.pl in @INC (@INC
> contains: c:/perl/lib c:/perl/site/lib .) The common.pl file is definately
> there in my cgi-bin directory. At first I was using a local path in the cgi
> file - just referring
> to the file as "common.pl" in the code, but I altered it to the above.
> Obviously this made no difference.
>
> Being a newbie to cgi & Perl (I have used ASP until now), I am wondering
> what is causing this error. What does the @INC part mean? There is nothing
> in the code that seems to use this phrase.
>
> My hosts use NT4 servers.
>
> Do I need to ask the hosts to sort something out? It there a fault at their
> end?
>
> If you navigate to www.st.tees.org.uk/cgi-bin you will see the problem
> yourself.
>
> Many thanks in advance,
>
> Robin
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.261 / Virus Database: 131 - Release Date: 06/06/2001
@INC is the search path that perl uses to look for includes and modules...
from the FAQ:
How do I add a directory to my include path at runtime?
Here are the suggested ways of modifying your include path:
the PERLLIB environment variable
the PERL5LIB environment variable
the perl -Idir command line flag
the use lib pragma, as in
use lib "$ENV{HOME}/myown_perllib";
The latter is particularly useful because it knows about
machine dependent architectures. The lib.pm pragmatic
module was first included with the 5.002 release of Perl.
------------------------------
Date: 02 Jul 2001 19:51:36 +0200
From: Steve Holland <holland@origo.ifa.au.dk>
Subject: Re: Query: PERL v.s. Perl ==> What's the difference???
Message-Id: <w47lmm7w76f.fsf@origo.ifa.au.dk>
weedmonster_99@yahoo.com (codeslayer) writes:
> PERL is an acronym for Practical Extraction and Report Language, and
> thus it stands to reason that one would write it "correctly" with
> all capitals; that is the convention.
That expansion was created after perl was already created. It
was not the original name. Personally, I generally tell people that
perl stands for Practically Eliminates Rival Languages. They usually
don't believe me and go and read the FAQ.
=====================================================================
To find out who and where I am look at:
http://www.nd.edu/~sholland/index.html
=====================================================================
------------------------------
Date: Mon, 02 Jul 2001 11:25:48 -0400
From: syed hussain <syed_altaf@yahoo.com>
Subject: SMTP help
Message-Id: <3B40927C.63FAFE1A@yahoo.com>
Im using the SMTP module for sending email... i couldnot find how to add
the Subject line so that it appears in the email as a subject line..
I would appreciate any help..
thanks
syed
------------------------------
Date: 02 Jul 2001 10:40:44 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: SMTP help
Message-Id: <87ae2nmj9f.fsf@limey.hpcc.uh.edu>
>> On Mon, 02 Jul 2001 11:25:48 -0400,
>> syed hussain <syed_altaf@yahoo.com> said:
> Im using the SMTP module for sending email... i couldnot
> find how to add the Subject line so that it appears in
> the email as a subject line..
> I would appreciate any help..
The datasend() method. The example in the documentation
shows a "To" header, constructing a "Subject" should be
obvious.
Alternatively, you could use the argument form of the
data() method to bundle a message built from a module like
Mail::Internet, or use Mail::Internet or Mail::Mailer to
send the message for you (let the module or back-end mail
transport do the SMTP protocol for you).
hth
t
--
Somebody light this monkey. AAAAGGGHHHH!! Bad monkey!
------------------------------
Date: Mon, 02 Jul 2001 10:39:49 -0600
From: pt <mnemotronic@mind\no-spam/spring.com>
Subject: Subroutine prototype syntax for passing typeglob?
Message-Id: <3B40A3D5.5AD1DBB2@mindspring.com>
What's the "accepted" (ahem.... yes I know.... it's Perl) syntax for
a subroutine prototype expecting a typeglob? I've noticed that both
the following work, and don't cause compiler barfage
sub foo1(*) ;
sub foo2($) ;
Remove the obvious anti-spam to reply.
------------------------------
Date: Mon, 02 Jul 2001 17:33:58 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: timing can make the difference:
Message-Id: <tk1c46tcjhhu90@corp.supernews.com>
Yo (miriam@allfineantz.nl) wrote:
: I need to execute a script every 20 minutes.
: can't use calendar, cron or other tool.
: I want the script to start sleeping at the end of execution, here's code:
:
: while(1=1) {
This isn't your actual code, as the above is an error (assignment to a
constant). Post real code if you want real answers.
: ####loadza code here####
: sleep(x)
: }
:
: x is the main problem here.... how to get that value in ms?
: I know for 20 minutes x would be 20*60*1000
The argument of sleep() is in seconds, not milliseconds. See 'perldoc -f
sleep'.
: But the script's execution would shift the start-time a few seconds every 20
: minutes.
: So.... uhm..... point is: how do I do this?
Simplest way is to record the next time you want to execute, and sleep for
that time minus current time seconds. Here's an example, in which I've
set the cycle time down to 5 seconds so it's easier to see what's
happening. Note that if the task inside the inner loop takes longer than
the cycle time, the inner loop incrementing of $next never catches up with
the current time, and the outer loop (with its sleep() call) never
iterates.
#!/usr/bin/perl -w
# sleeper - example of timed execution for clpm
# Craig Berry (20010702)
use strict;
my $cycle = 5; # Cycle time in seconds
my $next = time;
while (1) {
while ($next <= time) {
$next += $cycle;
print "Doing cycle work\n";
}
sleep($next - time);
}
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
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 1231
***************************************