in reply to Re: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"
in thread Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"

Nice job zentara, here is a monkey patch

BEGIN { package HTML::TagParser::Element; sub AUTOLOAD { my ($name) = our $AUTOLOAD =~ /::(\w+)$/; my $method = sub { my $self = shift; return $self->subTree->$name( @_ ); }; no strict 'refs'; * { $AUTOLOAD } = $method; goto &$method; } }

Now calling getElementsByClassName on a HTML::TagParser::Element works :)

  • Comment on Re^2: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element" ( getElementsByClassName and others for HTML::TagParser::Element )
  • Download Code

Replies are listed 'Best First'.
Re^3: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"
by Anonymous Monk on Nov 27, 2014 at 08:45 UTC
    Sorry about that tangent .. when I get distracted tangent associates to zentara and bam ... kinda miss the guy :)