[19570] in Perl-Users-Digest
Perl-Users Digest, Issue: 1765 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 18 03:06:09 2001
Date: Tue, 18 Sep 2001 00:05:12 -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: <1000796711-v10-i1765@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 18 Sep 2001 Volume: 10 Number: 1765
Today's topics:
Re: debug CGI script <pne-news-20010918@newton.digitalspace.net>
Re: I need Many Very Time Efficient forks from a large (Chris Fedde)
Re: I need Many Very Time Efficient forks from a large <uri@sysarch.com>
libnet 1.0704 install problem <mr_nobody02@hotmail.com>
Limiting floating point decimal places. <mfrick@chariot.net.au>
Re: Limiting floating point decimal places. <Laocoon@eudoramail.com>
Re: Limiting floating point decimal places. (Chris Fedde)
Re: Limiting floating point decimal places. <uri@sysarch.com>
Re: Limiting floating point decimal places. (Tim Hammerquist)
Re: Limiting floating point decimal places. <mfrick@chariot.net.au>
Re: Looking for Perl programers in Toronto (Malcolm Dew-Jones)
Re: Objects and Sockets <Michael.Schlueter@philips.com>
Re: perl module (Joe Chung)
Re: perl module (Martien Verbruggen)
Re: perl module (Joe Chung)
Re: perl module (Tim Hammerquist)
Re: perl module (Tim Hammerquist)
Persistence in Perl (Venu)
Re: Reading cookies from a different path (Jonadab the Unsightly One)
redefined subroutines <smarx@i2000.com>
Re: redefined subroutines (Chris Fedde)
Re: Regexp Questions <ron@savage.net.au>
Regular Expresion help needed <nospam@me.com>
Re: Regular Expresion help needed <Laocoon@eudoramail.com>
Re: s/// modifies @_ ? <pne-news-20010917@newton.digitalspace.net>
Re: Simple CGI: how to set up downloads? <ron@savage.net.au>
Teradyne STDF file processing (TK Soh)
Re: What does this do ? "select( (select($writer), $|=1 <uri@sysarch.com>
Re: write to a file handle (Joe Chung)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Sep 2001 07:49:31 +0200
From: Philip Newton <pne-news-20010918@newton.digitalspace.net>
Subject: Re: debug CGI script
Message-Id: <k1odqt0afiebjb5hmjnbsqs7cqq8saq260@4ax.com>
On 16 Sep 2001 19:08:04 -0700, merlyn@stonehenge.com (Randal L.
Schwartz) wrote:
> >>>>> "Bob" == Bob Walton <bwalton@rochester.rr.com> writes:
>
> Bob> Well, you can easily add something like:
>
> Bob> %ENV{REQUEST_METHOD}='GET';
> Bob> %ENV{...
> Bob> ....
>
> Not if you want legal syntax. :)
Define "legal". Maybe Bob's just ahead of the times :)
Cheers,
Phi "Perl6" lip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 18 Sep 2001 05:02:34 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: I need Many Very Time Efficient forks from a large program
Message-Id: <KzAp7.496$Owe.282791936@news.frii.net>
In article <x7sndpdrm5.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
>
> LS> In article <9nuboq$rbj$1@eskinews.eskimo.com>,
> LS> Xeno Campanoli <xeno@eskimo.com> wrote:
>
> >> My problem is this: I'm trying to send from a single large testing
> >> application a large number of requests to a server as close to the
> >> same time as possible without having to use threads. My
>
> LS> On the other hand, if you want to send as many requests as possible at
> LS> the same time, the best thing is to use threads and have lots of
> LS> processors. If you have too many threads or processes going at once,
> LS> they may not be able to be scheduled onto a processor in a short enough
> LS> period. But maybe you just mean that you'd like to have several
> LS> separate but overlapping sessions with a server. In that case, it
> LS> shouldn't be a problem.
>
>you can do it all in one process with event programming. use Stem or POE
>as the engine core. no threads, no forks.
>
Has Stem been released to the public?
--
This space intentionally left blank
------------------------------
Date: Tue, 18 Sep 2001 05:12:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: I need Many Very Time Efficient forks from a large program
Message-Id: <x73d5ldquy.fsf@home.sysarch.com>
>>>>> "CF" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:
CF> In article <x7sndpdrm5.fsf@home.sysarch.com>,
CF> Uri Guttman <uri@sysarch.com> wrote:
>>>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
>>
>> you can do it all in one process with event programming. use Stem or POE
>> as the engine core. no threads, no forks.
>>
CF> Has Stem been released to the public?
sort of. you can download it and use it. i have to select the license
and apply it to all the files. but in the meantime, anyone can play with
it and use it. if you want permission, just ask for it. i am looking for
active users of any sort. sometime when i get the tuits, i will CPAN the
current version
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 18 Sep 2001 02:12:21 GMT
From: "Mr Nobody" <mr_nobody02@hotmail.com>
Subject: libnet 1.0704 install problem
Message-Id: <94yp7.63727$bY5.306165@news-server.bigpond.net.au>
Hi,
I'm trying to install libnet, and when I try 'make test', I get the
following error:
bsd# make test
PERL_DL_NONLAZY=1
/usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/libdata/perl/5.00503/mach -I/usr
/libdata/perl/5.00503 -e 'use Test::Harness qw(&runtests $verbose);
$verbose=0; runtests @ARGV;' t/*.t
t/ftp...............ok
t/hostname..........ok
t/nntp..............ok
t/require...........FAILED tests 8-9
Failed 2/11 tests, 81.82% okay
t/smtp..............skipping test on this platform
Failed Test Status Wstat Total Fail Failed List of failed
----------------------------------------------------------------------------
---
t/require.t 11 2 18.18% 8-9
1 test skipped.
Failed 1/5 test scripts, 80.00% okay. 2/23 subtests failed, 91.30% okay.
*** Error code 2
Stop in /usr/home/peter/perl/libnet-1.0704.
Can anybody help? I'm still a newbie :)
Thanks
--
"Keyboard not detected, press F1 to continue..."
------------------------------
Date: Tue, 18 Sep 2001 12:43:45 +0930
From: "Matthew Frick" <mfrick@chariot.net.au>
Subject: Limiting floating point decimal places.
Message-Id: <3ba6bad5$1_6@news.chariot.net.au>
This is one thing I have never done in perl before and can see no reference
to it in my books :(
example:
$count = 8.333333333333333333
but when I print I only want 8.33 to be displayed. ie I wish to limit the
decimal accuracy.
anyone know how I do this (it sounds to me like it should be easy)
thanks in advance.
Matthew Frick.
------------------------------
Date: Tue, 18 Sep 2001 06:44:57 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Limiting floating point decimal places.
Message-Id: <Xns91204605EA137Laocooneudoramail@62.153.159.134>
perldoc -f sprintf
perldoc -f printf
------------------------------
Date: Tue, 18 Sep 2001 05:00:22 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Limiting floating point decimal places.
Message-Id: <GxAp7.495$Owe.300176384@news.frii.net>
In article <Xns91204605EA137Laocooneudoramail@62.153.159.134>,
Laocoon <Laocoon@eudoramail.com> wrote:
>perldoc -f sprintf
>perldoc -f printf
>
Also look at $OFMT and $# in the perlvar manual page.
--
This space intentionally left blank
------------------------------
Date: Tue, 18 Sep 2001 05:02:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Limiting floating point decimal places.
Message-Id: <x766ahdrbj.fsf@home.sysarch.com>
>>>>> "CF" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:
CF> In article <Xns91204605EA137Laocooneudoramail@62.153.159.134>,
CF> Laocoon <Laocoon@eudoramail.com> wrote:
>> perldoc -f sprintf
>> perldoc -f printf
>>
CF> Also look at $OFMT and $# in the perlvar manual page.
$# is deprecated and not useful. i think it is also broken in some ways.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 18 Sep 2001 05:40:50 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Limiting floating point decimal places.
Message-Id: <slrn9qdoal.s8e.tim@vegeta.ath.cx>
Me parece que Laocoon <Laocoon@eudoramail.com> dijo:
> perldoc -f sprintf
> perldoc -f printf
Let me add:
perldoc -q round
--
Hanging on in quiet desperation is the English way.
-- Pink Floyd
------------------------------
Date: Tue, 18 Sep 2001 15:57:47 +0930
From: "Matthew Frick" <mfrick@chariot.net.au>
Subject: Re: Limiting floating point decimal places.
Message-Id: <3ba6e84e$1_1@news.chariot.net.au>
Thanks for the hand guys with your help I sorted it out using sprintf. so
cheers.
------------------------------
Date: 18 Sep 2001 00:01:01 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Looking for Perl programers in Toronto
Message-Id: <3ba6f12d@news.victoria.tc.ca>
Steffen Müller (tsee@gmx.net) wrote:
: "hallaj.com" <wael@hallaj.com> schrieb im Newsbeitrag
: news:orcp7.60560$j65.10376207@news4.rdc1.on.home.com...
: > Hi
: >
: > I'm looking for perl programers in Toronto. Contact me if you know one.
: jobs.perl.org
Maybe he wants to go out for a beer with some people who like to talk
about perl...
------------------------------
Date: Tue, 18 Sep 2001 08:50:09 +0200
From: "Michael Schlueter" <Michael.Schlueter@philips.com>
Subject: Re: Objects and Sockets
Message-Id: <3ba6eebe$0$230$4d4ebb8e@businessnews.de.uu.net>
Did you check "Programming Perl"?
Several connections via sockets are described there.
If so, what are you missing?
Michael
------------------------------
Date: Tue, 18 Sep 2001 01:28:41 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: Re: perl module
Message-Id: <3ba7a1f2.30296453@enews.newsguy.com>
Will the .pm file be compiled and loaded into memory for the 1st time
a CGI script get called that uses it?
-OR- .pm file will re-intepreted every call to CGI script that uses
it?
-OR- apache web server's mod_perl compiles / loads all .pm module into
memory when web server starts?
Similarly, will mod_perl (apapche module) loads the CGI script into
memory the 1st time of request? Or it will be re-intepreted for every
request to the same CGI?
thanks again.
On Tue, 18 Sep 2001 00:31:40 GMT, tim@vegeta.ath.cx (Tim Hammerquist)
wrote:
>Me parece que Joe Chung <m_010@yahoo.com> dijo:
>> does perl module all end with pm extension? are they plain text file?
>> or binary file? do i need to recomplie my perl interperter to
>> integrate the module into perl? or i just need to put xxxx.pm into
>> the perl interperter's path?
>
>Perl modules (the files you 'use' from a perl script) end in .pm. This
>is not a rule, and there are ways around this, but unless you know
>exactly why you _need_ to work around it, you should probably just
>assume that .pm is the extension for a perl module.
>
>.pm files are text files containing Perl code. Some modules require
>extensions to be compiled. ActiveState provides many of these,
>precompiled, for Win32 systems, as Win32 OSs are compiler-deficient.
>Most of the time these modules can be dynamically linked at run time
>simply by having the .pm file and any necessary extensions in a
>specified location in the Perl directory tree. When you "make" a Perl
>module distribution, the Makefile takes care of this for you. There are
>few occasions when the module must be statically linked into the perl
>binary, but this is very rare, AFAIK.
>
>On *nix systems, to install the MLDBM module, just type:
>
># perl -MCPAN -e 'install DBD::mysql'
>
>and answer any questions it asks. Usually a sysadmin should be doing
>this.
>
>On Win32 systems, using ActivePerl, try:
>
>C:\> ppm install DBD::mysql
># (that is, if ActiveState hosts a precompiled DBD::mysql module)
>
>> since i had read some article said i need to recompile perl
>> distribution to use some module.
>
>Knowing what module this is would help in finding out whether you
>actually need to recompile your perl to use a module. If you have the
>module's README or INSTALL file handy, it should tell you if this is
>necessary.
>
>> thanks
>
>HTH
------------------------------
Date: Tue, 18 Sep 2001 12:18:57 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perl module
Message-Id: <slrn9qdboh.u1e.mgjv@martien.heliotrope.home>
[Please in the future, put your reply _after_ the suitably trimmed text
you reply to. It is the commonly accepted quoting style on this
newsgroup, and Usenet in general]
On Tue, 18 Sep 2001 01:28:41 GMT,
Joe Chung <m_010@yahoo.com> wrote:
> On Tue, 18 Sep 2001 00:31:40 GMT, tim@vegeta.ath.cx (Tim Hammerquist)
> wrote:
[post re-arranged and severly shortened]
>>Me parece que Joe Chung <m_010@yahoo.com> dijo:
>>> does perl module all end with pm extension? are they plain text file?
>>> or binary file? do i need to recomplie my perl interperter to
>>> integrate the module into perl? or i just need to put xxxx.pm into
>>> the perl interperter's path?
>>
>>Perl modules (the files you 'use' from a perl script) end in .pm. This
>>is not a rule, and there are ways around this, but unless you know
>>exactly why you _need_ to work around it, you should probably just
>>assume that .pm is the extension for a perl module.
[snip more on modules]
> Will the .pm file be compiled and loaded into memory for the 1st time
> a CGI script get called that uses it?
Yes.
> -OR- .pm file will re-intepreted every call to CGI script that uses
> it?
Yes.
Why do you think they're related questions? Each CGI run is a separate
process (unless your web server does things differently). Each will,
under normal circumstances, load every module it uses only once.
> -OR- apache web server's mod_perl compiles / loads all .pm module into
> memory when web server starts?
>
> Similarly, will mod_perl (apapche module) loads the CGI script into
> memory the 1st time of request? Or it will be re-intepreted for every
> request to the same CGI?
Why don't you read some documentation on mod_perl if you're interested?
You can find oodles and oodles of information on it, how it works and
how to use it at http://perl.apache.org/. Once you've rummaged around
there for a bit, and have specific Perl questions, you should come back.
If you're interested in specific implementation details of stuff like
this, the best place to read about it is normally the manual, and, if
available, the FAQ.
Martien
--
Martien Verbruggen |
Interactive Media Division | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Tue, 18 Sep 2001 04:01:40 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: Re: perl module
Message-Id: <3ba6c662.3365429@enews.newsguy.com>
On Tue, 18 Sep 2001 12:18:57 +1000, mgjv@tradingpost.com.au (Martien
Verbruggen) wrote:
>[Please in the future, put your reply _after_ the suitably trimmed text
>you reply to. It is the commonly accepted quoting style on this
>newsgroup, and Usenet in general]
>
>On Tue, 18 Sep 2001 01:28:41 GMT,
> Joe Chung <m_010@yahoo.com> wrote:
>> On Tue, 18 Sep 2001 00:31:40 GMT, tim@vegeta.ath.cx (Tim Hammerquist)
>> wrote:
>
>[post re-arranged and severly shortened]
>
>>>Me parece que Joe Chung <m_010@yahoo.com> dijo:
>>>> does perl module all end with pm extension? are they plain text file?
>>>> or binary file? do i need to recomplie my perl interperter to
>>>> integrate the module into perl? or i just need to put xxxx.pm into
>>>> the perl interperter's path?
>>>
>>>Perl modules (the files you 'use' from a perl script) end in .pm. This
>>>is not a rule, and there are ways around this, but unless you know
>>>exactly why you _need_ to work around it, you should probably just
>>>assume that .pm is the extension for a perl module.
>
>[snip more on modules]
>
>> Will the .pm file be compiled and loaded into memory for the 1st time
>> a CGI script get called that uses it?
>
>Yes.
>
>> -OR- .pm file will re-intepreted every call to CGI script that uses
>> it?
>
>Yes.
>
>Why do you think they're related questions? Each CGI run is a separate
>process (unless your web server does things differently). Each will,
>under normal circumstances, load every module it uses only once.
If every request to a perl script will result in re-compile
(re-intepret) of the source code, then re-link with the perl module
source file. the performance would be suffer if the source file are
big. But why I don't see a big delay when request to a perl script?
when I complie and link a simple c++ file in visual c++. it takes me
couple seconds.
>
>> -OR- apache web server's mod_perl compiles / loads all .pm module into
>> memory when web server starts?
>>
>> Similarly, will mod_perl (apapche module) loads the CGI script into
>> memory the 1st time of request? Or it will be re-intepreted for every
>> request to the same CGI?
>
>Why don't you read some documentation on mod_perl if you're interested?
>You can find oodles and oodles of information on it, how it works and
>how to use it at http://perl.apache.org/. Once you've rummaged around
>there for a bit, and have specific Perl questions, you should come back.
>If you're interested in specific implementation details of stuff like
>this, the best place to read about it is normally the manual, and, if
>available, the FAQ.
>
>Martien
------------------------------
Date: Tue, 18 Sep 2001 05:28:49 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: perl module
Message-Id: <slrn9qdnk3.s8e.tim@vegeta.ath.cx>
Me parece que Joe Chung <m_010@yahoo.com> dijo:
> Tim Hammerquist wrote:
> >Me parece que Joe Chung <m_010@yahoo.com> dijo:
> >> does perl module all end with pm extension? are they plain text file?
> >> or binary file? do i need to recomplie my perl interperter to
> >> integrate the module into perl? or i just need to put xxxx.pm into
> >> the perl interperter's path?
> >
> >Perl modules (the files you 'use' from a perl script) end in .pm. This
> >is not a rule, and there are ways around this, but unless you know
> >exactly why you _need_ to work around it, you should probably just
> >assume that .pm is the extension for a perl module.
> >
> >.pm files are text files containing Perl code. Some modules require
> >extensions to be compiled. ActiveState provides many of these,
> >precompiled, for Win32 systems, as Win32 OSs are compiler-deficient.
> >Most of the time these modules can be dynamically linked at run time
> >simply by having the .pm file and any necessary extensions in a
> >specified location in the Perl directory tree. When you "make" a Perl
> >module distribution, the Makefile takes care of this for you. There are
> >few occasions when the module must be statically linked into the perl
> >binary, but this is very rare, AFAIK.
> >
> >On *nix systems, to install the MLDBM module, just type:
> >
> ># perl -MCPAN -e 'install DBD::mysql'
> >
> >and answer any questions it asks. Usually a sysadmin should be doing
> >this.
> >
> >On Win32 systems, using ActivePerl, try:
> >
> >C:\> ppm install DBD::mysql
> ># (that is, if ActiveState hosts a precompiled DBD::mysql module)
> >
> >> since i had read some article said i need to recompile perl
> >> distribution to use some module.
> >
> >Knowing what module this is would help in finding out whether you
> >actually need to recompile your perl to use a module. If you have the
> >module's README or INSTALL file handy, it should tell you if this is
> >necessary.
>
> Will the .pm file be compiled and loaded into memory for the 1st time
> a CGI script get called that uses it?
> -OR- .pm file will re-intepreted every call to CGI script that uses
> it?
> -OR- apache web server's mod_perl compiles / loads all .pm module into
> memory when web server starts?
For a normal CGI request, the following are loading and run _each_ and
_every_ time the script is called:
1. the perl interpreter (loaded, executed)
2. the CGI script (parsed, compiled, executed)
3. the modules used by the CGI script (parsed, compiled, executed)
Such is the nature of CGI. And with a large module like CGI.pm, this can
cause a large overhead. This is the argument many use against CGI.pm.
Fortunately, there are more compact, less robust CGI module on CPAN,
such as CGI::Lite, CGI::Minimal, etc. See
http://search.cpan.org/search?mode=module&query=CGI
for a list of CGI-related modules.
> Similarly, will mod_perl (apapche module) loads the CGI script into
> memory the 1st time of request? Or it will be re-intepreted for every
> request to the same CGI?
mod_perl doesn't need to load the perl interpreter into memory for each
request, by nature; it's included in the same memory area as the server.
mod_perl does *not*, however, load the modules each and every time they
are called by a script. As the interpreter is kept in memory, so are all
supplemental modules loaded...until the server is shut down or
restarted.
mod_perl does not recompile the script each time it is run. In fact,
any global variables set in a mod_perl script will run over into the
next execution, causing many hard to trace errors. This is why 'use
strict' is the first advice given to mod_perl programmers.
Such is the nature of mod_perl, and why many find it preferable to CGI
scripts.
Thus, CGI.pm is loaded, parsed, and compiled exactly *once*, the first
time it's called from a script.
BTW: CGI.pm is a Pure Perl module, that does not require any
installation procedures beyond simply placing it in the perl directory
tree.
> thanks again.
--
It usually takes more than three weeks to prepare a good impromptu speech.
-- Mark Twain
------------------------------
Date: Tue, 18 Sep 2001 05:38:20 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: perl module
Message-Id: <slrn9qdo5u.s8e.tim@vegeta.ath.cx>
Me parece que Joe Chung <m_010@yahoo.com> dijo:
> Martien Verbruggen wrote:
[ snippage ]
> >Why do you think they're related questions? Each CGI run is a separate
> >process (unless your web server does things differently). Each will,
> >under normal circumstances, load every module it uses only once.
>
> If every request to a perl script will result in re-compile
> (re-intepret) of the source code, then re-link with the perl module
> source file. the performance would be suffer if the source file are
> big. But why I don't see a big delay when request to a perl script?
See other post.
Perl does not "link" it's modules. People may have a hard time
explaining how perl is both interpreted _and_ compiled language, but
linkers are not involved in the execution of a script. A linker _might_
be used to compile a module that requires it, but not at run time.
Other than that, I had a hard time understanding your statements.
> when I complie and link a simple c++ file in visual c++. it takes me
> couple seconds.
Again, no linkers in Perl. Not relevant.
> >> -OR- apache web server's mod_perl compiles / loads all .pm module into
> >> memory when web server starts?
> >>
> >> Similarly, will mod_perl (apapche module) loads the CGI script into
> >> memory the 1st time of request? Or it will be re-intepreted for every
> >> request to the same CGI?
> >
> >Why don't you read some documentation on mod_perl if you're interested?
> >You can find oodles and oodles of information on it, how it works and
> >how to use it at http://perl.apache.org/. Once you've rummaged around
> >there for a bit, and have specific Perl questions, you should come back.
> >If you're interested in specific implementation details of stuff like
> >this, the best place to read about it is normally the manual, and, if
> >available, the FAQ.
Good advice.
Some things to research:
The Perl FAQ at http://www.perl.com/pub/q/FAQs
The CGI spec at http://www.w3.org/CGI/
mod_perl docs at the above URL.
--
I have never let my schooling interfere with my education.
-- Mark Twain
------------------------------
Date: 17 Sep 2001 23:16:45 -0700
From: spaceme_2001@yahoo.com (Venu)
Subject: Persistence in Perl
Message-Id: <63225d3.0109172216.6c86553c@posting.google.com>
Hi all,
I want to know is there any Persistence mechanism exists in Perl?
Suppose i have a search where i need to display the results 10 per
page. Now i got 100 matches and need to display in 10 pages. Now here
generally what i'm doing now is store 10 records in each text file
(total 10 files) and display accordingly. But there are lot of
problems in this. I want to know, is there any way so that i can store
all the 100 matches in an array or something so that i can display
through perl? I heard there is a module (persistence module) for this?
Any one has ever faced this problem? If so please suggest me the way.
Thanks in advance,
- Venu
------------------------------
Date: Tue, 18 Sep 2001 01:15:50 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: Reading cookies from a different path
Message-Id: <3ba69f98.48817562@news.bright.net>
mjd@plover.com (Mark Jason Dominus) wrote:
> > @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
> > @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
> > ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> > close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
>
> >Modification of a read-only value attempted at temp.pl line 3.
> >Modification of a read-only value attempted at temp.pl line 3.
> >Modification of a read-only value attempted at temp.pl line 3.
> >Modification of a read-only value attempted at temp.pl line 3.
> >Modification of a read-only value attempted at temp.pl line 3.
>
> If you need the -w flag
That's what I get *without* the -w flag.
*with* it, there are a bunch of additional warnings, of course.
--
$_=$j="(.";s/$/.)/;$o=$_;s/..//;$k=reverse;($a,$b,$c,)="U r bad"=~
"$j$k$j$k$j+)";($f,$d)="lyons"=~"$o.$o";$_=$d;s/s/o/;$;=reverse($c
."a$_");s/o/e/ ;$e="O$_";$g="h";s/$/t/;$ := ".$_";($i) =/(.)$/;$,=
"ig$g$i";$\="he $a$d$,$f $e <j$;\@b$b$,$:>$/";print"$/-- $/J$; $i";
------------------------------
Date: Mon, 17 Sep 2001 22:31:42 -0400
From: "Steven Marx" <smarx@i2000.com>
Subject: redefined subroutines
Message-Id: <wgyp7.9471$im.954914@e420r-atl2.usenetserver.com>
i am getting the error messages "subroutine x redefined" when i took Lincoln
Stein's CGI script listed in "Advanced Techniques" in his CGI.pm manual and
added: use strict; and use warnings; now for my question: What is the common
cause for this error mesage. i list the code that i ran below. please note
that since i ran this from my local command line under dos i force the input
programmatically that would normally come from the form itself. please also
note that i get the same result under Linux.
the code:
#!/usr/local/bin/perl
use strict;
use warnings;
use CGI qw(:standard);
my $query = new CGI;
print $query->header;
print $query->start_html("Save and Restore Example");
print "<H1>Save and Restore Example</H1>\n";
$query->param(-name=>'action', values=>'save'); #we force this so we can
execute from command line
if($query->param()) {
# Here's where we take action on the previous request
#&save_parameters($query) if $query->param('action') eq 'save';
&save_parameters() if $query->param('action') eq 'save';
#$query = &restore_parameters($query) if $query->param('action') eq
'restore';
$query = &restore_parameters() if $query->param('action') eq
'restore';
}
# Here's where we create the form
print $query->startform;
print "Popup 1:
",$query->popup_menu('popup1',['eenie','meenie','minie']),"\n";
print "Popup 2: ",$query->popup_menu('popup2',['et','lux','perpetua']),"\n";
print "<P>";
print "Save/restore state from file:
",$query->textfield('savefile','state.sav'),"\n";
print "<P>";
print $query->submit('action','save'),$query->submit('action','restore');
print $query->submit('action','usual query');
print $query->endform;
# Here we print out a bit at the end
print $query->end_html;
sub save_parameters {
local(*FILE);
# my $query = @_;
my $filename = &clean_name($query->param('savefile'));
if (open(FILE,">$filename")) {
$query->save(*FILE);
close FILE;
print "<STRONG>State has been saved to file $filename</STRONG>\n";
} else {
print "<STRONG>Error:</STRONG> couldn't write to file $filename: $!\n";
}
}
sub restore_parameters {
local(*FILE);
# my $query = @_;
my $filename = &clean_name($query->param('savefile'));
if (open(FILE,$filename)) {
$query = new CGI(*FILE); # Throw out the old query, replace it with a new
one
close FILE;
print "<STRONG>State has been restored from file $filename</STRONG>\n";
} else {
print "<STRONG>Error:</STRONG> couldn't restore file $filename: $!\n";
}
return $query;
}
# Very important subroutine -- get rid of all the naughty
# metacharacters from the file name. If there are, we
# complain bitterly and die.
sub clean_name {
my $name = @_;
unless ($name=~/^[\w\._-]+$/) {
print "<STRONG>$name has naughty characters. Only ";
print "alphanumerics are allowed. You can't use absolute
names.</STRONG>";
die "Attempt to use naughty characters";
}
return $name;
}
------------------------------
Date: Tue, 18 Sep 2001 04:56:55 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: redefined subroutines
Message-Id: <ruAp7.494$Owe.282791936@news.frii.net>
In article <wgyp7.9471$im.954914@e420r-atl2.usenetserver.com>,
Steven Marx <smarx@i2000.com> wrote:
>i am getting the error messages "subroutine x redefined" when i took Lincoln
>Stein's CGI script listed in "Advanced Techniques" in his CGI.pm manual and
>added: use strict; and use warnings; now for my question: What is the common
>cause for this error mesage. i list the code that i ran below. please note
>that since i ran this from my local command line under dos i force the input
>programmatically that would normally come from the form itself. please also
>note that i get the same result under Linux.
>
I suspect that you have a subroutine called x that is also defined
in some library that you are using. maybe in CGI.pm? But for the
life of me I cannot find a subroutine called 'x' in your listing.
Humm...
Maybe the function called 'save_parameters' defined in CGI.pm and
exported with the ':standard' group is conflicting with the one
called 'save_parameters' in your code. But that is just a guess.
Good Luck
--
This space intentionally left blank
------------------------------
Date: Tue, 18 Sep 2001 12:09:52 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Regexp Questions
Message-Id: <T4yp7.1271$pk3.66567@ozemail.com.au>
Marc
See below.
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
Marc Schaefer <schaefer@pdtec.de> wrote in message news:388a211a.0109170929.60ecd5e7@posting.google.com...
> Hello everybody,
> i've a String, for example
>
> #22 = X_DOC_DAT(1281825423, 1, 0, 101, 999, '22-AUG-01', '22-AUG-01',
> 'ddr', '82039100', '0', '000', '100101', 'X3D_MODEL', 'S1', $,
> 'BUEGEL, LORDOSE', $, 0, 1, 'KRC_STD', 1550, $, $, '10-JAN-01',
> '01-JAN-00', $, 'y', $, $, $, $, 'S', '08', $, 212457, '82039100
> +000+S1+S+ S+08+BOH+BUEGEL, LORDOSE +100101',
> 'EFTD_AKTUELL_EDBKL', 'KRCNORM15', $, $, 'CATIA_4.2.2', '818644',
> 1882953024, $);
>
> I need to get the data between the 34 and 35 comma. Up to now i did a
>
> $field = (split /,/, $line)[35];
>
> where $line contains the string mentioned above.
>
> Now i realized, that sometimes there are commas in the data (right
> after BUEGEL)so in the end i get not what i want.
I suggest you use the pure Perl module Text::CSV, or the module Text::CSV_XS.
The latter may well be installed already.
------------------------------
Date: Tue, 18 Sep 2001 08:53:36 +0200
From: Marcelo Montagna <nospam@me.com>
Subject: Regular Expresion help needed
Message-Id: <3BA6EF70.BE925CBC@me.com>
Hello everyone,
I have an html source and I am trying to remove all the comments with
regular expressions
For example, the HTML has
<!--
some comments here
-->
I tried this:
$HTML =~ s/\n/ /g;
$HTML =~ s/<!--[^-->]+-->/ /g;
and this:
$HTML =~ s/\n/ /g;
$HTML =~ s/<\!\-\-[^\-\-\>]+\-\->/ /g;
But it doesn't work.
Any help will be greatly appreciated !
--
Marcelo Montagna
------------------------------
Date: Tue, 18 Sep 2001 08:22:32 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Regular Expresion help needed
Message-Id: <Xns9120569181DFDLaocooneudoramail@62.153.159.134>
http://search.cpan.org/search?dist=HTML-Parser
Check out HTML::Filter .. there is an example which does just what u want
------------------------------
Date: Tue, 18 Sep 2001 07:48:01 +0200
From: Philip Newton <pne-news-20010917@newton.digitalspace.net>
Subject: Re: s/// modifies @_ ?
Message-Id: <1bldqtsfc08vcq5mql4f1si8ph8bm2qn3g@4ax.com>
On Sun, 16 Sep 2001 23:20:50 +0200, peter pilsl <pilsl_@goldfisch.at>
wrote:
> Like you imagined, I passed $1 as argument to my function. (which cant be
> avoided easily, cause I use this function inside a different
> s///e-operation).
Wouldn't it be possible to pass (my $match = $1) instead? Or "$1" to
generate an anonymous string copy? Or $1 . '', for a similar effect?
Somehow, the "passing $1 directly can't be avoided" strikes me as
implausible.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 18 Sep 2001 12:11:24 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Simple CGI: how to set up downloads?
Message-Id: <j6yp7.1272$pk3.67006@ozemail.com.au>
Alicia
Perl tutorial # 40 here http://savage.net.au/Perl-tutorials.html does this.
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: 17 Sep 2001 18:25:03 -0700
From: teekaysoh@yahoo.com (TK Soh)
Subject: Teradyne STDF file processing
Message-Id: <63acfc30.0109171725.4de0c427@posting.google.com>
hi there,
I am just checking if anyone out there has done some work for
Teradyne's STDF/ATDF (don't ask me what these are :-) file processing,
and is willing to share. I am actually working on one, but wonder if I
should continue to re-invent the wheel.
TIA.
------------------------------
Date: Tue, 18 Sep 2001 02:54:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: What does this do ? "select( (select($writer), $|=1)[0] );" ?
Message-Id: <x78zfddx91.fsf@home.sysarch.com>
>>>>> "SB" == Stan Brown <stanb@panix.com> writes:
SB> In <x7d74pe9ms.fsf@home.sysarch.com> Uri Guttman <uri@sysarch.com> writes:
>> do you have a fscking clue? you posted over 5k lines of code here!! do
>> you think anyone will wallow through that? instead refer people to a
>> url where your code is posted. and on top of that, the perl.tk group is
>> overe there ---->
SB> Thanks for your helpful reply.
you're welcome.
SB> In case you don't bother to read groups you refer people to, I
SB> have a simple question posted over there which was posted 5 days
SB> ago.
SB> Still no reply.
so, that means you must post 5k lines of code? is that going to help at
all?
SB> And I'm not at all certain the core problem is perlTK related.
but all i have seen is perl/tk related issues.
SB> I am certain that I have bee fighting it for over a week now, and
SB> have gotten it down to a very simple problem, which I was hopeful,
SB> I might actually get some useful information about.
is that 5k lines post your simple problem? not simple in my book.
try again.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 18 Sep 2001 01:20:40 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: Re: write to a file handle
Message-Id: <3ba6a115.30075095@enews.newsguy.com>
i found out I must put the "\n" in the end of the string. why this
happen? Is that if i want to write a line into a filehandle, I must
end the line with "\n"?
thanks again.
On Tue, 18 Sep 2001 00:15:42 +0000 (UTC), efflandt@xnet.com (David
Efflandt) wrote:
>On Mon, 17 Sep 2001 19:46:35 GMT, Joe Chung <m_010@yahoo.com> wrote:
>> i am trying to write to a filehandle
>>
>> open(LOCK,">/export/home/admin/log");
>> print LOCK "test string";
>>
>> the premession of log is like this:
>> -rw-r--r-- 1 root other 5 Sep 17 12:41 log
>>
>> why after the above statement execute, nothing is written to the file
>> "log" (the file is empty)?
>
>You fail to test your open() and fail to terminate the print string.
>Although, I would think that closing the file would flush it.
>
>print output is buffered until it reaches "\n" in the printed string
>unless you set $| = 1;.
>
>Only 'root' user has permission to write to this file.
------------------------------
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 1765
***************************************