Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Distinguish between HTML and Plain text

by Khen1950fx (Canon)
on Sep 27, 2011 at 02:24 UTC ( #928000=note: print w/ replies, xml ) Need Help??


in reply to Distinguish between HTML and Plain text

It can be done. Is it precise? You be the judge:

#!/usr/bin/perl -l use strict; use warnings; use Text::FromAny; my $log = '/root/Desktop/text.log'; open STDOUT, '>', $log; my $entries= "<TITLE>Page 7</TITLE>"; print $entries; my $tFromAny = Text::FromAny->new(file => $log); print $tFromAny->detectedType; close STDOUT;
Instead of thinking "can't", think "don't do that". It works, but it's not best practice.


Comment on Re: Distinguish between HTML and Plain text
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928000]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2014-09-21 15:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (172 votes), past polls