[26137] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8329 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 17 21:05:39 2005

Date: Wed, 17 Aug 2005 18: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           Wed, 17 Aug 2005     Volume: 10 Number: 8329

Today's topics:
        detecting french character into a file? <clavenne@lucent.com>
        detecting french character into a file? <clavenne@lucent.com>
    Re: detecting pod in a file? <miroslav@suchy.cz>
    Re: detecting pod in a file? <tadmc@augustmail.com>
    Re: detecting pod in a file? <abigail@abigail.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Aug 2005 17:33:31 +0200
From: "Christian Lavenne" <clavenne@lucent.com>
Subject: detecting french character into a file?
Message-Id: <ddvlcn$1e9@netnews.net.lucent.com>

Could someone provide me with a script detecting the french character into a
file?
I don't know into which CPAN module I must use to do it.

Christian




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

Date: Wed, 17 Aug 2005 17:38:55 +0200
From: "Christian Lavenne" <clavenne@lucent.com>
Subject: detecting french character into a file?
Message-Id: <ddvlmg$1gp@netnews.net.lucent.com>

Could someone provide me with a script detecting the french character into a
file?
I don't know into which CPAN module I must use to do it.

Christian

PS: I posted it into a bad thread. Soory for it.




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

Date: Wed, 17 Aug 2005 16:54:33 +0200
From: Miroslav Suchy <miroslav@suchy.cz>
Subject: Re: detecting pod in a file?
Message-Id: <ddvj8v$m8$1@mrazik2.dkm.cz>

Mike wrote:
> I want to detect if pod is embedded into a file or not.
> Is there an easier way to detect the embedded pod other
> than the sample code below?

Yes.

> my $file = '/tmp/file';
> open(IN, "<$file") or die "$0: cannot read file '$file': $!";
my $pod=1;
while (my $line=<IN> and $pod) {
	$pod=0 if ($line =~ m/^=pod/o);
}
> close(IN);
> pod2html($file) if $pod;


You have not to read whole file.

Miroslav Suchy


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

Date: Wed, 17 Aug 2005 16:40:12 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: detecting pod in a file?
Message-Id: <slrndg7bls.p9o.tadmc@magna.augustmail.com>

Miroslav Suchy <miroslav@suchy.cz> wrote:


> You have not to read whole file.


He *has* read the whole file.

Have you read his code?

Do you know what the input operator does when used in a list context?


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


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

Date: 17 Aug 2005 22:38:02 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: detecting pod in a file?
Message-Id: <slrndg7f2a.nlu.abigail@alexandra.abigail.nl>

Mike (mikee@mikee.ath.cx) wrote on MMMMCCCLXIX September MCMXCIII in
<URL:news:wwHMe.6801$rc6.6132@fe03.lga>:
,,  I want to detect if pod is embedded into a file or not.
,,  Is there an easier way to detect the embedded pod other
,,  than the sample code below?
,,  
,,  Mike
,,  
,,  
,,  my $file = '/tmp/file';
,,  open(IN, "<$file") or die "$0: cannot read file '$file': $!";
,,  my $pod = 1 if scalar(grep(/^=pod/o, <IN>)) > 0;
,,  close(IN);
,,  pod2html($file) if $pod;


You are testing for '=pod' - however, any '=' at the beginning of
the line that's followed by a letter (or even an alphanum) starts
a POD section. Including '^=cut'. And there's a difference between
what perl thinks is POD, and what the podlaters think:

    #!/usr/bin/perl

    print <<'=head1';

    =pod

    This is just a string - not pod.

    =head1

    print "And this is code - not POD.\n";

    =cut

    But this is POD - most podlaters think this is code.

    __END__


But assuming you want the podlator interpretation, I'd use:

    my $file = "/tmp/file";
    open my $fh => $file or die "open: $!\n";
    my $pod;
    while (<$fh>) {
        last if $pod = /^=\w/;
    }
    close $fh;
    pod2html $file if $pod;


Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


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

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


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