[29950] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1193 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 14 09:09:41 2008

Date: Mon, 14 Jan 2008 06:09:06 -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, 14 Jan 2008     Volume: 11 Number: 1193

Today's topics:
    Re: How to make COPY of Worksheet(1) to some other Work andygpeters@gmail.com
        Is script type="text/perl" OK? <lgt@invalid.com>
    Re: Is script type="text/perl" OK? <joost@zeekat.nl>
    Re: Is script type="text/perl" OK? <abigail@abigail.be>
    Re: Is script type="text/perl" OK? <lgt@invalid.com>
        new CPAN modules on Mon Jan 14 2008 (Randal Schwartz)
    Re: Perl - no longer open source and facing extinction <allergic-to-spam@no-spam-allowed.org>
    Re: Perl - no longer open source and facing extinction <bik.mido@tiscalinet.it>
    Re: s/A/B/ and s/B/C/ but don't want A -> C <bik.mido@tiscalinet.it>
    Re: s/A/B/ and s/B/C/ but don't want A -> C <abigail@abigail.be>
    Re: Wait for background processes to complete <pgodfrin@gmail.com>
    Re: Wait for background processes to complete <pgodfrin@gmail.com>
    Re: Wait for background processes to complete <ben@morrow.me.uk>
        Welcome to my webside that provides help in English Stu nonamehuang@yahoo.com.cn
    Re: Welcome to my webside that provides help in English <someone@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 14 Jan 2008 02:26:23 -0800 (PST)
From: andygpeters@gmail.com
Subject: Re: How to make COPY of Worksheet(1) to some other Worksheet ???
Message-Id: <dd4a159a-7147-44f5-a514-b8cce54ff669@e23g2000prf.googlegroups.com>

On Jan 12, 9:09=A0pm, "Katja" <ka...@makniovotht.hr> wrote:
> How to make COPY of Worksheet(1)to some other Worksheet ???
>
> Please Help!
>
> ------------------
> use strict;
> use Win32::OLE qw(in with);
> use Win32::OLE::Const 'Microsoft Excel';
> $Win32::OLE::Warn =3D 3; # die on errors...
> # get already active Excel application or open new
> my $Excel =3D Win32::OLE->GetActiveObject('Excel.Application')
> || Win32::OLE->new('Excel.Application', 'Quit');
> my $Book =3D $Excel->Workbooks->Open('d:\cgi\work.xls');
> my $Sheet =3D $Book->Worksheets(1);
>
> # How to make COPY of Worksheet(1) to some other Worksheet ???
> #
>
> $Book->Save;
> ------------------

I normally record a macro and use what's been generated.
In your case this gives

    Sheets("Sheet1").Select
    Sheets("Sheet1").Copy Before:=3DSheets(2)

Which translates to something like

$Sheet->Select;
$Sheet->Copy( 'Before' =3D> $Book->Worksheets(2));

Hope this helps.


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

Date: Mon, 14 Jan 2008 13:50:56 +0200
From: lg <lgt@invalid.com>
Subject: Is script type="text/perl" OK?
Message-Id: <rtimo3l32bsh1p5g6k9uuj25ul1oohj9d1@4ax.com>

I've asked this on a html forum but I'll ask it here also.

I have a counter file on my index page which is like below.
Snippet from index.html:
<script type="text/perl" SRC="http://www.blahblah.com/counter.pl"> </script>

The script is is a perl file which is processed by the server. Is it legal? Will
my counter work (be run as usual)?

Below runs OK too, but I get a "done, but with errors on the page" 
<script type="text/javascript" SRC="http://www.blahblah.com/counter.pl">
</script>

What I am trying to do is get rid of the error message and have the counter.pl
execute. Since the server (not the client browser) is doing the running of the
counter.pl I want to know if "<script type="text/perl" SRC="http://.." is
otherwise valid. I could just put the line there and see if I get hits, but I
don't want to find out six months later that it while it does work on many
browsers it does not work on not-so-common-browser and the browser simply quits
interpreting the html on the file and issues a 404 or similar message.


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

Date: Mon, 14 Jan 2008 13:22:19 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Is script type="text/perl" OK?
Message-Id: <871w8ksikk.fsf@zeekat.nl>

lg <lgt@invalid.com> writes:

> I've asked this on a html forum but I'll ask it here also.
>
> I have a counter file on my index page which is like below.
> Snippet from index.html:
> <script type="text/perl" SRC="http://www.blahblah.com/counter.pl"> </script>
>
> The script is is a perl file which is processed by the server. Is it
> legal? 

Yes. But then your script is expected to return perl code to the
browser.  But unless your script actually returns valid perl and your 
browser has a perl scripting plugin (like the ActivePerl PerlScript plugin) 
this is probably not what you want.

Note: the <script> tag indicates that whatever is sent *to the browser*
is to be run as a script. There is way and no need to indicate that
something is *generated by a script* on the server side.

> Will my counter work (be run as usual)?

Maybe, probably not. I would expect browsers to just ignore (i.e. not
fetch the URL for) script tags with types they can't understand, but I 
haven't tested this. If that's true, the only type that's anywhere near
universally supported is javascript. Personally, I'd use an <img> tag
instead.

> Below runs OK too, but I get a "done, but with errors on the page" 
> <script type="text/javascript" SRC="http://www.blahblah.com/counter.pl">
> </script>

That's probably because your script does not return valid javascript.

> What I am trying to do is get rid of the error message and have the counter.pl
> execute. Since the server (not the client browser) is doing the running of the
> counter.pl I want to know if "<script type="text/perl" SRC="http://.." is
> otherwise valid. I could just put the line there and see if I get hits, but I
> don't want to find out six months later that it while it does work on many
> browsers it does not work on not-so-common-browser and the browser simply quits
> interpreting the html on the file and issues a 404 or similar message.

Some people, like me, have browser scripting disabled, so it won't work
any way. Most counter scripts I've seen are called using an <img>
tag. Whatever you use, just make sure you send back the right kind of
response; an image for an <img> tag, a (javascript) script for a
<script> tag etc. Or maybe a 204 NO RESPONSE result will work.

Joost.


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

Date: 14 Jan 2008 13:11:03 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Is script type="text/perl" OK?
Message-Id: <slrnfomnr7.df.abigail@alexandra.abigail.be>

                              _
lg (lgt@invalid.com) wrote on VCCXLIX September MCMXCIII in
<URL:news:rtimo3l32bsh1p5g6k9uuj25ul1oohj9d1@4ax.com>:
:}  I've asked this on a html forum but I'll ask it here also.
:}  
:}  I have a counter file on my index page which is like below.
:}  Snippet from index.html:
:} <script type="text/perl" SRC="http://www.blahblah.com/counter.pl"> </script>
:}  
:}  The script is is a perl file which is processed by the server. Is it legal? Will

Legal in which sense? 

:}  my counter work (be run as usual)?

Well, as long as your browser is able to execute the script, sure. 
But that's the same with javascript. Whether or not it will "as usual"
will depend on the browser.

:}  Below runs OK too, but I get a "done, but with errors on the page" 
:} <script type="text/javascript" SRC="http://www.blahblah.com/counter.pl">
:} </script>

What does 'counter.pl' contain? If it contains Perl, I'm quite surprised 
it runs ok - as I would expect the browser to execute it like it contained
Javascript.

If counter.pl contains javascript, this forum is not the right place to ask.

:}  
:}  What I am trying to do is get rid of the error message and have the counter.pl
:}  execute. Since the server (not the client browser) is doing the running of the
:}  counter.pl I want to know if "<script type="text/perl" SRC="http://.." is
:}  otherwise valid. I could just put the line there and see if I get hits, but I
:}  don't want to find out six months later that it while it does work on many
:}  browsers it does not work on not-so-common-browser and the browser simply quits
:}  interpreting the html on the file and issues a 404 or similar message.


Eh, the server is interpreting the <script> part? Well, I guess that's 
possible (after all, the server can do what it damn well pleases), but
quite odd. Perhaps you should ask in a group related about servers then.



Abigail
-- 
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/                xor      !@ _?
       exit print                                                  :
            print and push @_ => shift and goto &{(caller (0)) [3]}}
            split // => "KsvQtbuf fbsodpmu\ni flsI "  xor       & _


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

Date: Mon, 14 Jan 2008 16:06:27 +0200
From: lg <lgt@invalid.com>
Subject: Re: Is script type="text/perl" OK?
Message-Id: <jqpmo3p09r2hhar0tf0i968unf2bju7gji@4ax.com>

Joost Diepenmaat <joost@zeekat.nl> wrote:

>lg <lgt@invalid.com> writes:
>
>> I've asked this on a html forum but I'll ask it here also.
>>
>> I have a counter file on my index page which is like below.
>> Snippet from index.html:
>> <script type="text/perl" SRC="http://www.blahblah.com/counter.pl"> </script>
>>
>> The script is is a perl file which is processed by the server. Is it
>> legal? 
>
>Yes. But then your script is expected to return perl code to the
>browser.  But unless your script actually returns valid perl and your 
>browser has a perl scripting plugin (like the ActivePerl PerlScript plugin) 
>this is probably not what you want.
>
>Note: the <script> tag indicates that whatever is sent *to the browser*
>is to be run as a script. There is way and no need to indicate that
>something is *generated by a script* on the server side.
>
>> Will my counter work (be run as usual)?
>
>Maybe, probably not. I would expect browsers to just ignore (i.e. not
>fetch the URL for) script tags with types they can't understand, but I 
>haven't tested this. If that's true, the only type that's anywhere near
>universally supported is javascript. Personally, I'd use an <img> tag
>instead.
>
>> Below runs OK too, but I get a "done, but with errors on the page" 
>> <script type="text/javascript" SRC="http://www.blahblah.com/counter.pl">
>> </script>
>
>That's probably because your script does not return valid javascript.
>
>> What I am trying to do is get rid of the error message and have the counter.pl
>> execute. Since the server (not the client browser) is doing the running of the
>> counter.pl I want to know if "<script type="text/perl" SRC="http://.." is
>> otherwise valid. I could just put the line there and see if I get hits, but I
>> don't want to find out six months later that it while it does work on many
>> browsers it does not work on not-so-common-browser and the browser simply quits
>> interpreting the html on the file and issues a 404 or similar message.
>
>Some people, like me, have browser scripting disabled, so it won't work
>any way. Most counter scripts I've seen are called using an <img>
>tag. Whatever you use, just make sure you send back the right kind of
>response; an image for an <img> tag, a (javascript) script for a
><script> tag etc. Or maybe a 204 NO RESPONSE result will work.

How would I do it with <IMG> tag


>
>Joost.


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

Date: Mon, 14 Jan 2008 05:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jan 14 2008
Message-Id: <JuMD6G.L4I@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Apache-AuthTkt-0.07
http://search.cpan.org/~gavinc/Apache-AuthTkt-0.07/
module to generate authentication tickets for mod_auth_tkt apache module. 
----
Apache-forks-0.03
http://search.cpan.org/~rybskej/Apache-forks-0.03/
Transparent Apache ithreads integration using forks 
----
Atompub-0.2.4
http://search.cpan.org/~takeru/Atompub-0.2.4/
Atom Publishing Protocol implementation 
----
BDB-1.43
http://search.cpan.org/~mlehmann/BDB-1.43/
Asynchronous Berkeley DB access 
----
Backtick-AutoChomp-0.01
http://search.cpan.org/~davidrw/Backtick-AutoChomp-0.01/
auto-chomp() result of backtick(``) and qx// 
----
Backtick-AutoChomp-0.02
http://search.cpan.org/~davidrw/Backtick-AutoChomp-0.02/
auto-chomp() result of backtick(``) and qx// 
----
CPAN-Testers-Report-0.04
http://search.cpan.org/~fhoxh/CPAN-Testers-Report-0.04/
Creates CPAN Testers test-report objects 
----
Cache-Memcached-LibMemcached-0.00003
http://search.cpan.org/~dmaki/Cache-Memcached-LibMemcached-0.00003/
Perl Interface to libmemcached 
----
Cache-Memcached-LibMemcached-0.00004
http://search.cpan.org/~dmaki/Cache-Memcached-LibMemcached-0.00004/
Perl Interface to libmemcached 
----
Catalyst-Controller-SOAP-0.1.2
http://search.cpan.org/~druoso/Catalyst-Controller-SOAP-0.1.2/
Catalyst SOAP Controller 
----
Catalyst-Model-Estraier-0.0.4
http://search.cpan.org/~takeru/Catalyst-Model-Estraier-0.0.4/
Hyper Estraier model class for Catalyst 
----
Catalyst-Model-SOAP-0.0.3
http://search.cpan.org/~druoso/Catalyst-Model-SOAP-0.0.3/
Map a WSDL to a catalyst model class. 
----
Catalyst-Plugin-ConfigLoader-Environment-0.02
http://search.cpan.org/~jrockway/Catalyst-Plugin-ConfigLoader-Environment-0.02/
Configure your application with environment variables. 
----
Catalyst-Plugin-ConfigLoader-Environment-0.03
http://search.cpan.org/~jrockway/Catalyst-Plugin-ConfigLoader-Environment-0.03/
Configure your application with environment variables. 
----
Class-DBI-SQL-Transformer-Quotify-0.01
http://search.cpan.org/~davidrw/Class-DBI-SQL-Transformer-Quotify-0.01/
Quote column and table names in Class::DBI-generated SQL 
----
Class-DBI-SQL-Transformer-Quotify-0.02
http://search.cpan.org/~davidrw/Class-DBI-SQL-Transformer-Quotify-0.02/
Quote column and table names in Class::DBI-generated SQL 
----
Coro-4.36
http://search.cpan.org/~mlehmann/Coro-4.36/
coroutine process abstraction 
----
DBIx-Dictionary-0.01
http://search.cpan.org/~izut/DBIx-Dictionary-0.01/
Support for query dictionaries in DBI 
----
Data-Visitor-0.14
http://search.cpan.org/~nuffin/Data-Visitor-0.14/
Visitor style traversal of Perl data structures 
----
Dir-Split-0.79
http://search.cpan.org/~schubiger/Dir-Split-0.79/
Split files of a directory to subdirectories 
----
FindBin-libs-1.36
http://search.cpan.org/~lembark/FindBin-libs-1.36/
Locate and 'use lib' directories along the path of $FindBin::Bin to automate locating modules. Uses File::Spec and Cwd's abs_path to accomodate multiple O/S and redundant symlinks. 
----
Fukurama-Class-0.023
http://search.cpan.org/~tobiwan/Fukurama-Class-0.023/
Pragma to extend the Perl-OO (in native Perl) 
----
Games-BonDigi-0.02
http://search.cpan.org/~cosimo/Games-BonDigi-0.02/
----
Geo-Coordinates-DecimalDegrees-0.08
http://search.cpan.org/~waltman/Geo-Coordinates-DecimalDegrees-0.08/
convert between degrees/minutes/seconds and decimal degrees 
----
Heap-Simple-0.12
http://search.cpan.org/~thospel/Heap-Simple-0.12/
Fast and easy to use classic heaps 
----
Heap-Simple-XS-0.10
http://search.cpan.org/~thospel/Heap-Simple-XS-0.10/
An XS implementation of the Heap::Simple interface 
----
LEOCHARRE-Class-1.04
http://search.cpan.org/~leocharre/LEOCHARRE-Class-1.04/
----
LEOCHARRE-Database-1.13
http://search.cpan.org/~leocharre/LEOCHARRE-Database-1.13/
common database methods for oo 
----
Language-MuldisD-0.17.0
http://search.cpan.org/~duncand/Language-MuldisD-0.17.0/
Formal spec of Muldis D relational DBMS lang 
----
Lingua-JA-Romanize-Japanese-0.20
http://search.cpan.org/~kawasaki/Lingua-JA-Romanize-Japanese-0.20/
Romanization of Japanese language 
----
Lingua-KO-Romanize-Hangul-0.20
http://search.cpan.org/~kawasaki/Lingua-KO-Romanize-Hangul-0.20/
Romanization of Korean language 
----
Lingua-ZH-Romanize-Pinyin-0.20
http://search.cpan.org/~kawasaki/Lingua-ZH-Romanize-Pinyin-0.20/
Romanization of Standard Chinese language 
----
Log-Handler-0.38_01
http://search.cpan.org/~bloonix/Log-Handler-0.38_01/
A simple handler to log messages to one or more log files. 
----
Log-Handler-0.38_02
http://search.cpan.org/~bloonix/Log-Handler-0.38_02/
A simple handler to log messages to log files. 
----
Metadata-DB-File-1.04
http://search.cpan.org/~leocharre/Metadata-DB-File-1.04/
metadata object about a file 
----
Net-Amazon-0.48
http://search.cpan.org/~boumenot/Net-Amazon-0.48/
Framework for accessing amazon.com via REST 
----
Net-Jabber-Bot-2.0.4
http://search.cpan.org/~toddr/Net-Jabber-Bot-2.0.4/
Automated Bot creation with safeties 
----
Net-MRIM-1.03
http://search.cpan.org/~aau/Net-MRIM-1.03/
Perl implementation of mail.ru agent protocol 
----
P2P-Transmission-0.04
http://search.cpan.org/~bgilmore/P2P-Transmission-0.04/
Interface to the Transmission BitTorrent client 
----
POE-Component-IRC-5.50
http://search.cpan.org/~bingos/POE-Component-IRC-5.50/
a fully event-driven IRC client module. 
----
POE-Component-WWW-Google-Calculator-0.01
http://search.cpan.org/~zoffix/POE-Component-WWW-Google-Calculator-0.01/
A non-blocking POE wrapper around WWW::Google::Calculator 
----
POE-Component-WWW-Google-PageRank-0.01
http://search.cpan.org/~zoffix/POE-Component-WWW-Google-PageRank-0.01/
A non-blocking wrapper for WWW::Google::PageRank 
----
POE-Component-WWW-Search-Mininova-0.02
http://search.cpan.org/~zoffix/POE-Component-WWW-Search-Mininova-0.02/
non-blocking POE wrapper for WWW::Search::Mininova 
----
POE-Component-WWW-Shorten-1.10
http://search.cpan.org/~bingos/POE-Component-WWW-Shorten-1.10/
A non-blocking wrapper around WWW::Shorten. 
----
POEIKCdaemon-0.00_00
http://search.cpan.org/~suzuki/POEIKCdaemon-0.00_00/
POE IKC daemon 
----
Parse-Eyapp-1.101
http://search.cpan.org/~casiano/Parse-Eyapp-1.101/
Extensions for Parse::Yapp 
----
Perl-Critic-StricterSubs-0.03
http://search.cpan.org/~thaljef/Perl-Critic-StricterSubs-0.03/
Perl::Critic plugin for stricter subroutine checks 
----
SOAP-WSDL-1.27
http://search.cpan.org/~mkutter/SOAP-WSDL-1.27/
SOAP with WSDL support 
----
Socket-GetAddrInfo-0.06
http://search.cpan.org/~pevans/Socket-GetAddrInfo-0.06/
a wrapper for Socket6's getaddrinfo and getnameinfo, or emulation for platforms that do not support it 
----
Test-Harness-3.07
http://search.cpan.org/~andya/Test-Harness-3.07/
Run Perl standard test scripts with statistics 
----
Test-Most-0.01
http://search.cpan.org/~ovid/Test-Most-0.01/
Most commonly needed test functions and features. 
----
Tie-ToObject-0.02
http://search.cpan.org/~nuffin/Tie-ToObject-0.02/
Tie to an existing object. 
----
Tk-Wizard-2.129
http://search.cpan.org/~lgoddard/Tk-Wizard-2.129/
GUI for step-by-step interactive logical process 
----
WWW-Bebo-API-0.0.02
http://search.cpan.org/~clscott/WWW-Bebo-API-0.0.02/
Bebo API implementation 
----
WWW-Search-Mininova-0.04
http://search.cpan.org/~zoffix/WWW-Search-Mininova-0.04/
Interface to www.mininova.org Torrent site 
----
YAML-Tiny-1.25
http://search.cpan.org/~adamk/YAML-Tiny-1.25/
Read/Write YAML files with as little code as possible 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 14 Jan 2008 09:22:43 +0100 (CET)
From: Jim Cochrane <allergic-to-spam@no-spam-allowed.org>
Subject: Re: Perl - no longer open source and facing extinction
Message-Id: <slrnfom6un.uiq.allergic-to-spam@no-spam-allowed.org>

On 2008-01-02, Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "JB" == John Bokma <john@castleamber.com> writes:
>
>    JB> Purl Gurl <purlgurl@purlgurl.net> wrote:
>
>     >> this is the final coffin nail for Perl. This language is
>     >> already dead.
>
>    JB> So what are you doing here?
>
> Trolling, and she's got her hook firmly implanted in you.  Plonk her
> and spare us the noise, please.
>

How do you know this person is female?  Seems like an assumption to me.


-- 



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

Date: Mon, 14 Jan 2008 14:48:33 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl - no longer open source and facing extinction
Message-Id: <u0qmo3phm3glnp0qpphq0plmsl1eb3e39d@4ax.com>

On Mon, 14 Jan 2008 09:22:43 +0100 (CET), Jim Cochrane
<allergic-to-spam@no-spam-allowed.org> wrote:

>> Trolling, and she's got her hook firmly implanted in you.  Plonk her
>> and spare us the noise, please.
>>
>
>How do you know this person is female?  Seems like an assumption to me.

That's what it constantly claims.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 14 Jan 2008 14:44:18 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: s/A/B/ and s/B/C/ but don't want A -> C
Message-Id: <c5mmo3d52vqkbfa2q382df8d7csloacpk8@4ax.com>

On 02 Jan 2008 17:06:56 GMT, Abigail <abigail@abigail.be> wrote:

>[]  The only work needed is to populate %reps, but that is more typing with
>[]  any approach :)
>
>
>Yeah, but now you're back to only being able to replace 'fixed strings',
>while I posted by approach to be able to deal with patterns.
>
>[]  With yours it's harder to build the match pattern, I think, that's why I
>[]  asked you if I'm misunderstanding it.
>
>
>Sure, it's harder than the "simple approach". But it's more powerful.

I'm trying to follow this discussion and I'm not acquainted yet with
the new constructs. Anyway the question is: how easy is it to
construct a sub that given a list of patterns (and substitutions)
would assemble a pattern satisfying the "condition of the Subject"?


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 14 Jan 2008 13:59:04 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: s/A/B/ and s/B/C/ but don't want A -> C
Message-Id: <slrnfomql8.df.abigail@alexandra.abigail.be>

                                                _
Michele Dondi (bik.mido@tiscalinet.it) wrote on VCCXLIX September
MCMXCIII in <URL:news:c5mmo3d52vqkbfa2q382df8d7csloacpk8@4ax.com>:
//  On 02 Jan 2008 17:06:56 GMT, Abigail <abigail@abigail.be> wrote:
//  
// >[]  The only work needed is to populate %reps, but that is more typing with
// >[]  any approach :)
// >
// >
// >Yeah, but now you're back to only being able to replace 'fixed strings',
// >while I posted by approach to be able to deal with patterns.
// >
// >[]  With yours it's harder to build the match pattern, I think, that's why I
// >[]  asked you if I'm misunderstanding it.
// >
// >
// >Sure, it's harder than the "simple approach". But it's more powerful.
//  
//  I'm trying to follow this discussion and I'm not acquainted yet with
//  the new constructs. Anyway the question is: how easy is it to
//  construct a sub that given a list of patterns (and substitutions)
//  would assemble a pattern satisfying the "condition of the Subject"?


How easy? "Quite".


Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Sun, 13 Jan 2008 21:10:00 -0800 (PST)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: Wait for background processes to complete
Message-Id: <c651d0df-f2ea-46d9-8c6b-a0d824ab788b@j78g2000hsd.googlegroups.com>

On Jan 13, 9:51 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth pgodfrin <pgodf...@gmail.com>:
>
>
>
> > Here's what I want to do - run several commands in the background and
> > have the perl program wait for the commands to complete. Fork doesn't
> > do it, nor does wait nor waitpid.
>
> > Any thoughts?
>
> > Here's a sample program which starts the processes:
>
> >    while (<*.txt>)
> >    {
> >         print "Copying  $_ \n";
> >         system("cp $_ $_.old &") ;
>
> This string contains a shell metachar (&), so system will fork a shell
> and wait for it. The shell will run cp in the background, and then exit,
> at which point system will return. Unfortunately, the only process which
> knew cp's pid was the shell, which has just exitted, so you can't wait
> for that process at all (cp now has init as its parent, like any other
> orphaned process).
>
> You need to either implement the behaviour you want with fork, exec and
> waitpid (it's a little complicated, but entirely possible) or use
> IPC::Run, something like
>
>     use IPC::Run qw/run/;
>
>     my @cmds;
>
>     while (<*.txt>) {
>         print "Copying $_\n";
>         push @cmds, [cp => $_, "$_.old"];
>     }
>
>     run map { ($_, '&') } @cmds;
>
> This is also safer than system STRING in the case where your filenames
> have funny characters in them.
>
> >    }
> >    print "End of excercise\n";
> >    exit;
>
> Falling off the end is a perfectly valid way to end a Perl program. exit
> is usually reserved for exceptional circumstances.
>
> > I mean if this were a shell program - this would work:
>
> >    for x in `ls *.txt`
> >    do
> >       print "Copying  $_ \n"
> >       cp $_ $_.old &
> >    done
> >    wait
>
> This works because the shell implements '&' directly, rather than using
> a different shell, so it can remember the pids to wait for itself.
>
> Ben

OK - would you have a good example of the fork-system-waitpid method -
not the same one that's in all the other posts or the camel book?

smiles,
pg


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

Date: Sun, 13 Jan 2008 21:10:12 -0800 (PST)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: Wait for background processes to complete
Message-Id: <bf48c5e0-5811-40d7-bb2e-4850101a9e41@1g2000hsl.googlegroups.com>

On Jan 13, 9:43 pm, xhos...@gmail.com wrote:
> pgodfrin <pgodf...@gmail.com> wrote:
> > Greetings,
> > Well - I've spent a bunch of time trying to figure this out - to no
> > avail.
>
> > Here's what I want to do - run several commands in the background and
> > have the perl program wait for the commands to complete. Fork doesn't
> > do it, nor does wait nor waitpid.
>
> None of them individually do it, no.  You have to use them together.
>
>
>
> > Any thoughts?
>
> > Here's a sample program which starts the processes:
>
> >    while (<*.txt>)
> >    {
> >         print "Copying  $_ \n";
> >         system("cp $_ $_.old &") ;
>
> This starts a shell, which then starts cp in the background.  As soon as
> the cp is *started*, the shell exits.  So Perl has nothing to wait for, as
> the shell is already done (and waited for) before system returns.  You need
> to use fork and system or fork and exec. Or you could use
> Parallel::ForkManager, which will wrap this stuff up nicely for you and
> also prevent you from fork-bombing your computer if there are thousands of
> *.txt
>
> >    }
> >    print "End of excercise\n";
> >    exit;
>
> 1 until -1==wait();  # on my system, yours may differ
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> this fact.

Well - that's beginning to make a little sense - the shell completes
and perl has nothing to wait for. No wonder I'm pulling out what
little of my hair is left! :) I guess the fork process returns the pid
of the process, but - if it's the pid of the shell process, then we're
back to square one.



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

Date: Mon, 14 Jan 2008 06:09:42 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Wait for background processes to complete
Message-Id: <6uar55-j6i1.ln1@osiris.mauzo.dyndns.org>

[please trim your quotations]

Quoth pgodfrin <pgodfrin@gmail.com>:
> On Jan 13, 9:51 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth pgodfrin <pgodf...@gmail.com>:
> >
> > > Here's what I want to do - run several commands in the background and
> > > have the perl program wait for the commands to complete. Fork doesn't
> > > do it, nor does wait nor waitpid.
> >
<snip>
> >
> > You need to either implement the behaviour you want with fork, exec and
> > waitpid (it's a little complicated, but entirely possible) or use
> > IPC::Run, something like
> 
> OK - would you have a good example of the fork-system-waitpid method -
> not the same one that's in all the other posts or the camel book?

It's a more efficient use of everybody's time for you to use IPC::Run,
which has been written and tested by someone who understands these
issues and is prepared to solve them properly and portably, than it is
for a random Usenaut to provide you with a code snippet.

However, off the top of my head, completely untested, probably not
portable to Win32 or other non-POSIX systems, etc. etc.,

    use POSIX qw/WNOHANG/;

    {
        my %kids;

        $SIG{CHLD} = sub {
            my ($pid, @died);
            push @died, $pid while $pid = waitpid -1, WNOHANG;
            delete @kids{@died};
        };

        sub background {
            my (@cmd) = @_;

            defined (my $pid = fork)
                or die "can't fork for '$cmd[0]': $!";

            if ($pid) {
                $kids{$pid} = 1;
                return;
            }
            else {
                local $" = "' '";
                exec @cmd or die "can't exec '@cmd': $!";
            }
        }

        sub finish {
            waitpid $_, 0 for keys %kids;
            %kids = ();
        }
    }

    while (<*.txt>) {
        print "Copying $_\n";
        background cp => $_, "$_.old";
    }

    finish;

This will break if used in conjunction with system or anything else that
relies on SIGCHLD, and an OO person would probably say it should be
implemented as an object. Use IPC::Run.

Ben



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

Date: Mon, 14 Jan 2008 05:46:10 -0800 (PST)
From: nonamehuang@yahoo.com.cn
Subject: Welcome to my webside that provides help in English Study for  Chinese..
Message-Id: <fbf7e632-a1dc-4a53-a89a-bc8f2985427f@i3g2000hsf.googlegroups.com>

The address is http://englearn.zhan.cn.yahoo.com
And I need your advice. Well, maybe your help. You see. aha!


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

Date: Mon, 14 Jan 2008 13:59:23 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Welcome to my webside that provides help in English Study for Chinese..
Message-Id: <%UJij.4706$yQ1.3933@edtnps89>

nonamehuang@yahoo.com.cn wrote:
> The address is http://xxxxxxxxxxxxxxxxxxxxxxx
> And I need your advice.

Don't post spam on Usenet.

> Well, maybe your help.

Maybe your local law enforcement agency could help you better.

> You see.

No, I'm sorry, I don't see.

> aha!

Oh oh.  :(


John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

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 1193
***************************************


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