Subject: | monster.com HTML response now breaks WWW::Search::Monster |
It looks like monster.com has changed the HTML returned from a job
search so that the WWW::Search::Monster module no longer works.
I copied the example search request code from the online docs:
use WWW::Search;
my $oSearch = new WWW::Search('Monster');
my $sQuery = WWW::Search::escape_query("manager and (perl or php or
mysql)");
$oSearch->native_query($sQuery,
{'st' => 'TX',
'tm' => '120d'});
while (my $res = $oSearch->next_result()) {
print $res->company . "\t" . $res->title . "\t" . $res->change_date
. "\t" . $res->location . "\t" . $res->url . "\n";
}
When submitted under the Perl debugger, I get:
DDD raw HTTP::Request is:
GET
http://jobsearch.monster.com/jobsearch.asp?q=manager+and+%28perl+or+php+or+mysql%29&st=TX&tm=120d&
Accept-Charset: iso-8859-1,*,utf-8
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
http://jobsearch.monster.com/jobsearch.asp?q=manager+and+%28perl+or+php+or+mysql%29&st=TX&tm=120d&
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 689 bytes
LWP::UserAgent::request: Simple response: OK
+ got HTTP::Response (code=200):
Cache-Control: private
Connection: close
Date: Thu, 05 Feb 2009 15:33:00 GMT
Server: Microsoft-IIS/6.0
Content-Length: 689
Content-Type: text/html
Content-Type: text/html; charset=utf-8
Client-Date: Thu, 05 Feb 2009 15:33:00 GMT
Client-Peer: 208.71.193.13:80
Client-Response-Num: 1
P3P: CP=CAO DSP COR CURa ADMa DEVa TAIi IVAi IVDi CONi HISa TELi OUR
DELi SAMi BUS PHY ONL UNI PUR COM NAV INT DEM CNT STA PRE
X-Powered-By: ASP.NET
Use of uninitialized value $1 in subtraction (-) at
/usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 329.
at /usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 329
WWW::Search::Monster::native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1714
WWW::Search::_native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1620
WWW::Search::retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 776
WWW::Search::next_result('WWW::Search::Monster=HASH(0x8a760ec)')
called at monster.pl line 8
Use of uninitialized value $2 in subtraction (-) at
/usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 329.
at /usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 329
WWW::Search::Monster::native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1714
WWW::Search::_native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1620
WWW::Search::retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 776
WWW::Search::next_result('WWW::Search::Monster=HASH(0x8a760ec)')
called at monster.pl line 8
Use of uninitialized value $nexturl in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 335.
at /usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 335
WWW::Search::Monster::native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1714
WWW::Search::_native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1620
WWW::Search::retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 776
WWW::Search::next_result('WWW::Search::Monster=HASH(0x8a760ec)')
called at monster.pl line 8
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 358.
at /usr/lib/perl5/site_perl/5.10.0/WWW/Search/Monster.pm line 358
WWW::Search::Monster::native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1714
WWW::Search::_native_retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 1620
WWW::Search::retrieve_some('WWW::Search::Monster=HASH(0x8a760ec)')
called at /usr/lib/perl5/site_perl/5.10.0/WWW/Search.pm line 776
WWW::Search::next_result('WWW::Search::Monster=HASH(0x8a760ec)')
called at monster.pl line 8
+ _native_retrieve_some() returned 1
main::(monster.pl:9): print $res->company . "\t" . $res->title .
"\t" . $res->change_date
main::(monster.pl:10): . "\t" . $res->location . "\t" .
$res->url . "\n";
Line 329 in monster.pm is:
my $nrows = $2 - $1 + 1;
Which immediately follows the pattern match:
$content =~ m/Jobs (\d+) to (\d+) of (\d+)/;
Here's some additional info:
[root@mysql2 tmp]# perl -v
This is perl, v5.10.0 built for i386-linux-thread-multi
[root@mysql2 tmp]# uname -a
Linux mysql2 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686
i686 i386 GNU/Linux
Best wishes!
Paul