Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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.

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 scrutinizing the Monastery: (6)
As of 2016-06-25 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (326 votes). Check out past polls.