[23459] in Perl-Users-Digest
Perl-Users Digest, Issue: 5674 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 17 06:05:41 2003
Date: Fri, 17 Oct 2003 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Oct 2003 Volume: 10 Number: 5674
Today's topics:
A New bie's doubt <narendranath.ts1@de.bosch.com>
Re: A New bie's doubt <andy@shitov.ru>
Re: A New bie's doubt <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: A New bie's doubt <andy@shitov.ru>
Re: A New bie's doubt <andy@shitov.ru>
Re: combining regular expressions (Tad McClellan)
Re: How to propagate -w and use strict? (Jay Tilton)
Re: Junior attempts binary data manipulation <josef.moellers@fujitsu-siemens.com>
Re: line to array convertion (Tad McClellan)
Re: Mason ? <no-spam_christophe.goer@laposte.net>
Re: Mason ? <no-spam_christophe.goer@laposte.net>
Re: Mason ? <calle@cyberpomo.com>
Re: Mason ? <peter@semantico.com>
Re: Mason ? <peter@semantico.com>
OT: 'time' utilty for Win*? (!Cygwin) <bik.mido@tiscalinet.it>
Re: Perl scripts for Unix on my windows machine <jwillmore@remove.adelphia.net>
Re: Perl scripts for Unix on my windows machine (Tad McClellan)
Re: Perl scripts for Unix on my windows machine (Tad McClellan)
Re: Perl scripts for Unix on my windows machine <jwillmore@remove.adelphia.net>
Re: Perl scripts for Unix on my windows machine (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Oct 2003 10:40:44 +0200
From: "Naren" <narendranath.ts1@de.bosch.com>
Subject: A New bie's doubt
Message-Id: <bmo9ue$3lv$1@ns2.fe.internet.bosch.com>
Hello Grp,
I am new to perl.I am supposed to write a perl code which involves
hashes
line => $lnCnt1,
data => "array1",
how can one append a key value pair programmatically.I could not get it in a
book available here.
thaanx in advance,
rgds,
Naren.
------------------------------
Date: Fri, 17 Oct 2003 12:50:20 +0400
From: Andy Shitov <andy@shitov.ru>
Subject: Re: A New bie's doubt
Message-Id: <bmoag9$qrf$1@gavrilo.mtu.ru>
> how can one append a key value pair programmatically.I could not get it in a
> book available here.
You mean this: how to add new pairs into hash? If so than...
1. You may either declare hash:
my %hash;
2. Or declare and set initial values:
my %hash = {key1 => "value1", key2 => "value2"};
3. Further in the programme you may use hash elements:
my $some_var = $hash{'key1'};
4. And in the same way you may replace its values:
$hash{'key2'} = "new value";
5. To add a new key/value pair, just assing it:
$hash{'new_key'} = "new key's value".
------------------------------
Date: Fri, 17 Oct 2003 09:08:19 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: A New bie's doubt
Message-Id: <Xns9417711F1E52Aelhber1lidotechnet@62.89.127.66>
Andy Shitov <andy@shitov.ru> wrote in news:bmoag9$qrf$1@gavrilo.mtu.ru:
>> how can one append a key value pair programmatically.I could not get
>> it in a book available here.
>
> You mean this: how to add new pairs into hash? If so than...
[...]
> 2. Or declare and set initial values:
>
> my %hash = {key1 => "value1", key2 => "value2"};
Try that with warnings enabled.
Cheers,
Bernard
------------------------------
Date: Fri, 17 Oct 2003 13:12:29 +0400
From: Andy Shitov <andy@shitov.ru>
Subject: Re: A New bie's doubt
Message-Id: <bmobpp$rv7$1@gavrilo.mtu.ru>
>>2. Or declare and set initial values:
>>
>>my %hash = {key1 => "value1", key2 => "value2"};
>
> Try that with warnings enabled.
Human erratum ;-)
It should be
my %hash = (key1 => "value1", key2 => "value2");
or even
my %hash = {"key1" => "value1", "key2" => "value2"};
------------------------------
Date: Fri, 17 Oct 2003 13:14:43 +0400
From: Andy Shitov <andy@shitov.ru>
Subject: Re: A New bie's doubt
Message-Id: <bmobtv$rv7$2@gavrilo.mtu.ru>
> my %hash = ("key1" => "value1", "key2" => "value2");
------------------------------
Date: Thu, 16 Oct 2003 23:11:06 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: combining regular expressions
Message-Id: <slrnbouquq.3i2.tadmc@magna.augustmail.com>
Kev <karigna@verizon.net> wrote:
> /\b\w(3,)\b/g -
Your pattern requires a "3" character and a comma character...
> this one pulls out words of 3 or more characters
... so I kinda doubt that.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Oct 2003 06:30:10 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: How to propagate -w and use strict?
Message-Id: <3f8f859a.414355431@news.erols.com>
"Stephen O. Lidie" <lusol@Pandora.cc.lehigh.edu> wrote:
: Jay Tilton <tiltonj@erols.com> wrote:
: > The only solution that comes to mind is to devolve "do $ARGV[0]" into
: > "eval `cat $ARGV[0]`", so you can graft the pragmas onto the code before
: > it's run. Like, say,
:
: > my $code = `cat $ARGV[0]`;
: > eval "{use warnings;use strict;$code}";
:
: Hmm, still no luck );
:
: [lusol@Ray:~/Desktop/TRACE4] perl w-test
: Name "main::cow" used only once: possible typo at w-test line 5.
: w-test, $^W=1.
: [lusol@Ray:~/Desktop/TRACE4] perl w-test3
: w-test3, $^W=1.
: w-test, $^W=1.
:
: Where w-test is before, and w-test3 is a modified version of w-test2:
:
: BEGIN {
: $^W=1;
: }
: print "w-test3, \$^W=$^W.\n";
: #do './w-test';
:
: my $code = `cat ./w-test`;
: eval `cat w-test`;
Odd. The "once" category of warnings seems to get crippled once runtime
starts. I can't do anything to trigger that warning in code that runs
from a "do EXPR", "eval EXPR", or "require EXPR" statement.
But ordinary runtime warnings, like the "uninitialized" category, work
fine.
I cannot find an explanation for this in the documentation.
------------------------------
Date: Fri, 17 Oct 2003 08:32:23 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Junior attempts binary data manipulation
Message-Id: <3F8F8CF7.5F679DDA@fujitsu-siemens.com>
Dan Jacobson wrote:
> =
> Say, I'm going to be making this file, each line with a time() string,
> and a count,
> print time ." ". 257
> 1066329734 257
> I started thinking about space saving methods,
> printf "%x %x", time, 257
> 3f8ee6df 101
> why don't I just make the file
> [4 byte time][2 byte count][4 byte time][2 byte count]...
> that way, each time I append a time,count pair to the file, I only add
> 6 bytes. Ok, so how do I write out such raw records, and how might I
> turn such a file back into ASCII? Something like chr,ord... Assume the
> file will not leave the machine, so byte order is not a problem.
pack has been mentioned, but binmode is important, too.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Thu, 16 Oct 2003 23:17:29 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: line to array convertion
Message-Id: <slrnbourap.3i2.tadmc@magna.augustmail.com>
arctan <arctan@moonman.com> wrote:
> so if file looked like:
>
> tokpsf
>
> Then after script Id get:
>
> t
> o
> k
> p
> s
> f
----------------
#!/usr/bin/perl
use strict;
use warnings;
$_ = 'tokpsf';
print "$_\n" foreach split //;
print "-----\n";
print "$1\n" while s/(.)//;
----------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Oct 2003 08:45:04 +0200
From: Christophe Goer <no-spam_christophe.goer@laposte.net>
Subject: Re: Mason ?
Message-Id: <3f8f8f53$0$27588$626a54ce@news.free.fr>
Thanks for your answer.. and some more questions :)
Peter Hickman wrote:
> Christophe Goer wrote:
>
>> Also on the performances.. is the caching system worth for totally
>> dynamic content ?
>>
>> Can't i face some performance problem comparing to my hand made
>> mod_perl code?
>>
>> Thanks a lot in advance for your experiences..
>>
>>
>> Christophe Goer.
>
>
> Although we do not have much by way of dynamic content for our sites the
> performance of the sites is more than adequate.
Mason will work wonders
> by itself but to keep things cleaner we have this rule
>
> 1) Displaying information to the user is done by Mason
> 2) All data processing is done in Perl module
That 's what i was thinking of.. btw is there some nasty bugs left in
Mason that i should be aware of?
> Mason allows you to preload all your modules into the Apache daemon at
> startup so you get to load only a single copy. So in effect you have the
> hand coded perl for the critical parts and mason for the donkey work.
Do you speak of Mason libraries or hand coded components?
Is it easy to include javascript on the pages served by Mason?
> Have a look at:
>
> http://www.masonhq.com/
> http://www.masonbook.com/book/
>
i think i will buy the o reilly book.
Thanks again
> Or buy the O'Reilly book.
>
> Your mod perl skills will not be wasted as you can write your own mod
> perl when you need to or you need something that is not so easy in Mason
> (Authentication and Abuse detection come to mind).
>
> Well worth investigation.
>
------------------------------
Date: Fri, 17 Oct 2003 08:46:37 +0200
From: Christophe Goer <no-spam_christophe.goer@laposte.net>
Subject: Re: Mason ?
Message-Id: <3f8f8faf$0$27588$626a54ce@news.free.fr>
btw, do you know other framework i should have a look to?
Christophe
Christophe Goer wrote:
> Thanks for your answer.. and some more questions :)
>
> Peter Hickman wrote:
>
>> Christophe Goer wrote:
>>
>>> Also on the performances.. is the caching system worth for totally
>>> dynamic content ?
>>>
>>> Can't i face some performance problem comparing to my hand made
>>> mod_perl code?
>>>
>>> Thanks a lot in advance for your experiences..
>>>
>>>
>>> Christophe Goer.
>>
>>
>>
>> Although we do not have much by way of dynamic content for our sites
>> the performance of the sites is more than adequate.
>
> Mason will work wonders
>
>> by itself but to keep things cleaner we have this rule
>>
>> 1) Displaying information to the user is done by Mason
>> 2) All data processing is done in Perl module
>
>
> That 's what i was thinking of.. btw is there some nasty bugs left in
> Mason that i should be aware of?
>
>> Mason allows you to preload all your modules into the Apache daemon at
>> startup so you get to load only a single copy. So in effect you have
>> the hand coded perl for the critical parts and mason for the donkey work.
>
>
> Do you speak of Mason libraries or hand coded components?
>
> Is it easy to include javascript on the pages served by Mason?
>
>> Have a look at:
>>
>> http://www.masonhq.com/
>> http://www.masonbook.com/book/
>>
>
> i think i will buy the o reilly book.
>
> Thanks again
>
>> Or buy the O'Reilly book.
>>
>> Your mod perl skills will not be wasted as you can write your own mod
>> perl when you need to or you need something that is not so easy in
>> Mason (Authentication and Abuse detection come to mind).
>>
>> Well worth investigation.
>>
>
------------------------------
Date: Fri, 17 Oct 2003 09:06:29 +0200
From: Calle Dybedahl <calle@cyberpomo.com>
Subject: Re: Mason ?
Message-Id: <863cds4a2y.fsf@ulthar.bisexualmenace.org>
>>>>> "Christophe" == Christophe Goer <no-spam_christophe.goer@laposte.net> writes:
> That 's what i was thinking of.. btw is there some nasty bugs left in
> Mason that i should be aware of?
No. But development goes on, and there will doubtless be bugs in the
future. As long as you don't insist on living on the bleeding edge of
development it's no problem.
> Is it easy to include javascript on the pages served by Mason?
Can't see why it wouldn't be. On my site I produce HTML, CSS and JPEG
from Mason components without problems. You have to be a bit careful
when producing binary data, but it's quite well covered in the documentation.
--
Calle Dybedahl <calle@lysator.liu.se>
"Being stomped on by some sexy commie chick and her perfectly vegan Doc
Martens is not as hot as it sounds." -- babycola
------------------------------
Date: Fri, 17 Oct 2003 09:34:09 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Mason ?
Message-Id: <3f8fa982$0$370$afc38c87@news.easynet.co.uk>
Christophe Goer wrote:
> That 's what i was thinking of.. btw is there some nasty bugs left in
> Mason that i should be aware of?
We got bitten by a very obscure UTF-8 bug but the patch was simple and we
submitted it.
>
>> Mason allows you to preload all your modules into the Apache daemon at
>> startup so you get to load only a single copy. So in effect you have
>> the hand coded perl for the critical parts and mason for the donkey work.
>
>
> Do you speak of Mason libraries or hand coded components?
Just straight forward Perl modules. We use Mason out of the box and then add
whatever Apache::* modules we require, DBI or Sessions for example, as you
would in normal mod perl.
>
> Is it easy to include javascript on the pages served by Mason?
>
A Mason page is plain (x)html with various <% ... %> tags plus a few specific
to Mason <%perl> ... </%perl> for large blocks of perl code, should you need
it. So you just write the JavaScript into the page as you would the html.
------------------------------
Date: Fri, 17 Oct 2003 09:35:43 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Mason ?
Message-Id: <3f8fa9df$0$370$afc38c87@news.easynet.co.uk>
Christophe Goer wrote:
> btw, do you know other framework i should have a look to?
AxKit. No only kidding.
We went from CGI to mod_perl to Mason.
------------------------------
Date: Fri, 17 Oct 2003 09:25:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: OT: 'time' utilty for Win*? (!Cygwin)
Message-Id: <ph5vovguph0appho85l4q6v1ha6td83o4i@4ax.com>
I know this is OT, but since I use 'time' under Linux for quick tests
of my perl scripts, I'm asking here...
Does anyone know if there's a straight port of 'time' *nix utility to
win32? I know that it will be available under Cygwin, but I do not
want/can install it.
I have a set of *nix utilities that do _not_ require an emulation
layer, called UnxUtils/UnxUpdates[*] and even though there are some
incompatibilities due to the fact that the OSes are actually
different, I've been happy using (those utilities that I needed in)
it. But 'time' is not included in the collection!
I've tried both googling for 'time' with some other helping keyword
and browsing fsf site, but couldn't find anything thus far.
[*] Though I don't know if the project is actively maintained any
more.
TIA,
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Fri, 17 Oct 2003 04:38:20 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <20031017003816.667c5ec0.jwillmore@remove.adelphia.net>
On 16 Oct 2003 15:05:50 -0700
reneap@hotmail.com (Ren Patterson) wrote:
> James Willmore <jwillmore@remove.adelphia.net> wrote in message
>
> > The point Anno was making was this:
> > if you code correctly (meaning, you enable warnings), you will get
> > your answers.
> > if you use the documentation, you will get your answers.
>
>
> The scripts are not mine, I do not know how they are coded, I do not
> even know how to code them. What documentation? I looked all over
> and nothing gave me a clear answer. I kept on getting ambiguous
> information, so I thought before doing something wrong I would ask
> "human" beings.
>
>
> >
> > Now, after that little bit of anger, why don't you go somewhere,
> > count to 100, and then post. That direction is included in the
> > FAQ for this group -and- IMHO, good advise.
> >
>
> Sure I can do that. Does the FAQ include a site to go when passive
> aggression and unnecessary predisposed negative attitudes are
> displayed?
No.
However, since you are at a loss to "find" documentation, I'll
give you a hint.
type at your command line:
perldoc perl
There. See. Documentation :-)
There is also http://perldoc.com
More documentation :-)
And, as an added bonus, here's the place to find the FAQ for this
group (aka "our social code" you refer to):
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
And, for no extra charge, try using Google to search for the answer to
your question. There's always a strong possibility that a "human"
_asked_ the question in the past and it was answered by a "human".
And, if you are _specific_ about what you are not sure about, you will
get _specific_ answers. General answers will _always_ yeild general
answers. More importantly, this is a newsgroup, not a help desk :-)
I _strongly_ suggest you tone down a bit. I did _not_ cause what ever
issues you have with the code you're working with. So, don't
disrespect me, I won't disrespect you. I mean, really, if I acted the
way you're acting right now in _your_ home (your house, your rules
comes to mind), would you not kick me out of it? Think about it a bit
before responding.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
A gleekzorp without a tornpee is like a quop without a fertsneet
(sort of).
------------------------------
Date: Thu, 16 Oct 2003 23:00:45 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <slrnbouqbd.3i2.tadmc@magna.augustmail.com>
James Willmore <jwillmore@myrealbox.com> wrote:
> Please read the FAQ for this group
What FAQ for this group?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 16 Oct 2003 23:06:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <slrnbouqmd.3i2.tadmc@magna.augustmail.com>
Michael P. Broida <michael.p.broida@boeing_oops.com> wrote:
> Ah, thanks. Is there some (simple) way to get a list of all
> the "xxxx" that can be used in "perldoc xxxx"?
I just do:
gopod
ls
where I have an alias like this defined:
gopod='cd /usr/local/lib/perl5/5.8.0/pod'
:-)
For just the list:
perldoc perl
For more detail on what's covered in each:
perldoc perltoc
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Oct 2003 05:35:56 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <20031017013555.1098fb64.jwillmore@remove.adelphia.net>
On Thu, 16 Oct 2003 23:00:45 -0500
tadmc@augustmail.com (Tad McClellan) wrote:
> James Willmore <jwillmore@myrealbox.com> wrote:
>
> > Please read the FAQ for this group
>
>
> What FAQ for this group?
Sorry - posting guidelines. Force of habit :-(
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Everyone talks about apathy, but no one does anything about it.
------------------------------
Date: Fri, 17 Oct 2003 00:43:59 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <slrnbov0cv.3om.tadmc@magna.augustmail.com>
James Willmore <jwillmore@remove.adelphia.net> wrote:
> here's the place to find the FAQ for this
> group (aka "our social code" you refer to):
> http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
Calling it a FAQ when it has only one (seldom asked) question in
it is a bit of a stretch. :-)
There is no FAQ for clp.misc.
There is a FAQ for Perl (of course).
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 5674
***************************************