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;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.