linux - HTML::Grabber Perl Empty String at Grabber.pm line 78 -


script source : http://kayrules.com/list-malay-words/

i'm trying run script:

#!/usr/bin/perl use html::grabber; use lwp::simple;  $numargs = $#argv + 1; if ($numargs != 1) {         print "usage: ./grabber.pl <letter>\n";         exit; }  $letter = uc($argv[0]); $url = "http://ms.wiktionary.org/wiki/wiktionary:senarai_perkataan_$letter"; $dom = html::grabber->new( html => get($url));  @array; $dom->find('div.mw-content-ltr li')->each(sub {         $body = $_->find('a')->attr('title');         @words = split / /, $body;         @dashed = split /-/, @words[0];         push @array, lc(@dashed[0]);          if(@dashed[1]) {                 push @array, lc(@dashed[1]);         } });  $anagrammed; @filtered = uniq(@array); foreach $word (@filtered) {         $anagrammed = anagram($word);         $length = length($word);         print "$length|$anagrammed|$word\n"; }  sub uniq {         %seen;         grep !$seen{$_}++, @_; }  sub anagram {         ($word) = @_;         return (join '', sort split(//, $word)); } 

basically run script , extract several webpage elements given url.

however, when tried run script using ./grabber.pl >> malay_words.txt described source, return empty string @ /usr/local/share/perl/5.18.2/html/grabber.pm line 78.

referring here http://cpanratings.perl.org/dist/html-grabber , can html::grabber module doesn't accept url given script. so, there workaround or can help?


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -