Code review comment for lp:~kfader/mvhub/pages.t-too-slow

Revision history for this message
Dan MacNeil (omacneil) wrote :

A few problems:

You take out all the:

  $mech->get( $$page{url}

..so the tests are all invalid, they test a mech object that doesn't contain a page. We save a lot of time by not traveling over the network to fetch a web page, but we cant test the links or the validity of the html if we don't have the page.

perl objects are references, roughly akin to pointers.

So you assign a pointer to the same thing to each mech object in the @pages array.

if a is pointer that points to address 33558 and you say a=b then b also points to address 33558

To help see these problems paste this code into main at some point.

foreach my $page_href (@total_pages){
    my $mech=$$page_href{mech};
       print "mech object is:",$$page_href{mech}, q/$mech->title() is: '/,$mech$
}
;
exit 0;

One patial solution would be to create a new() object in your add_mech_objects() sub and to call $mech->get( $$page{url} in that sub.

review: Needs Fixing

« Back to merge proposal