-
-
08 Sep 2010 11:56:18 UTC
- Distribution: WWW-Adblock
- Module version: 0.02
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (94 / 0 / 0)
- Kwalitee
Bus factor: 0- % Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (16.92KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The idea for this code comes from Adblock Plus. Find out more at http://adblockplus.org/en/.
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
WWW::Adblock - a simple implementation of Adblock Plus in Perl
SYNOPSIS
use WWW::Adblock; my $adblock = WWW::Adblock->new(); $adblock->load('/path/to/filters.txt'); if ($adblock->filter('http://example.com/1x1.gif')) { # it matched a filter rule }
DESCRIPTION
This is a very simplified implementation of Adblock Plus (the popular browser extension) in Perl. Currently it only supports URI filtering and does not implement the per-element blocking offered by the extension.
Methods
new
my $adblock = WWW::Adblock->new(); my $adblock = WWW::Adblock->new( filters => $target );
Creates a new object. If
$filters
is given it is passed to$adblock->load
.load
$adblock->load('/path/to/rules.txt');
Loads and parses a ruleset. May be called multiple times, new rules are added to the existing ones.
filter
# Check a $uri $adblock->filter($uri); # Check a $uri that appeared on a page on $domain $adblock->filter($uri, $domain);
Checks a URI to see whether it matches any rules. Returns 0 for no match, 1 for positive match, 2 for whitelist.
AUTHOR
The idea for this code comes from Adblock Plus. Find out more at http://adblockplus.org/en/.
Implementation in Perl by David Cannings <david@edeca.net>
COPYRIGHT / LICENSE
Copyright (c) 2010 David Cannings. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install WWW::Adblock, copy and paste the appropriate command in to your terminal.
cpanm WWW::Adblock
perl -MCPAN -e shell install WWW::Adblock
For more information on module installation, please visit the detailed CPAN module installation guide.