[32392] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3659 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 7 09:09:27 2012

Date: Sat, 7 Apr 2012 06:09: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           Sat, 7 Apr 2012     Volume: 11 Number: 3659

Today's topics:
    Re: Ajax Based Services Status in Unix r.mariotti@fdcx.net
    Re: Ajax Based Services Status in Unix <sssdevelop@gmail.com>
    Re: Ajax Based Services Status in Unix <RedGrittyBrick@spamweary.invalid>
    Re: Ajax Based Services Status in Unix <peter@makholm.net>
    Re: First Commercial Perl Program <jimsgibson@gmail.com>
        future of CamelBones jaialai.technology@gmail.com
    Re: Google Tech Talk: lisp at JPL <rNOSPAMon@flownet.com>
    Re: Google Tech Talk: lisp at JPL <news@lawshouse.org>
    Re: Google Tech Talk: lisp at JPL (Seymour J.)
        How to keep the script from stopping or hanging <rodbass63@gmail.com>
        looking for a hexagon tiling module <*@eli.users.panix.com>
    Re: New module name (Eclipse::PHPMe) <brunodepaulak@yahoo.com.br>
    Re: pairs to tree (Tim McDaniel)
    Re: reason for local($_) ? <hjp-usenet2@hjp.at>
    Re: reason for local($_) ? <*@eli.users.panix.com>
    Re: reason for local($_) ? (Seymour J.)
        Running multiple scripts <dave@invalid.invalid>
    Re: splitting to a hashref <bytebrothers.uk@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 04 Apr 2012 17:05:16 -0400
From: r.mariotti@fdcx.net
Subject: Re: Ajax Based Services Status in Unix
Message-Id: <3rdpn7ln2vbm3p58pqenvgfr56cklks5vm@4ax.com>

On Wed, 4 Apr 2012 04:07:01 -0700 (PDT), SSS Develop
<sssdevelop@gmail.com> wrote:

>Hello,
>
>Looking for web application, written in Perl - which help me manage
>services/applications in Linux Server.
>
>How difficult is  develop such application  Perl which has buttons
>"Start" (if service is off), "Stop"(if service is on), "Restart" (if
>service is on) services. The status etc should be fetched using Ajax
>calls.
>
>
>Any help in this regard will be of great help.
>
>thank you,
>
>sss


Take a look at www.webmin.com and you'll find what you are looking for
(written in perl).


------------------------------

Date: Wed, 4 Apr 2012 23:10:03 -0700 (PDT)
From: SSS Develop <sssdevelop@gmail.com>
Subject: Re: Ajax Based Services Status in Unix
Message-Id: <1cc2f097-3f4a-4fa4-9602-f8aaefe402e2@z5g2000yqj.googlegroups.com>

On Apr 5, 2:05=A0am, r.mario...@fdcx.net wrote:
> On Wed, 4 Apr 2012 04:07:01 -0700 (PDT), SSS Develop
>
>
>
>
>
>
>
>
>
> <sssdeve...@gmail.com> wrote:
> >Hello,
>
> >Looking for web application, written in Perl - which help me manage
> >services/applications in Linux Server.
>
> >How difficult is =A0develop such application =A0Perl which has buttons
> >"Start" (if service is off), "Stop"(if service is on), "Restart" (if
> >service is on) services. The status etc should be fetched using Ajax
> >calls.
>
> >Any help in this regard will be of great help.
>
> >thank you,
>
> >sss
>
> Take a look atwww.webmin.comand you'll find what you are looking for
> (written in perl).

Thank you. I am aware of webmin - that will be overkill solution.
What i was looking for is very simple - any way, exploring Mojolicious
to develop such solution.

It will be great help if i get ideas - on architect such product

thank you,




------------------------------

Date: Thu, 05 Apr 2012 10:09:33 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Ajax Based Services Status in Unix
Message-Id: <4f7d6150$0$10744$5b6aafb4@news.zen.co.uk>

On 05/04/2012 07:10, SSS Develop wrote:
> On Apr 5, 2:05 am, r.mario...@fdcx.net wrote:
>> On Wed, 4 Apr 2012 04:07:01 -0700 (PDT), SSS Develop
>>
>> <sssdeve...@gmail.com>  wrote:
>>> Hello,
>>
>>> Looking for web application, written in Perl - which help me manage
>>> services/applications in Linux Server.
>>
>>> How difficult is  develop such application  Perl which has buttons
>>> "Start" (if service is off), "Stop"(if service is on), "Restart" (if
>>> service is on) services. The status etc should be fetched using Ajax
>>> calls.
>>
>>> Any help in this regard will be of great help.
>>
>>
>> Take a look atwww.webmin.comand you'll find what you are looking for
>> (written in perl).
>
> Thank you. I am aware of webmin - that will be overkill solution.
> What i was looking for is very simple - any way, exploring Mojolicious
> to develop such solution.
>
> It will be great help if i get ideas - on architect such product
>

0) Divide task: GUI, others. Consider Model-View-Controller pattern.
1) Choose a GUI tool (Tk?).
2) Choose "Ajax" tool - You probably just need HTTP client.
3) Write code.
4) If errors: post code, questions & error messages here.

-- 
RGB


------------------------------

Date: Thu, 05 Apr 2012 11:44:05 +0200
From: Peter Makholm <peter@makholm.net>
Subject: Re: Ajax Based Services Status in Unix
Message-Id: <878viams2i.fsf@vps1.hacking.dk>

SSS Develop <sssdevelop@gmail.com> writes:

> How difficult is  develop such application  Perl which has buttons
> "Start" (if service is off), "Stop"(if service is on), "Restart" (if
> service is on) services. The status etc should be fetched using Ajax
> calls.

Start by writing a command line tool which list the services and their
status. Depending on your distribution this tool can be everything from
trivial to quite hard to write.

Having written the above tool yourself it should be trivial to turn into
a simple ajax service. Do it nice and it might take you half an day from
scratch. Any of the simple web frameworks should do, even a plain PSGI
application. 

Then you need some frontend code. It doesn't sound too complex, but I
have always just outsourced that to my web developer colleagues. But
depending on how flashy you want it, it should take more than a few
hours.

This will solve the problem at hand, but not be the most flexible
furture proof solution. Using some of the existing webbased tools for
managing serveres might be wiser over time.

The main problem is that the hard part is tied to you distribution and
it might need to be rewritten to support other unices and even to
support some furture version of your chosen distribution (unless you
want to maintain a legacy init system too). Using one of the existing
flexible solutions with lots of other users would lessen this furture
work.

//Makholm


------------------------------

Date: Fri, 06 Apr 2012 12:52:42 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: First Commercial Perl Program
Message-Id: <060420121252424482%jimsgibson@gmail.com>

In article <87pqbpkqtm.fsf@sapphire.mobileactivedefense.com>, Rainer
Weikusat <rweikusat@mssgmbh.com> wrote:

> Jim Gibson <jimsgibson@gmail.com> writes:
> 
> [...]
> 
> >> my $str='1234567890!@#$
> >> %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> >> =[]\;\',./1234567890!@#$
> >> %^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_+{}|:"<>?~`-
> >> =[]\;\',./';
> 
> [...]
> 
> > their aren't any whitespace characters in your source, so their
> > shouldn't be any in your output.
> 
> There are: the newlines (\n).

Ah, yes. My mistake. Thanks for the correction.

-- 
Jim Gibson


------------------------------

Date: Thu, 05 Apr 2012 17:15:12 -0400
From: jaialai.technology@gmail.com
Subject: future of CamelBones
Message-Id: <9da$4f7e0b61$813f0835$7380@news.eurofeeds.com>

I know that Mr. Pendley passed away last summer.
A sad loss to the community to be sure.
I was curious if anyone knows if his CamelBones work has survived him
in any way?
Did he have any collaborators that have the ability to continue his
projects?

On 6/25/11 7:56 PM, jaialai.technology@gmail.com wrote:
> Sherm,
> I see you are a regular here and anted to make a request of you in
> the open forum.
> First, I love he fact that I can use "ShuX" like I did 10+ years ago
> with MacPerl!
> My request: Back in the day when ShuX would open a small sound file
> would play. Some hickish voice saying "Awww Shucks!". I am feeling
> a bit of nostalgia here but could you bring that back?
> Maybe leave it as an option (off by default?) for people
> with a bit of nostalgia?
> Anyone else second this request? Anyone else remember that little
> bit of fun with the old shux?



------------------------------

Date: Thu, 05 Apr 2012 08:49:28 -0700
From: RG <rNOSPAMon@flownet.com>
Subject: Re: Google Tech Talk: lisp at JPL
Message-Id: <rNOSPAMon-0AE96D.08492705042012@news.albasani.net>

In article 
<6a4a234d-db48-4659-8714-098d79fb94be@l30g2000yqb.googlegroups.com>,
 ccc31807 <cartercc@gmail.com> wrote:

> On Apr 3, 1:53ハam, Xah Lee <xah...@gmail.com> wrote:
> > 〈The Remote Agent Experiment: Debugging Code from 60 Million Miles
> > Away〉
> > Google Tech Talk, (2012-02-14) Presented by Ron Garret. 
> > @http://www.youtube.com/watch?v=_gZK0tW8EhQ
> 
> RG mentions giving a more technical version to a Lisp User Group. Any
> chance that this talk is publicly available?

Nope.  It wasn't recorded.  Sorry.

> Thanks for the talk, Ron, I really enjoyed it, and wish you (and NASA)
> all the best.

I haven't worked at NASA for nearly ten years now, but thanks for the 
kinds words nonetheless.

rg


------------------------------

Date: Thu, 05 Apr 2012 19:25:00 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: Google Tech Talk: lisp at JPL
Message-Id: <Zt2dnWC_zcfhfuDSnZ2dnUVZ7sCdnZ2d@giganews.com>

On 03/04/12 06:53, Xah Lee wrote:
> Dearly beloved lisperati,

Is there any way we can stop this moron cross-posting to irrelevant 
groups?  I have kill-filed him as best I can but that doesn't stop the 
follow-ups.  What sort of a plonker posts a note starting as above to 
Perl, Emacs and Python groups?

-- 

Henry Law            Manchester, England


------------------------------

Date: Thu, 05 Apr 2012 16:29:01 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Google Tech Talk: lisp at JPL
Message-Id: <4f7e008d$12$fuzhry+tra$mr2ice@news.patriot.net>

In <Zt2dnWC_zcfhfuDSnZ2dnUVZ7sCdnZ2d@giganews.com>, on 04/05/2012
   at 07:25 PM, Henry Law <news@lawshouse.org> said:

>What sort of a plonker posts a note starting as above to  Perl, 
>Emacs and Python groups?

A fool with delusions of adequacy.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



------------------------------

Date: Sat, 7 Apr 2012 05:25:05 -0700 (PDT)
From: Nene <rodbass63@gmail.com>
Subject: How to keep the script from stopping or hanging
Message-Id: <e06c97a8-bfcb-47a5-8ad9-5d5075bdccf5@h20g2000yqd.googlegroups.com>

Hi,

This script below stops and hangs after it fails to find the directory
in the following code:
chdir("/c\$/$stuff/") || die "cannot cd into /c\$/$stuff ($!)";

Here is the output it gets when it doesn't find the directory:
cannot cd into /c$/blah (No such file or directory) at ./start_blah.pl
line 12, <SCRATCHPAD> line 40.

But I don't want it to stop, I want it to proceed.  How do I go about
getting that?


#!/usr/bin/perl -w
print "\n";
print "Starting .....\n";

open(SCRATCHPAD,"LOG.txt") or die "can't open $!";

my @uniq = <SCRATCHPAD>;

foreach my $stuff ( @uniq ) {
chomp($stuff);

chdir("/c\$/$stuff/") || die "cannot cd into /c\$/$stuff ($!)";

open(STARTUP, "/c\$/$stuff/startup |");

system('sleep 10');

}
close(STARTUP);
close(SCRATCHPAD);


------------------------------

Date: Fri, 6 Apr 2012 18:37:02 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: looking for a hexagon tiling module
Message-Id: <eli$1204061406@qz.little-neck.ny.us>

I'd like a module to manipulate co-ordinates on an X,Y plane that
have an overlapping hexagon grid. Consider, for example, a game
that uses a hexagonal grid to move around. Chinese Checkers (star
halma) is one such game. You would want functions to turn a mouse
click into a hexagon tile id of some sort, and you'd want functions
to calculate how to draw the tiles if the side is S pixels, or
if you want to fit N tiles across on a M wide field.

I don't want to implement a game, I do want to be able to divide a
pixel plane into hexagons, calculate which pixels would be interior,
which pixels would be a border, know which hexagons are complete
and which are clipped. I don't want something that is tied to a
particular drawing system, because it probably won't be the one I
want to use.

Functions of that nature must be fairly common, but I'm not seeing
any on CPAN.

I've looked at

Math::Polygon -- handles single polygons, not tilings

Math::PlanePath -- handles many things, but not hexagonal tilings

Games::Maze::SVG::HexCells -- specifically tied to SVG objects

Gtk2::Hexgrid -- specifically tied to Gtk2 images

As an example, here's this bit of ASCII art I must have spent
all of five minutes on. The hexagonal tiles are numbered with
example coordinates. There is a image area superimposed upon
this grid with a border of : + and =. The upper left hand corner
is about one quarter of the 0,0 hex grid. Cell 1,2 is the upper-
most, leftmost full hexagon, cell 1,1 is the leftmost, upper-
most full hexagon. 12 characters right and 16 down from the +
in the image corner is the * in cell 3,2. 18 characters right
and 5 down from the + is the L on the border of 0,3 and 1,3.

         ___         ___         ___         ___
        /   \       /   \       /   \       /   \
       /     \     /     \     /     \     /     \
      /  0,0  \___/  0,2  \___/  0,4  \___/  0,6  \_
      \   +===/===\=======/===\=======/===\=======/=
       \  :  /     \     /     \     /     \     /
        \_:_/  0,1  \___/  0,3  \___/  0,5  \___/
        / : \       /   \       /   \       /   \
       /  :  \     /     \     /     \     /     \
      /  1,0  \___/  1,2  \_L_/  1,4  \___/  1,6  \_
      \   :   /   \       /   \       /   \       / 
       \  :  /     \     /     \     /     \     /
        \_:_/  1,1  \___/  1,3  \___/  1,5  \___/
        / : \       /   \       /   \       /   \
       /  :  \     /     \     /     \     /     \
      /  2,0  \___/  2,2  \___/  2,4  \___/  2,6  \_
      \   :   /   \       /   \       /   \       / 
       \  :  /     \     /     \     /     \     /
        \_:_/  2,1  \___/  2,3  \___/  2,5  \___/
        / : \       /   \       /   \       /   \
       /  :  \     /  *  \     /     \     /     \
      /  3,0  \___/  3,2  \___/  3,4  \___/  2,6  \_
      \   :   /   \       /   \       /   \       / 
       \  :  /     \     /     \     /     \     /
        \_:_/  3,1  \___/  3,3  \___/  3,5  \___/
        / : \       /   \       /   \       /   \

I want the functions to be able to work that stuff out.
Does it exist currently?

Elijah
------
and for bonus points the hexgrid should be able to have a different rotation


------------------------------

Date: Fri, 6 Apr 2012 01:00:33 -0700 (PDT)
From: kinow <brunodepaulak@yahoo.com.br>
Subject: Re: New module name (Eclipse::PHPMe)
Message-Id: <29d358e5-6212-4963-ae45-3009f4eac7c5@n19g2000yqk.googlegroups.com>

On Apr 3, 2:27=A0am, Ivan Shmakov <oneing...@gmail.com> wrote:
> >>>>> kinow =A0<brunodepau...@yahoo.com.br> writes:
>
> =A0 =A0 =A0 =A0 [Cross-posting to news:comp.lang.perl.misc, for
> =A0 =A0 =A0 =A0 news:comp.lang.perl.modules has somewhat low activity the=
se
> =A0 =A0 =A0 =A0 days.]
>
> =A0> Hi all! =A0I wrote a Perl utility to turn an ordinary directory into=
 an
> =A0> Eclipse PHP project. I'm new to CPAN and Perl, so I have few
> =A0> questions:
>
> =A0> - Is CPAN the right place for it? =A0It's only a script (referenced =
in
> =A0> EXE_FILES in Makefile.PL). =A0I intend to use this script as I'm alw=
ays
> =A0> importing different PHP projects in Eclipse and it can be handy
>
> =A0> - I've looked for the Eclipse namespace in CPAN, searching for
> =A0> Eclipse with the filter set to 'Module', and found nothing. Is
> =A0> Eclipse::PHPMe a good name?
>
> =A0 =A0 =A0 =A0 There's the App:: namespace prefix for applications (and
> =A0 =A0 =A0 =A0 scripts):
>
> --cut:https://pause.perl.org/pause/query?ACTION=3Dpause_namingmodules--
> App
>
> =A0 =A0 You can distribute applications as Perl distributions. Typically,
> =A0 =A0 those sorts of distributions go under the App namespace, like
> =A0 =A0 App::Ack, App::Cpan, and App::Prove. =A0The namespace implies tha=
t its
> =A0 =A0 a ready-to-use program rather than a module.
> --cut:https://pause.perl.org/pause/query?ACTION=3Dpause_namingmodules--
>
> =A0 =A0 =A0 =A0 There seem to be a plenty of Perl applications distribute=
d this
> =A0 =A0 =A0 =A0 way. =A0Consider, e. g.:
>
> http://search.cpan.org/~petdance/ack-1.96/http://search.cpan.org/~rjbs/Ap=
p-Addex-0.023/
>
> [...]
>
> --
> FSF associate member #7257

Hi Ivan!

Thanks for the feedback.

App seems to be the right place for this application. However, I think
App::PHPMe would not be the right name for it. Maybe
App::Eclipse::PHPMe, or App::EclipsePHPMe? What do you think?

By the way, do I need to talk with someone else about using the App
namespace prefix?

Much appreciated!

Bruno


------------------------------

Date: Wed, 4 Apr 2012 23:39:43 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: pairs to tree
Message-Id: <jlim3v$nk3$1@reader1.panix.com>

In article <jlhrbs$p5o$2@reader1.panix.com>,
Tim McDaniel <tmcd@panix.com> wrote:
>In article <jlho10$49i$1@news.ntua.gr>,
>George Mpouras <nospam.gravitalsun@hotmail.com.nospam> wrote:
>>I am re-thinking an old graph problem . Any idea of how to build
>>e.g. the tree
>>
>>a
>> b
>>  e
>>  f
>> c
>> d
>>  t
>>t
>> a
>>f
>> a
>>
>>from the pairs ?
>>
>>f,a
>>t,a
>>d,t
>>b,e
>>b,f
>>a,c
>>a,d
>>a,b
>
>I'm curious: for what class is this a homework problem?
>
>Also, I don't see the specification.  The pairs are
>    parent,child
>and it even appears to be bottom-up.
>
>But sometimes it's shown as transitive, like how
>    b,e
>    a,b
>resulted in
>a
> b
>  e
>
>But
>    t,a
>    d,t
>does not result in
> d
>  t
>   a
>but instead
>t
> a
>is itself a side tree.


Reply:
> order is not important. pairs are unique. it is about building
> topology maps.

I'm usually fond of trimming unneeded text, but for someone on a
newsgroup, trimming ALL context and background is not so good.

I'm sorry, but you did not answer my questions.  Expanding a bit:

But sometimes it's shown as transitive, like how
    b,e
    a,b
results in
a
 b
  e

But
    t,a
    d,t
    a,d
does not result in
a
 d
  t
   a
but instead
a
 d
and
t
 a
in two separate trees.  Why?  How is the program supposed to know what
to do?

-- 
Tim McDaniel, tmcd@panix.com


------------------------------

Date: Thu, 5 Apr 2012 15:10:37 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: reason for local($_) ?
Message-Id: <slrnjnr6ed.kii.hjp-usenet2@hrunkner.hjp.at>

On 2012-04-04 14:30, Rainer Weikusat <rweikusat@mssgmbh.com> wrote:
> tmcd@panix.com (Tim McDaniel) writes:
>> In article <adc97$4f7b61e1$813f0835$1757@news.eurofeeds.com>,
>>  <jaialai.technology@gmail.com> wrote:
>>>At the end of the day Randal is correct, I believe. The author of the
>>>code in question was just blindly adding that line for more or less
>>>uninformed and superstitious reasons.
>>
>> I'll disagree, because what's also consistent with the evidence is
>> "better safe than sorry, prevent an accidental while(<$sth>) or other
>> place here stomping $_".
>
> If you don't know what the code at deeper levels in the call tree is
> going to do, how can you be sure that it won't intentionally try to
> change 'the global $_'?

You don't. The local($_) doesn't protect this function from its callees,
it protects the the callers from this function. It promises to the
caller that it won't modify $_.

	hp


-- 
   _  | Peter J. Holzer    | Deprecating human carelessness and
|_|_) | Sysadmin WSR       | ignorance has no successful track record.
| |   | hjp@hjp.at         | 
__/   | http://www.hjp.at/ |  -- Bill Code on asrg@irtf.org


------------------------------

Date: Thu, 5 Apr 2012 23:08:39 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: reason for local($_) ?
Message-Id: <eli$1204051903@qz.little-neck.ny.us>

In comp.lang.perl.misc, Eli the Bearded  <*@eli.users.panix.com> wrote:
> In comp.lang.perl.misc, Tim McDaniel <tmcd@panix.com> wrote:
> > And I don't know that "local $_" should be slow, given that every map,
> > grep, and foreach() has to do it. 
> My copy of _Programming Perl_ says "second edition" and "1996" on the
> copyright page, so I know it is not up-to-date, but the sentence spanning
> the page break of 108 to 109 says (with *stars* for bold):
> 
> 	By and large, you should prefer to use *my* over
> 	*local* because it is faster and safer.

I've decided to put this to the test. At least for $_, local: is
slightly faster than my() with my default perl. Benchmarks on mostly
idle system, long lines wrapped.

$ perl /tmp/bench
Benchmark: timing 1000000 iterations of does not use $_, local $_...
does not use $_: 218 wallclock secs
	(216.23 usr +  0.03 sys = 216.26 CPU) @ 4624.06/s (n=1000000)
  local $_: 211 wallclock secs
	(211.32 usr +  0.00 sys = 211.32 CPU) @ 4732.16/s (n=1000000)
$ perl /tmp/bench
Benchmark: timing 1000000 iterations of does not use $_, local $_...
does not use $_: 228 wallclock secs
	(229.09 usr +  0.02 sys = 229.11 CPU) @ 4364.72/s (n=1000000)
  local $_: 223 wallclock secs
	(224.25 usr +  0.00 sys = 224.25 CPU) @ 4459.31/s (n=1000000)
$ perl /tmp/bench
Benchmark: timing 1000000 iterations of does not use $_, local $_...
does not use $_: 209 wallclock secs
	(210.32 usr +  0.10 sys = 210.42 CPU) @ 4752.40/s (n=1000000)
  local $_: 207 wallclock secs
	(208.36 usr +  0.11 sys = 208.47 CPU) @ 4796.85/s (n=1000000)
$ cat /tmp/bench
use Benchmark;
use warnings;
use strict;

timethese(1_000_000, {
     'local $_' => sub { 
        local $_;
        for (1..101) {
          s/(\d)/00$1/;
          tr/0/#/;
        }
     },
     'does not use $_' => sub {
        my $u;
        for $u (1..101) {
          $u =~ s/(\d)/00$1/;
          $u =~ tr/0/#/;
        }
     },
});

$ perl -v

This is perl, v5.10.0 built for x86_64-linux-thread-multi
[...]

Elijah
------
better tests welcome


------------------------------

Date: Fri, 06 Apr 2012 09:58:10 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: reason for local($_) ?
Message-Id: <4f7ef672$13$fuzhry+tra$mr2ice@news.patriot.net>

In <jlhr1d$p5o$1@reader1.panix.com>, on 04/04/2012
   at 03:57 PM, tmcd@panix.com (Tim McDaniel) said:

>For example, in the IBM System/370 architecture, a subroutine 
>caller must set four registers,

No. You're confusing the architecture with an operating system
convention, and even OS/360 et al don't always follow that convention.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



------------------------------

Date: Sat, 7 Apr 2012 11:59:39 +0000 (UTC)
From: "Dave Saville" <dave@invalid.invalid>
Subject: Running multiple scripts
Message-Id: <fV45K0OBJxbE-pn2-kRCrH3k86Zdu@localhost>

I have a commercial program. The author has provided "hooks" at 
various points in the program. The "hook" code can be written in 
anything. Most of mine are perl but there is a problem in that I 
actually want to run more than one script per hook.

At present I have a master script per hook that runs the required 
scripts. But performance wise I am (re)loading the perl interpreter 
every script. All scripts take the same two parameters and it is not 
practical to combine them into one as they may be used by themselves 
or in more than one hook.

Is there some cunning way I can invoke a perl script from inside 
another without turning it into a function/package? Remember I need to
use them standalone too.

I was thinking, without any real knowledge, if I could do something 
like the following although I don't know how I would pass the 
parameters.

use strict;
use warnings;
my $parm1 = shift; 
my $parm2 = shift;
my $HANDLE;
open $HANDLE, "somecode.pl";
undef $/;
my $stuff = <$HANDLE>;
close $HANDLE;
eval $stuff;

All pointers gratefully received.
-- 
Regards
Dave Saville


------------------------------

Date: Thu, 5 Apr 2012 08:39:38 -0700 (PDT)
From: Keith <bytebrothers.uk@gmail.com>
Subject: Re: splitting to a hashref
Message-Id: <d1a2f71a-c600-4d2c-84e3-164d1019895f@m16g2000yqc.googlegroups.com>

On Apr 4, 5:43=A0pm, t...@panix.com (Tim McDaniel) wrote:

> $company{company_code} =3D {
> =A0 =A0 classes =3D> { map { $_, 'Y' } split /\//, $record->{class_codes}=
 }

My thanks to all who explained this so clearly.  I've got it now, and
as a pennance, I ahall learn all about the uses of the 'map' command!


------------------------------

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 3659
***************************************


home help back first fref pref prev next nref lref last post