Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi everyone

I used the pp module (this one) to convert my perl code to exe.

I wrote a simple code to extract some text from an online page with (this) WWW:Mechanize.
(The page contains Hebrew characters)
My code works gr8 as .pl but after it's converted to .exe with the pp module,
it gets a strange encoded (I think) text, that I can't understand nor convert to it's standard form.
Another weird thing is that the .exe created version of out.txt is about 4 times longer than the .pl's.

(tried & failed to convert with some functions from the utf8 pragma )

Suggestions ?
thx

My code (at least it's relevant part):
use feature 'state'; use WWW::Mechanize 'new'; my $mech = WWW::Mechanize->new(); #$mech->get('http://www.google.co.il'); $mech->get('http://tv.walla.co.il/?w=/2//200//2011-05-14/1'); my $content = $mech->content( format => 'text' ); writeFile('Out.txt',$content); print "got\n"; print $content; print "\nand thats it\a\n"; sleep 10; sub writeFile #form: writeFile(path,content) { my $filepath = shift; my $nwntnt = join("",@_); $nwntnt = "\x{feff}".$nwntnt; #utf8 char starter open(txt, ">:utf8",$filepath); print txt $nwntnt; close txt; }

In reply to pp module messes encoding by palkia

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-19 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found