[28951] in Perl-Users-Digest
Perl-Users Digest, Issue: 195 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 5 18:10:32 2007
Date: Mon, 5 Mar 2007 15:09:10 -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 Mon, 5 Mar 2007 Volume: 11 Number: 195
Today's topics:
ActiveState Perl User Guide -- how can I add an entry t clyde.ingram@edl.uk.eds.com
Re: ActiveState Perl User Guide -- how can I add an ent <ben@morrow.me.uk>
How to parse a string? <snoopy_@excite.com>
Re: How to parse a string? anno4000@radom.zrz.tu-berlin.de
Re: How to parse a string? <DJStunks@gmail.com>
Re: How to parse a string? <jurgenex@hotmail.com>
incomplete module installation <mmccaws@comcast.net>
Re: Is it ok to change $ENV{'QUERY_STRING'} before "use <ben@morrow.me.uk>
Number of days between 2 dates <bill@ts1000.us>
Re: Number of days between 2 dates <jurgenex@hotmail.com>
Re: Number of days between 2 dates <bill@ts1000.us>
Re: problem in setting environmental variable <paduille.4060.mumia.w+nospam@earthlink.net>
Re: problem in setting environmental variable (Jens Thoms Toerring)
Re: problem in setting environmental variable <m@rtij.nl.invlalid>
Re: problem in setting environmental variable <kenslaterpa@hotmail.com>
Re: Question about wizard Perl programmers <tadmc@augustmail.com>
Re: Question about wizard Perl programmers <krotowitz@yahoo.com>
Re: Question about wizard Perl programmers <cwilbur@chromatico.net>
Re: Question about wizard Perl programmers <devliegendehollander@attempt-at-not-applicable-domain-name.com>
Re: Question about wizard Perl programmers usenet@DavidFilmer.com
Re: Question about wizard Perl programmers <attn.steven.kuo@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Mar 2007 06:34:54 -0800
From: clyde.ingram@edl.uk.eds.com
Subject: ActiveState Perl User Guide -- how can I add an entry to the list of Programs?
Message-Id: <1173105294.843639.119810@h3g2000cwc.googlegroups.com>
When I install my own module, or one from a PPM repository, onto a PC
running ActiveState Perl, a documentation entry appears for this in
the Modules section of my ActiveState Perl User Guide. So far, so
good.
But how can I install my own executable Perl program/script such that
a documentation entry appears for the new program in the Programs
section of the User Guide?
I am starting with my Perl program "ckscan.pl", plus an HTML file
"ckscan.html" generated from the program using pod2html.
When I access the ActiveState User Guide c:/Perl/html/index.html, the
file c:/Perl/html/perltoc.html seems to be regenerated to update the
Modules and Programs panels. What do I have to configure so that my
new program is picked up in the Programs part of perltoc.html?
Simply dropping my html file "ckscan.html" or my program "ckscan.pl"
into c:/perl/bin has no effect.
Thank-you for any constructive advice,
Clyde
------------------------------
Date: Mon, 5 Mar 2007 20:50:26 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: ActiveState Perl User Guide -- how can I add an entry to the list of Programs?
Message-Id: <idcub4-mf9.ln1@osiris.mauzo.dyndns.org>
Quoth clyde.ingram@edl.uk.eds.com:
> When I install my own module, or one from a PPM repository, onto a PC
> running ActiveState Perl, a documentation entry appears for this in
> the Modules section of my ActiveState Perl User Guide. So far, so
> good.
>
> But how can I install my own executable Perl program/script such that
> a documentation entry appears for the new program in the Programs
> section of the User Guide?
If you have installed your program/modules correctly (i.e., under
C:\Perl\site\lib or C:\Perl\bin), and they have embedded POD, you can
regenerate all the HTML documentation from the POD by running
perl -MActivePerl::DocTools -eUpdateHTML
. Note that this will take quite a while to run.
> I am starting with my Perl program "ckscan.pl", plus an HTML file
> "ckscan.html" generated from the program using pod2html.
>
> When I access the ActiveState User Guide c:/Perl/html/index.html, the
> file c:/Perl/html/perltoc.html seems to be regenerated to update the
> Modules and Programs panels.
Err.. no. That's impossible. What happens is that whenever you install
something with PPM, the TOC page is regenerated.
> What do I have to configure so that my
> new program is picked up in the Programs part of perltoc.html?
>
> Simply dropping my html file "ckscan.html" or my program "ckscan.pl"
> into c:/perl/bin has no effect.
If you put your HTML page in the correct place (C:\Perl\html\bin), you
should be able to run
perl -MActivePerl::DocTools -eActivePerl::DocTools::WriteTOC
to just update the TOC. Note: I've never tried this, but it is what PPM
does after installing anything.
A third option would be to package your script up into a proper
distribution, use MakeMaker to create a PPD, and install that using PPM.
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down. [ben@morrow.me.uk]
------------------------------
Date: 5 Mar 2007 13:22:21 -0800
From: "snoopy_@excite.com" <snoopy_@excite.com>
Subject: How to parse a string?
Message-Id: <1173129740.431463.259870@p10g2000cwp.googlegroups.com>
If I have a string that looks like this:
]^Hello]^3422]^GE]^Five]^GE]^Hippo]^GE]^Lart
And I want to count all the instances of "GE" how can I do this?
If I perform a simple search with regular expressions I just get one
instance, I want all. I tried to split on GE, then reduce total count
by 1, but this was not reliable. Is there an easy way to do this?
Thanks.
------------------------------
Date: 5 Mar 2007 21:46:18 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to parse a string?
Message-Id: <553hdaF2307s0U1@mid.dfncis.de>
snoopy_@excite.com <snoopy_@excite.com> wrote in comp.lang.perl.misc:
> If I have a string that looks like this:
>
> ]^Hello]^3422]^GE]^Five]^GE]^Hippo]^GE]^Lart
>
> And I want to count all the instances of "GE" how can I do this?
>
> If I perform a simple search with regular expressions I just get one
> instance, I want all.
That works if done correctly. Since you don't show what you have done,
I don't know what you did wrong. Show your code.
>I tried to split on GE, then reduce total count
> by 1, but this was not reliable.
Have you read the documentation about split(), and what it has to say
about dropping trailing empty fields? And how the LIMIT argument can
be used to keep all fields?
> Is there an easy way to do this?
Using split:
$_ = ']^Hello]^3422]^GE]^Five]^GE]^Hippo]^GE]^Lart';
-- ( my $count =()= split /GE/, $_, -1);
The regex solution is similar but simpler. You can figure it out.
Anno
------------------------------
Date: 5 Mar 2007 13:47:22 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: How to parse a string?
Message-Id: <1173131242.823320.104290@64g2000cwx.googlegroups.com>
On Mar 5, 2:22 pm, "snoo...@excite.com" <snoo...@excite.com> wrote:
> If I have a string that looks like this:
>
> ]^Hello]^3422]^GE]^Five]^GE]^Hippo]^GE]^Lart
>
> And I want to count all the instances of "GE" how can I do this?
>
> If I perform a simple search with regular expressions I just get one
> instance, I want all. I tried to split on GE, then reduce total count
> by 1, but this was not reliable. Is there an easy way to do this?
>
> Thanks.
perldoc -q occurrences
-jp
------------------------------
Date: Mon, 05 Mar 2007 21:48:34 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to parse a string?
Message-Id: <Se0Hh.28$1g.11@trndny05>
snoopy_@excite.com wrote:
> If I have a string that looks like this:
>
> ]^Hello]^3422]^GE]^Five]^GE]^Hippo]^GE]^Lart
>
> And I want to count all the instances of "GE" how can I do this?
>
> If I perform a simple search with regular expressions I just get one
> instance, I want all.
That's strange. I just wrote a 2 line test program and it correctly printed
3 when using a simple RE on your sample data.
I have a few suspicions why your test program didn't print 3 but there is
little point of confusing you with wild guesses, therefore I am afraid you
will have to post your sample program after all.
jue
------------------------------
Date: 5 Mar 2007 13:55:22 -0800
From: "mmccaws2" <mmccaws@comcast.net>
Subject: incomplete module installation
Message-Id: <1173131722.140940.123260@64g2000cwx.googlegroups.com>
is there a command or some method to see which modules downloaded but
failed installation?
I'm still having problem installing Test::Pod due to dependencies.
There seems to few failed on install. Is the best way to resolve
these to remove the downloaded packages and try to reinstall?
Mike
------------------------------
Date: Mon, 5 Mar 2007 21:56:29 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Is it ok to change $ENV{'QUERY_STRING'} before "use CGI;" is called..?
Message-Id: <d9gub4-sr9.ln1@osiris.mauzo.dyndns.org>
Quoth "Raymundo" <gypark@gmail.com>:
> Dear,
>
> When a web-broswer sends a GET request, I can get "keywords" or
> "param"eters using CGI module, as you know:
> $q = new CGI;
> $name = $q->param('name');
>
> However, when browser's request includes multi-byte characters, they
> can be encoded using UTF-8 or EUC-KR(in Korea, for example) according
> to the option in the browswer. ("Send URL in UTF-8" in IE,
> "network.standard-url.encode-utf8" in FF, etc.)
>
> At first, I tried to check the value which I got from $q->param() like
> this:
>
> $name = $q->param("name");
> $name = check_and_convert($name);
> ...
>
> sub check_and_convert {
> # this subroutine guesses the encoding of parameter using
> Encode::Guess
> # if not UTF-8, it converts the parameter to UTF-8 encoded string and
> return it
> }
I would not recommend using Encode::Guess. It isn't safe.
For a (detailed) explanation of details of I18N form submission, see
http://xrl.us/u68e . Executive summary: serve forms as 'text/html;
charset=utf-8' and assume the results are in UTF-8. You should decode
*after* getting the values from CGI->param.
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
ben@morrow.me.uk
------------------------------
Date: 5 Mar 2007 09:43:55 -0800
From: "Bill H" <bill@ts1000.us>
Subject: Number of days between 2 dates
Message-Id: <1173116633.574397.245150@n33g2000cwc.googlegroups.com>
Can anyone point me to some code / examples to find the number of days
that have passed based on 2 dates.
For example
Date 1: 09/28/2006
Date 2: 03/01/2007
How many days have passed between these 2 dates?
Bill H
------------------------------
Date: Mon, 05 Mar 2007 17:50:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Number of days between 2 dates
Message-Id: <qLYGh.6252$Tf.1779@trndny03>
Bill H wrote:
> Can anyone point me to some code / examples to find the number of days
> that have passed based on 2 dates.
Which part of the FAQ "How can I compare two dates and find the difference?"
(see 'perldoc -q date') do you find problematic or not adequate to your
problem?
jue
------------------------------
Date: 5 Mar 2007 09:59:05 -0800
From: "Bill H" <bill@ts1000.us>
Subject: Re: Number of days between 2 dates
Message-Id: <1173117544.434937.276570@t69g2000cwt.googlegroups.com>
On Mar 5, 12:50 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> Bill H wrote:
> > Can anyone point me to some code / examples to find the number of days
> > that have passed based on 2 dates.
>
> Which part of the FAQ "How can I compare two dates and find the differenc=
e?"
> (see 'perldoc -q date') do you find problematic or not adequate to your
> problem?
>
> jue
The whole thing since I didn't know it existed - Thanks for pointing
it out (someone has to ask the stupid questions)!
Bill H
------------------------------
Date: Mon, 05 Mar 2007 11:26:50 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: problem in setting environmental variable
Message-Id: <_7TGh.9493$tD2.7008@newsread1.news.pas.earthlink.net>
On 03/05/2007 03:59 AM, rameshotn3@gmail.com wrote:
> [...]
> I am giving export command in script like
> $ram=20;
> system("export ram");
The variable is exported automatically when you set a key in %ENV.
$ENV{ram} = 20;
system ('echo $ram');
> system command forking one more child process. So the value becomes
> temporary.
>
It will always be temporary.
> How can I come out of this problem.
> Any help in this regard.
>
There is no way to do this directly. Read "perldoc -q environment"
------------------------------
Date: 5 Mar 2007 13:30:57 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: problem in setting environmental variable
Message-Id: <552kchF23dbbcU1@mid.uni-berlin.de>
rameshotn3@gmail.com wrote:
> Hi all I searched in google for this.But no solution is working.
> I am Ramesh working on perl.I am facing one problem in exporting an
> variable.
> Requirement:
> I have to export a new variable through a perl script.
> in brief :
> -->in vi editor i am able to export like below.
> export ram=20;
> --->If I want to see the variable: echo $ram
> giving 20 as the answer.But when I put the export commnad in perl
> script & giving "echo" on vi editor it doesn't giving the value
> associated with that environmental variable
You can't set environment variables for other processes from within
a program. Your programs environment is inherited from the process
that started it (perhaps the shell). Once the program is started its
environment is its private property, nothing than the program itself
can change it. So everything you can change from within a Perl script
is the environment of the script itself and, of course, the environ-
ments of the processes started afterwards from within the script
(since they inherit its environment). But it is simply not possible
to change the environment of any other program that is already run-
ning.
> I got the reason:
> I am giving export command in script like
> $ram=20;
> system("export ram");
That should probably be 'system("export $ram");'
> system command forking one more child process. So the value becomes
> temporary.
system() creates a shell, which then has that environment variable
being set. But that doesn't help you a bit, since it then quits
immediately.
> How can I come out of this problem.
You can't, sorry. The environment isn't what you seem to think it
is. It isn't a medium to exchange informations between processes.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Mon, 5 Mar 2007 22:19:27 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: problem in setting environmental variable
Message-Id: <v3eub4-1r8.ln1@news.rtij.nl>
On Mon, 05 Mar 2007 13:30:57 +0000, Jens Thoms Toerring wrote:
>> How can I come out of this problem.
>
> You can't, sorry. The environment isn't what you seem to think it
> is. It isn't a medium to exchange informations between processes.
Actually it is. But only from parent to child, which is where the OP goes
wrong in his thinking.
M4
------------------------------
Date: 5 Mar 2007 03:08:56 -0800
From: "kens" <kenslaterpa@hotmail.com>
Subject: Re: problem in setting environmental variable
Message-Id: <1173092935.967668.85270@n33g2000cwc.googlegroups.com>
On Mar 5, 4:59 am, ramesho...@gmail.com wrote:
> Hi all I searched in google for this.But no solution is working.
> I am Ramesh working on perl.I am facing one problem in exporting an
> variable.
> Requirement:
> I have to export a new variable through a perl script.
>
> in brief :
> -->in vi editor i am able to export like below.
> export ram=20;
> --->If I want to see the variable: echo $ram
> giving 20 as the answer.But when I put the export commnad in perl
> script & giving "echo" on vi editor it doesn't giving the value
> associated with that environmental variable
>
> I got the reason:
> I am giving export command in script like
> $ram=20;
> system("export ram");
> system command forking one more child process. So the value becomes
> temporary.
>
> How can I come out of this problem.
> Any help in this regard.
If you are actually trying to set the environment variable for use
within your program, use the %ENV hash:
$ENV{ram} = 20;
Assuming 'ram' is the name of the environment variable.
HTH, Ken
------------------------------
Date: Mon, 5 Mar 2007 05:54:43 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Question about wizard Perl programmers
Message-Id: <slrneuo183.o5b.tadmc@tadmc30.august.net>
Marco Neumann <krotowitz@yahoo.com> wrote:
>
> "LovesHisLittleShad" <jgrace5@gmail.com> schrieb im Newsbeitrag
> news:1173067931.041020.191050@c51g2000cwc.googlegroups.com...
>>
>> Run it and see what it does.
>
> I guess I am that kind of guy who just runs strange code that was posted in
> some newsgroup on the internet just because of curiosity.
>
> If anyone cares, the code produces this string:
>
> just another perl hacker
>
> Why it does this, is beyond me.
http://en.wikipedia.org/wiki/Just_another_Perl_hacker
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 5 Mar 2007 16:47:46 +0100
From: "Marco Neumann" <krotowitz@yahoo.com>
Subject: Re: Question about wizard Perl programmers
Message-Id: <eshdj5$crn$1@news.uni-kl.de>
Hello, Sherm, Hello Tad
Thanks for your pointers. I did not know the JAPH aspect of the perl
culture.
Greetings from Germany,
Marco.
------------------------------
Date: 05 Mar 2007 11:10:06 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Question about wizard Perl programmers
Message-Id: <87wt1vfz8h.fsf@mithril.chromatico.net>
>>>>> "L" == LovesHisLittleShad <jgrace5@gmail.com> writes:
L> Is it my imagination, or is Perl a million times harder than
L> other languages?
It's your imagination.
L> Looking at books on all the languages of the past (I'm a
L> programmer), I've notices that Perl is the only one that seems
L> greek in most chapters, with very little explanation of what
L> the people are doing.
Make sure you read books at a level appropriate to your understanding.
If you are just starting out, you'll be lost with a high-level book.
And there are a lot of bad Perl books out there; here's a good one,
that's available online legally:
http://www.perl.org/books/beginning-perl/
Perl has the property that you can learn a little bit of it and get
useful stuff done, especially if you're familiar with C or Unix, but
it also has a lot of flexibility and power for the experts. A book
aimed at experts who are familiar with Perl will seem like Greek to a
beginner, just as _Advanced Programming in the Unix Environment_ will
seem like Greek to a beginner in C.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Mon, 05 Mar 2007 20:07:26 +0100
From: De Vliegende Hollander <devliegendehollander@attempt-at-not-applicable-domain-name.com>
Subject: Re: Question about wizard Perl programmers
Message-Id: <45ec6a97$0$21703$e4fe514c@dreader31.news.xs4all.nl>
The sentient life form Ayaz Ahmed Khan posted the following:
> I find Python much more fun to code in than Perl. I have been coding in
> Perl longer than in Python, though, but having dived into Pythonic waters
> (so to speak), I prefer Python over Perl whenever I have the room to do
> so.
But it's not nearly as powerful as Perl...
------------------------------
Date: 5 Mar 2007 12:53:40 -0800
From: usenet@DavidFilmer.com
Subject: Re: Question about wizard Perl programmers
Message-Id: <1173128018.263676.293830@c51g2000cwc.googlegroups.com>
On Mar 4, 8:30 pm, Uri Guttman <u...@stemsystems.com> wrote:
> you can run it through a deparser and it will be much clearer.
I have never heard of a Perl deparser. How would I do this?
------------------------------
Date: 5 Mar 2007 13:10:59 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Question about wizard Perl programmers
Message-Id: <1173129059.749027.152560@t69g2000cwt.googlegroups.com>
On Mar 5, 12:53 pm, use...@DavidFilmer.com wrote:
> On Mar 4, 8:30 pm, Uri Guttman <u...@stemsystems.com> wrote:
>
> > you can run it through a deparser and it will be much clearer.
>
> I have never heard of a Perl deparser. How would I do this?
$ perldoc O
$ perl -MO=Deparse foo.pl
--
Hope this helps,
Steven
------------------------------
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 V11 Issue 195
**************************************