Skip to content

Instantly share code, notes, and snippets.

@semifor
Created March 24, 2010 01:09
Show Gist options
  • Select an option

  • Save semifor/341871 to your computer and use it in GitHub Desktop.

Select an option

Save semifor/341871 to your computer and use it in GitHub Desktop.
package BMT::URI::Find;
use parent 'URI::Find';
use Regexp::Common qw/balanced/;
# subclass of URI::Find to handle URIs like:
#
# http://en.wikipedia.org/wiki/Scala_(programming_language)
#
sub decruft {
my ( $self, $orig_match ) = @_;
my @parts = split /($RE{balanced}{-parens=>'()[]'})/, $orig_match, -1;
my $decrufted = $self->SUPER::decruft(pop @parts);
return join '', @parts, $decrufted;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment