[26265] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8448 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 23 14:05:16 2005

Date: Fri, 23 Sep 2005 11:05:04 -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, 23 Sep 2005     Volume: 10 Number: 8448

Today's topics:
    Re: [OT] run .pl from IE <sherm@dot-app.org>
        POSIX::WNOHANG redefined <Myron_Turner@shaw.ca>
    Re: POSIX::WNOHANG redefined <nobull@mail.com>
        regex, number of matches <rvtol+news@isolution.nl>
    Re: regex, number of matches <no@email.com>
    Re: Script for migrating HTML tree into a single direct <the_stan_brown@fastmail.fm>
    Re: Script for migrating HTML tree into a single direct <john@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Sep 2005 11:24:46 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: [OT] run .pl from IE
Message-Id: <m2slvvyfgh.fsf@Sherm-Pendleys-Computer.local>

"Dr.Ruud" <rvtol+news@isolution.nl> writes:

> Brian Wakem:
>>
>> Internet Explorer cannot execute CGI scripts.
>
> Well, I have seen it run sed code:
> http://lvogel.free.fr/jsed/index.html

Embedding code in <script> elements is not the same as CGI, and IE can run
Perl code the same way, if you have Active State's ActivePerl installed.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Fri, 23 Sep 2005 16:00:44 GMT
From: Myron Turner <Myron_Turner@shaw.ca>
Subject: POSIX::WNOHANG redefined
Message-Id: <qk98j19v6liqqo96ge4fu26l16cd9kc0ib@4ax.com>

I'm using a child handler which I've used elsewhere on various
systems, but currently I am getting this message:

POSIX::WNOHANG redefined

my handler is as follows:

sub childhandler {

 while((my $retv = waitpid( -1, &POSIX::WNOHANG() ))>0) {
         $wait_pid[$wait_index] = $retv;
         $wait_index++;
 }
  $SIG{CHLD} = \&childhandler;
}


I've tried this various ways:  

     waitpid( -1, &POSIX::WNOHANG)
     waitpid( -1, &WNOHANG)
    waitpid( -1,WNOHANG)

I've always used the latter without any trouble.

Thanks,

Myron Turner


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

Date: Fri, 23 Sep 2005 17:39:08 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: POSIX::WNOHANG redefined
Message-Id: <dh1b3d$kj9$1@redhat2.bham.ac.uk>

Myron Turner wrote:

> I'm using a child handler which I've used elsewhere on various
> systems, but currently...

So the versions of Perl on the various systems might be relevant.

> ... I am getting this message:
> 
> POSIX::WNOHANG redefined

Is that really the exact message?  Does it not mention the line at which 
the redefinition is happening? What does that line look like?

> my handler is as follows:

How do you know that this is the relevant bit of code to show us?

Please post a _minimal_ but _complete_ script that produces the warning.



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

Date: Fri, 23 Sep 2005 19:34:05 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: regex, number of matches
Message-Id: <dh1lte.ko.1@news.isolution.nl>

#!/usr/local/bin/perl -wC

use strict;

my @text;
$text[1] = "xxx xx xxx xxx";
$text[2] = "yyy yyyy yyy yyy yyy";

my ($chars, $words, $lines) = wc(@text);

print "Chars: $chars\n";
print "Words: $words\n";
print "Lines: $lines\n";

sub wc {
  my @ret;
  for (@_) {
    if (defined) {
      $ret[0] += length;        # chars
      $ret[1] += () = /\S+/g;   # words
      $ret[2] += 1;             # lines
    }
  }
  return @ret;
}


What I found hard to get, is the role of the '()' in the wc-words-line:

      $ret[1] += () = /\S+/g;   # words

After a while, I understood it as an anonymous array that is filled with
the matches, after which its length is used to increase the words-count.


The creating and filling of () seemed like a waste of cpu-cycles, so I
tried to find another way of counting the number of matches.

Destructive variant:

      $ret[1] += s/\S+//g;   # words

I settled for:

      $ret[1] += 1 while /\S+/g;   # words

Is there a better/nicer/smarter/directer way to return the number of
matches from a regex?

See also http://dev.perl.org/perl6/rfc/110.html

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Fri, 23 Sep 2005 19:00:12 +0100
From: Brian Wakem <no@email.com>
Subject: Re: regex, number of matches
Message-Id: <3piu5cFadok8U1@individual.net>

Dr.Ruud wrote:


>       $ret[1] += () = /\S+/g;   # words
> 
> 
> Destructive variant:
> 
>       $ret[1] += s/\S+//g;   # words
> 
> I settled for:
> 
>       $ret[1] += 1 while /\S+/g;   # words
> 
> Is there a better/nicer/smarter/directer way to return the number of
> matches from a regex?


This was covered a few week ago in a thread titled 'Space (\s) count
problem'.
 
The fastest way is to substitute a match with itself.

I fired off an email to perlfaq-suggestions@perl.com with this suggestion
but it bounced.



-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: Fri, 23 Sep 2005 13:13:35 -0400
From: Stan Brown <the_stan_brown@fastmail.fm>
Subject: Re: Script for migrating HTML tree into a single directory ?
Message-Id: <MPG.1d9e01cec926c3be989861@news.individual.net>

On Fri, 23 Sep 2005 10:41:50 +0200 in 
comp.infosystems.www.authoring.html, Pan Am favored us with...
> My Web hosting service does not support multiple directories...

Frankly, that statement stuns me. Or are you using some "hosting 
service" that will wrap your actual pages in a lot of ads and 
Javascript and similar crap?

> Can anyone suggest a Unix script that traverses a HTML tree and
> produces a working "single directory" version of the same?

It would be hard to do, unless you can guarantee up front that 
different directories don't contain files with the same names.

But really, Web hosting isn't expensive these days, and any 
"service" that limits you to a single directory is targeted at the 
lower end. Since you have enough pages that you want a script because 
hand editing is too cumbersome, you're really much better off with a 
better host.

-- 
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
                                  http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator:      http://validator.w3.org/
CSS 2.1 spec:   http://www.w3.org/TR/CSS21/
validator:      http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
    http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you


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

Date: 23 Sep 2005 17:39:06 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Script for migrating HTML tree into a single directory ?
Message-Id: <Xns96DA80993F209castleamber@130.133.1.4>

Stan Brown <the_stan_brown@fastmail.fm> wrote:

> But really, Web hosting isn't expensive these days, and any 
> "service" that limits you to a single directory is targeted at the 
> lower end. Since you have enough pages that you want a script because 
> hand editing is too cumbersome, you're really much better off with a 
> better host.

Yup, with your own domain name like 19.95 USD/year (!) 
(http://hostingforabuck.com/ )

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

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 V10 Issue 8448
***************************************


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