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;
}
-
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.
|