[23746] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5950 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 18 03:05:42 2003

Date: Thu, 18 Dec 2003 00:05:07 -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           Thu, 18 Dec 2003     Volume: 10 Number: 5950

Today's topics:
    Re: Asynchronous Objects (Bryan Castillo)
        Can you undo a read from a file (Tim Greenwood)
    Re: Can you undo a read from a file (David Efflandt)
    Re: Can you undo a read from a file <matthew.garrish@sympatico.ca>
        Error with cgi script writing to STDERR <fiedorow@hotmail.com>
    Re: How to determine end-of-line sequence? (David Efflandt)
    Re: html-->text, keep line breaks, best strategy is? Ad <henryn@zzzspacebbs.com>
    Re: Ordering arrays? <krahnj@acm.org>
    Re: Please critique this short script that scans a log  (Jay Tilton)
    Re: Please critique this short script that scans a log  (Jay Tilton)
    Re: Please critique this short script that scans a log  <uri@stemsystems.com>
    Re: Please critique this short script that scans a log  (Tad McClellan)
    Re: reading from an url (Rajesh)
    Re: reading from an url <carsten@welcomes-you.com>
    Re: Redirect url user@domain.invalid
    Re: Return all points with x km of y <invalid-email@rochester.rr.com>
    Re: select()ing a lexical FH <tassilo.parseval@rwth-aachen.de>
    Re: ticks and FreeBSD <jundy@jundy.com>
    Re: Where do -T warnings go? <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 17 Dec 2003 16:45:01 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Asynchronous Objects
Message-Id: <1bff1830.0312171645.74186be4@posting.google.com>

Uri Guttman <uri@stemsystems.com> wrote in message news:<x7vfohriwp.fsf@mail.sysarch.com>...
> >>>>> "BC" == Bryan Castillo <rook_5150@yahoo.com> writes:
>  
>   > I've been looking through CPAN and the newsgroups for information on
>   > calling on objects asynchronously from perl.  Basically, I was
>   > thinking about a Tk application I was working on that used DBI and
>   > had some SQL statements that may take 10 to 30 seconds.  I really
>   > didn't want the screen to freeze for that long.
>  
>   > So I've been searching for methods of asynchronous operations on
>   > objects.  There are of course threads, however I seems that it is
>   > not reccomended to use multiple database connections with threads,
>   > or to even have more than 1 thread use the DBI module, even when
>   > protected through synchronization.
> 
> check out stem in my author dir URI or from stemsystems.com. the soon to
> be released .11 version is even better. it has exactly what you are
> looking for in a services module called Stem::Cell::Flow (in .11). it
> supports flow control with sync AND async operations on an object. in
> fact the async operation could be in the same process and be sync for
> development and later migrated to other stem processes for production
> and no code will need to be changed.
> 
> 
>   > What I've come up with is the start of a module that uses IPC::Open2
>   > to start a new perl interpreter.  The process is givin a package name
>   > containing methods it should delegate out to.  The process reads in
>   > complex hashes that have been serialized with the Storable module, one
>   > element in the hash contains the name of the method to call in the
>   > delegate package.  The method is called and the results are also
>   > returned serialized with the storable module.
> 
> this is effectively what stem does but it is much more flexible and
> powerful as this is only one feature of the system.
> 
>   > Ive then been building a client library build around select(4-arg
>   > form) to try to send and received the data (method call and argumentS)
>   > non-blocking.
> 
> again, stem is already based on event loops (and .11 will support both
> Event.pm and a pure perl event loop that runs on winblows).
> 
> but stem goes beyond just event processing with its message passing
> design. you can use message passing to emulate almost any other IPC
> paradigm and with little effort. RPC, publish/subscribe, peer to peer,
> client/server are all easily done under stem.
> 
> let me know if you have any questions or need help with this project. i
> can get you a prerelease version of .11 with the stem flow support.
> 
> uri

Thanks, 

I downloaded .10, I think I would like to look at .11.  I've been
looking to write something that works both on windows and unix.  Will
 .11 be available soon?  You don't have to send it to me directly, my
application is just for fun and the love of perl.


(I'm generally trying to figure out how to perform
multithreaded/multiprocess operations in perl.  This is something I've
done before using fork/exec/etc.... and I've used the threads in 5.8,
it just seems like it is alot harder than it should be.  What i've
read, discourages use of DBI with threads, which keeps you from
performing multiple queries/operations at once.  Someone else,
suggested looking at POE, which I will.  Although I doubt it returns
control to your perl script while a query is still executing.  In the
end I was hoping to come up with a module that allows various types of
asynchronous operations on objects, where the execution context,
carrying out the operations, is completly managed by the initial
execution context.)


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

Date: 17 Dec 2003 15:24:10 -0800
From: timothy@greenwood.name (Tim Greenwood)
Subject: Can you undo a read from a file
Message-Id: <412175bb.0312171524.18422667@posting.google.com>

Is it possible (and preferably simple) to undo a line input from STDIN
or any file handle? I want to do something like


$line = <STDIN>;
if ($line =~ $my_pattern) {
   # process it all
} else {
  # push the line back to be read by some other part of the program
}


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

Date: Thu, 18 Dec 2003 00:01:08 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Can you undo a read from a file
Message-Id: <slrnbu1ri3.p29.efflandt@typhoon.xnet.com>

On 17 Dec 2003 15:24:10 -0800, Tim Greenwood <timothy@greenwood.name> wrote:
> Is it possible (and preferably simple) to undo a line input from STDIN
> or any file handle? I want to do something like
> 
> 
> $line = <STDIN>;
> if ($line =~ $my_pattern) {
>    # process it all
> } else {
>   # push the line back to be read by some other part of the program
> }

See 'perldoc -f seek' (and 'perldoc -f tell') which should work for a real
file.  You cannot expect to turn back steams like STDIN, pipes, fifos,
sockets.

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


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

Date: Wed, 17 Dec 2003 19:38:22 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Can you undo a read from a file
Message-Id: <XF6Eb.13673$CK3.1108618@news20.bellglobal.com>


"Tim Greenwood" <timothy@greenwood.name> wrote in message
news:412175bb.0312171524.18422667@posting.google.com...
> Is it possible (and preferably simple) to undo a line input from STDIN
> or any file handle? I want to do something like
>
>
> $line = <STDIN>;
> if ($line =~ $my_pattern) {
>    # process it all
> } else {
>   # push the line back to be read by some other part of the program
> }

I don't follow what you mean by pushing back a line read from stdin. Print
it back to stdout? To what end if your program is going to process it
anyway?

Are you just looking for an array?

my @process_later;

my $line = <STDIN>;

if ($line =~ /my_pattern/) { process $line }
else { push @process_later, $line; }

Reading from a file would be easier. You could still use an array if you
don't have a lot of data, or seek back to the beginning of the file and
reprocess it, or use a temp file, etc. etc.

Natt




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

Date: Wed, 17 Dec 2003 17:43:00 -0500
From: Zbigniew Fiedorowicz <fiedorow@hotmail.com>
Subject: Error with cgi script writing to STDERR
Message-Id: <brqm83$gmj$1@charm.magnus.acs.ohio-state.edu>

I was tracking down a problem with a cgi-based web service I am running
and found that it was due to the following puzzling behavior of our Apache 2.0
web server (running under RedHat 9.0 Linux): if a cgi perl script writes more
than 182 lines to STDERR, the script hangs - after about 10 minutes the
web server reports a "Premature end of script headers" error. Then after a
few more minutes, the stuff that the script was trying to write to STDERR
appears in the web server error logs.

Has anyone else experienced this?  Is there in any web server configuration
setting which is responsible for this?

I attach below a simple perl cgi script which elicits this behavior. If
you change the loop control $i<183 in the script by  $i<182 (or any smaller
value), the script runs without any problems.

TIA
Zbigniew Fiedorowicz

#!/usr/bin/perl

require 5.001;
use strict;

use CGI qw(:standard);

print header, start_html('Users Report');

print "<p>Testing 1\n";

my $i;
for ($i=0; $i<183; $i++) {
     print STDERR "Testing hypothesis $i\n";
}

print "<p>" . localtime() . "\n";
print end_html;

exit;



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

Date: Thu, 18 Dec 2003 00:15:39 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to determine end-of-line sequence?
Message-Id: <slrnbu1sda.p29.efflandt@typhoon.xnet.com>

On 17 Dec 2003, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> David Efflandt <efflandt@xnet.com> wrote in comp.lang.perl.misc:
> 
> [...]
> 
>> is.  Following is a script I wrote awhile ago that converts any text file
>> type to what you want based on the script name, but could be easily 
>> modified (shortened) to convert to a single type:
>> 
>> #!/usr/bin/perl -w
>> # txtconv - convert text to or from other OS
>> # Symlink or rename any of: tounix, 2unix, todos, 2dos, tomac, 2mac
>> # follow with list of files on commandline
>> # "tomac" may conflict with a program name
>> while(@ARGV) {
>>     my $file = shift @ARGV;
>>     unless (open(FILE,"+< $file")) {warn "Can't open $file: $!\n"; next;}
>>     flock(FILE,2); seek(FILE,0,0); binmode FILE;
>       ^^^^^^^^^^^^^
>>     print "$file before ", -s $file;
>>     my @lines = <FILE>; seek(FILE,0,0); truncate(FILE,0);
>>     if (lc($0) =~ /2unix|tounix/) { $end = "\012" }
>>     elsif (lc($0) =~ /2dos|todos/) { $end = "\015\012" }
>>     elsif (lc($0) =~ /2mac|tomac/) { $end = "\015" }
>>     else { die "file not converted, read $0\n" }
>>     foreach (@lines) { s/(\015\012|[\015\012])/$end/g; print FILE $_; }
>>     close FILE;
>>     print " after ", -s $file,"\n";
>> }
> 
> Just out of interest -- why are you locking the file?  I mean, EOL
> conversion is not something that is normally done concurrently :)

Just force of habit from working with CGI, so if doing a list of files
hopefully something else will not try to modify it in the middle of
converting it.  I had one situation where if two scripts just tried to
read the same file line by line at the same time, it would confuse the
file pointer or something and both would endlessly loop (maybe something
peculiar about SunOS awhile ago).

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


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

Date: Thu, 18 Dec 2003 00:14:50 GMT
From: Henry <henryn@zzzspacebbs.com>
Subject: Re: html-->text, keep line breaks, best strategy is? Addendum
Message-Id: <BC06317A.19AA7%henryn@zzzspacebbs.com>

Folks:

Here's an addendum to my previous post:

> Here's a problem I encountered and what I'm doing about it.  I'd welcome
> suggestions about how best to solve issues like this.  Please do _not_ spend
> time solving the specific problem -- just help me understand the  best
> approaches to such issues.
> 
> The problem:  I'm sniffing the text in some HTML using Perl.   The only way
> (believe me!) to do the job is scan from line breaks, so I need to preserve
> these.  It looks like everything I need to sniff is preformatted (between
> <pre> and </pre>> tags) with /r (carriage returns) at just the right places.

<snip>
<snip>

D'oh!  Double D'oh!

The best way to solve this problem is for me to open my  #$%*@%$#$%! eyes
and see that the HTML I'm sniffing is clearly script-generated  and very
simply so.  Thus it is senseless to convert it to an intermediate textual
form, and quite reasonable to write custom Perl code to directly sniff the
html for the content I need

I did experiment with HTML::Parse.  It preserves line breaks but obliterates
spacing that's really helpful in parsing the contents.  (These pages contain
massive outlines, by the way, up to maybe 2000 lines going up to six levels
deep.)

OK, in this case, there's underlying regularity that allows a simpler
solution.  Supposing I did need to convert to plain text, as my original
post described... was my approach reasonable?

(I don't know about this talking to myself. Not a good sign...)

Thanks,

Henry

henryn@zzzspacebbs.com   remove 'zzz'
 



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

Date: Thu, 18 Dec 2003 05:01:33 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Ordering arrays?
Message-Id: <3FE134A4.95380BF1@acm.org>

Gary Mayor wrote:
> 
> I'm trying to get an array into order i've got this array,
> $number[1] = "5";
> $number[2] = "7";
> $number[3] = "4";
> $number[4] = "8";
> $number[5] = "7";
> 
> i'm trying to get it into another array it looks like this,
> $number2[1] = "8";
> $number2[2] = "7";
> $number2[3] = "7";
> $number2[4] = "5";
> $number2[5] = "4";

Others have suggested:

@number2 = sort { $b <=> $a } @number;

However that populates $number[0] which I see you don't want.  Or did
you think that Perl's arrays started at [1]?  Anyway, this will do what
you want:

@number2 = ( undef, sort { $b <=> $a } @number );

Or:

@number2[ 1 .. $#number ] = sort { $b <=> $a } @number;



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 17 Dec 2003 23:14:18 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Please critique this short script that scans a log file
Message-Id: <3fe0daf7.103420725@news.erols.com>

J.W. <jwngaa@att.net> wrote:

: This script already works correctly and the -w doesn't report any
: warnings.  However, I'd like to get any feedback on making it better.
: My experience has been with C++ and ksh/awk, so I'm not sure my brain
: is solving problems the "Perl" way yet.

Others have already addressed points on the program's logic and flow, so
I'll skip that much.

: $regex_ctime = qr/ (Sun|Mon|Tue|Wed|Thu|Fri|Sat)
: (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([ |0-3][0-9])
: ([0-2][0-9]):([0-5][0-9]):([0-5][0-9]) ([0-9][0-9][0-9][0-9])/o;

The /o switch does nothing useful for that regex, but the /x switch could
make it more comprehensible and less likely to get wrecked by
word-wrapping, like has just happened.  With the /x switch, remember to
backslash-escape required whitespace characters that aren't within a
character class.

It looks like you're trying to do some bounds checking on the fields while
matching and capturing, but it's done badly in places.  For example, the
hour field, "([0-2][0-9])", would allow values between 24 and 29.  Better
would be "([01][0-9]|2[0-3])", or "([ 01][0-9]|2[0-3])" if a leading zero
might be replaced by a space.

A vertical bar inside a character class, as in "([ |0-3][0-9])", will match
a vertical bar.  It is not the same as the alternation regex metacharacter.
Go ahead and eliminate it.

With that advice, the regex definition might look like

    my $regex_ctime = qr/
        \ (Sun|Mon|Tue|Wed|Thu|Fri|Sat)
        \ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
        \ ([ 0][1-9]  | [12][0-9] | 3[01]) # day of month: 01-31
        \ ([ 01][0-9] | 2[0-3])            # hour: 00-23
        :([0-5][0-9])                      # minute: 00-59
        :([0-5][0-9])                      # second: 00-59
        \ ([0-9]{4})                       # year: 0000-9999
    /x;

If you were inclined, you could even ensure that it matches a day of the
month that is without bounds appropriate to the month.

    my %day_rx;
    $day_rx{Feb} = qr/[ 0][1-9]|[12][0-9]/;
    $day_rx{$_} = qr/$day_rx{Feb}|30/
        for qw/Apr Jun Sep Nov/;
    $day_rx{$_} = qr/$day_rx{Feb}|3[01]/
        for qw/Jan Mar May Jul Aug Oct Dec/;

    my $regex_ctime = qr/
        \ (Sun|Mon|Tue|Wed|Thu|Fri|Sat)
        \ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
        \ ((??{ $day_rx{$2} }))    # day of month: depends on month
        \ ([ 01][0-9] | 2[0-3])    # hour: 00-23
        :([0-5][0-9])              # minute: 00-59
        :([0-5][0-9])              # second: 00-59
        \ ([0-9]{4})               # year
    /x;

That's probably overkill, and not rigorously tested.
Fun exploration of Perl's regex capabilities, though.

: %MonthIndex = (
: 	"Jan",  0,
: 	"Feb",  1,
: 	"Mar",  2,
[etc.]

It's just a style choice, but you might like doing that with a hash slice.

    my %MonthIndex;
    @MonthIndex
        { qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/ }
        = (0..11);

: while (<>) {
: 	# chomp;   # not needed for this type of processing

But it would be nice for reporting badly formatted data, e.g.

    warn("Could not find a date in '$_'") unless /$regex_ctime/;



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

Date: Wed, 17 Dec 2003 23:26:42 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Please critique this short script that scans a log file
Message-Id: <3fe0e52c.106033939@news.erols.com>

tiltonj@erols.com (Jay Tilton) wrote:

: If you were inclined, you could even ensure that it matches a day of the
: month that is without bounds appropriate to the month.
                ^^^^^^^
Should be "within."  Bewildering mistake.



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

Date: Wed, 17 Dec 2003 23:56:03 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Please critique this short script that scans a log file
Message-Id: <x71xr3f17x.fsf@mail.sysarch.com>

>>>>> "JT" == Jay Tilton <tiltonj@erols.com> writes:

  > With that advice, the regex definition might look like

  >     my $regex_ctime = qr/
  >         \ (Sun|Mon|Tue|Wed|Thu|Fri|Sat)
  >         \ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
  >         \ ([ 0][1-9]  | [12][0-9] | 3[01]) # day of month: 01-31
  >         \ ([ 01][0-9] | 2[0-3])            # hour: 00-23
  >         :([0-5][0-9])                      # minute: 00-59
  >         :([0-5][0-9])                      # second: 00-59
  >         \ ([0-9]{4})                       # year: 0000-9999
  >     /x;


  > : %MonthIndex = (
  > : 	"Jan",  0,
  > : 	"Feb",  1,
  > : 	"Mar",  2,
  > [etc.]

  > It's just a style choice, but you might like doing that with a hash slice.

  >     my %MonthIndex;
  >     @MonthIndex
  >         { qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/ }
  >         = (0..11);

even more redundancy removal:

my @months =  qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/ ;
my %MonthIndex;
@MonthIndex{ @months } = (0 .. $#months);

my $months_re = join( '|', @months ) ;

    my $regex_ctime = qr/
        \ (Sun|Mon|Tue|Wed|Thu|Fri|Sat)
        \ ($months_re)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Wed, 17 Dec 2003 19:20:39 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Please critique this short script that scans a log file
Message-Id: <slrnbu2077.h51.tadmc@magna.augustmail.com>

Jay Tilton <tiltonj@erols.com> wrote:

> With the /x switch, remember to
> backslash-escape required whitespace characters that aren't within a
> character class.


I never have to remember that, because I'll always type 3 chars "[ ]"
instead of 2 chars "\ ". I think it is a lot easier to read.

But then, I have to remember this instead:

   With the /x switch, remember to enclose required whitespace 
   characters in a character class.


:-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 17 Dec 2003 22:49:55 -0800
From: raj1_iit@yahoo.com (Rajesh)
Subject: Re: reading from an url
Message-Id: <bb6dafde.0312172249.6e5c5456@posting.google.com>

> 
> Looks like (and I could be wrong) your DNS lookup failed.  Possible
> causes (on *NIX) is your resolv.conf file is fould or you have no
> route to the host (firewall maybe?).  No sure what could be going on
> if your using WinXP (as stated in the sniped portion of your post).  I
> think netstat (at the command prompt) will give you routing
> information (WinXP is trying to "play nice" with *NIX systems).
> 
> All in all, this doesn't appear to be a Perl issue, but an issue with
> your system.  Check your settings, try connecting with a browser, and
> then see if your script works.  If all else fails, change the URL in
> your script to see if you can connect anywhere at all.


Thanks Jim.  I think its because of a firewall. But, why is firewall
preventing me from reading an url? Browsers work fine and the same url
opens in a browser and the script fails for all the urls.


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

Date: Thu, 18 Dec 2003 08:08:08 +0100
From: Carsten Aulbert <carsten@welcomes-you.com>
Subject: Re: reading from an url
Message-Id: <brrjp9$5t15g$1@ID-213226.news.uni-berlin.de>



Rajesh wrote:

> 
> 
> Thanks Jim.  I think its because of a firewall. But, why is firewall
> preventing me from reading an url? Browsers work fine and the same url
> opens in a browser and the script fails for all the urls.

Question: Have you installed a personal firewall and decided in the 
beginning that the "process" Internet Explorer may connect to the outside 
world and you forgot to enable perl to connect to the outside world?

Just guessing since I don't use personal firewalls and Windows on the net.

CA


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

Date: Thu, 18 Dec 2003 08:57:59 +0200
From: user@domain.invalid
Subject: Re: Redirect url
Message-Id: <brrj5n$gd7$1@ctb-nnrp2.saix.net>

Gunnar Hjalmarsson wrote:
> 
> There is at least a way around making a fool of yourself: Don't post
> such a question without showing relevant code!
> 
Thanks for your time.



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

Date: Thu, 18 Dec 2003 02:28:49 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Return all points with x km of y
Message-Id: <3FE10E87.8020604@rochester.rr.com>

Gregory Toomey wrote:

 ...
> You can do it in SQL, and its often done with quadtrees, which is a method of subdividiing down an image into smaller "quardrangles" or "quarters". You can then represent the hirearchy of these images in base 4 arithmetic.
> Then each image can be represented by base 4 numbers, which as stored in a database.
> 
> You can then improve the time complexity of common operations like proximity, point-in-polygon by querying the database.
> 
> Also see the mysql spatial operations.
> http://www.mysql.com/doc/en/Spatial_extensions_in_MySQL.html
> 
> gtoomey
> 

Wow -- thanks for the info -- I had no idea.

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: 18 Dec 2003 06:46:38 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: select()ing a lexical FH
Message-Id: <brrige$5ud$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Michele Dondi:

> A few days ago I was about to answer a post in which a user asked for
> advice on creating per-directory reports with File::Find.
> 
> Amongst the possible solutions that came to my mind, I though of using
> something like this (tested!):
> 
>   #!/usr/bin/perl -l
>   # Oversimplified example
>   
>   use strict;
>   use warnings;
>   use File::Find;
>   
>   File::Find::find { preprocess => sub {
>       open my $fh, '>', '_report.txt' or 
>         die "Can't open `$File::Find::dir/_report.txt': $!\n";
>       select $fh;
>       @_ },
>         wanted => sub {
>   	  print;
>         }
>   }, @ARGV;
>   
>   __END__
> 
> Eventually, I didn't post it for (i) it was probably too late, and
> good answers had already been given to the OP, (ii) I was not 100%
> sure about this approach.
> 
> Now my question is if there are possible issues with select()ing a
> lexical filehandle: it is my understanding that it won't cease to
> exist till references to it exists too, and select() seems to do just
> this, keeping it in life, but is this guaranteed to continue working
> in future releases of perl?

I think it's pretty safe to expect that. select() will increment the
reference-count of its argument and decrement the ref-count of the
previous default handle when a new handle is selected.

I am pretty sure that the porters wont change that in future.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Wed, 17 Dec 2003 22:51:54 GMT
From: Erik Tank <jundy@jundy.com>
Subject: Re: ticks and FreeBSD
Message-Id: <ea16f4e0f733d03dcfab9f6fa9d33c10@news.teranews.com>

Although this is getting out of the scope fo this group but -ef only
shows processes associated with your user where as -aux shows them
all.

On Tue, 16 Dec 2003 19:34:14 +0000 (UTC), Mike Hunter
<mhunter@uclink.berkeley.edu> wrote:

>On Mon, 15 Dec 2003 17:38:49 GMT, Erik Tank wrote:
>
>>  I just migrated a program from RedHat 9 to FreeBSD 5.1.  Everything is
>>  working well with the exception of the following:
>>    my @jmail_return_lines = `ps -aux | grep 'jmaild' | grep -v grep`;
>
>Freebsd likes ps -ef better.
>
>Mike



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

Date: Thu, 18 Dec 2003 06:55:16 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Where do -T warnings go?
Message-Id: <newscache$4st2qh$pv1$1@news.emea.compuware.com>

James Willmore wrote (Wednesday 17 December 2003 15:46):

> On Wed, 17 Dec 2003 11:30:15 +0100
> Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
> 
>> I ran into this resentful qx($cmd) problem on 5.8.0 in tainted
>> mode. It took a very long time before I got to figure out it
>> was a taint issue because I couldn't find the taint warnings
>> back: not in $?, $!, $@, webserver error log or syslog. Is
>> taint a special case here?
> 
> When running a script in taint mode, you need to do such things
> as set
> your PATH and escape metacharacters.  This is documented in
> perldoc perlsec
> and
> http://www.w3.org/Security/Faq/www-security-faq.html

Yes, thanks, I've studied these. Well, only perlsec to be honest.

> As far as getting errors about insecure dependencies, you
> *should* get
> them like any other warnings and errors.

One SuSE 7.3 (5.8.0) they do get back (through STDERR). When
running on RedHat (also 5.8.0) qx($cmd) just seems to die without
leaving any trace anywhere.

>  Best bet is to test
> your script at the command line first to insure *most* possible
> issues are taken care of before running the script through the
> web server.

That is very true. I should've.

> HTH

Thanks for your remarks.
-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped


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

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


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