develooper Front page | perl.perl5.porters | Postings from July 2008

Re: Fun with open() on a string

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
July 30, 2008 08:12
Subject:
Re: Fun with open() on a string
Message ID:
20080730171236.00e39394@pc09.procura.nl
On Wed, 30 Jul 2008 16:54:33 +0200, "H.Merijn Brand"
<h.m.brand@xs4all.nl> wrote:
> BTW your explanations is fine on most systems, at least those that allow
> you to open files on file descriptor 0.
> 
> $ perl -e 'close STDIN; eval "use CPAN::Debug"; print <>'
> 
> =head1 LICENSE
> 
> This program is free software; you can redistribute it and/or
> modify it under the same terms as Perl itself.
> 
> =cut
> 
> $

BTW to find a module with just a low count of pod below the __END__ I
deliberately used the unsafe <> :P

--8<---
use strict;
use warnings;
use File::Find;

$/ = "\n__END__\n";

my %pod;
find (sub {
    m/\.pm$/ or return;
    local @ARGV = ($_);
    my (undef, $pod) = <>;
    $pod and $pod{$File::Find::name} = ($pod =~ tr/\n/\n/);
    }, "ext", "lib");
printf "%6d %s\n", $pod{$_}, $_ for sort { $pod{$b} <=> $pod{$a} } keys %pod;
-->8---

-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About