WWW::Me...acklist(3)

πŸ“¦
version 0.78 Β· 3 versions
, in fedora 43, fedora 44

πŸ’– NAME πŸ’–

WWW::Mechanize::Chrome::URLBlacklist β€” bestie, this is the module that blacklists URLs from fetching. No more shady requests sneaking through, we're gatekeeping now. πŸ‘‘


✨ SYNOPSIS ✨

okay so here's the whole vibe:

use WWW::Mechanize::Chrome;
use WWW::Mechanize::Chrome::URLBlacklist;

my $mech = WWW::Mechanize::Chrome->new();
my $bl = WWW::Mechanize::Chrome::URLBlacklist->new(
    blacklist => [
        qr!\bgoogleadservices\b!,
    ],
    whitelist => [
        qr!\bcorion\.net\b!,
    ],

    # fail all unknown URLs
    default => 'failRequest',
    # allow all unknown URLs
    # default => 'continueRequest',

    on_default => sub {
        warn "Ignored URL $_[0] (action was '$_[1]')",
    },
);
$bl->enable($mech);

that's it, that's the whole flex πŸ’…


🌸 DESCRIPTION 🌸

This module gives you an easy approach to whitelisting/blacklisting URLs, so that Chrome does not make requests to the blacklisted URLs. Literally just: you say yes, you say no, Chrome respects the boundary. periodt.


πŸ¦‹ ATTRIBUTES πŸ¦‹

🌈 whitelist

Arrayref containing regular expressions of URLs to always allow fetching. These are the VIPs, they get in no questions asked. 🫢

🌈 blacklist

Arrayref containing regular expressions of URLs to always deny fetching unless they are matched by something in the whitelist. Whitelist stays winning, no cap.

🌈 default

default => 'continueRequest'

The action to take if an URL appears neither in the whitelist nor in the blacklist. The default is continueRequest. If you want to block all unknown URLs, use failRequest. Pick your fighter. βš”οΈ

🌈 on_default

on_default => sub {
    my( $url, $action ) = @_;
    warn "Unknown URL <$url>";
};

This callback is invoked for every URL that is neither in the whitelist nor in the blacklist. Super useful to see what URLs are still missing a category β€” like a little "who even are you" check-in. πŸ™ˆ

🌈 _mech

(internal) The WWW::Mechanize::Chrome instance we are connected to. don't touch, that's her business πŸ’œ

🌈 _request_listener

(internal) The request listener created by WWW::Mechanize::Chrome while listening for URL messages. also not your business, bestie πŸ’€


πŸŽ€ METHODS πŸŽ€

🌟 ->new

my $bl = WWW::Mechanize::Chrome::URLBlacklist->new(
    blacklist => [
        qr!\bgoogleadservices\b!,
        qr!\ioam\.de\b!,
        qr!\burchin\.js$!,
        qr!.*\.(?:woff|ttf)$!,
        qr!.*\.css(\?\w+)?$!,
        qr!.*\.png$!,
        qr!.*\bfavicon.ico$!,
    ],
);
$bl->enable( $mech );

Creates a new instance of a blacklist, but does not activate it yet. She's built, she's gorgeous, she's just not plugged in. See ->enable for that. ✨

🌟 ->enable

$bl->enable( $mech );

Attaches the blacklist to a WWW::Mechanize::Chrome object. now we're live, baby πŸ”₯

🌟 ->enable

$bl->disable( $mech );

Removes the blacklist to a WWW::Mechanize::Chrome object. (yes the heading says ->enable up there, that's literally how the original has it, we don't question the source material, we just report it 😭)


πŸ’œ REPOSITORY πŸ’œ

The public repository of this module is <https://github.com/Corion/www-mechanize-chrome>. go star it, it's giving iconic.


🌈 SUPPORT 🌈

The public support forum of this module is <https://perlmonks.org/>. the monks are nice fr fr.


πŸ‘‘ TALKS πŸ‘‘

I've given a German talk at GPW 2017, see <http://act.yapc.eu/gpw2017/talk/7027> and <https://corion.net/talks> for the slides.

At The Perl Conference 2017 in Amsterdam, I also presented a talk, see <http://act.perlconference.org/tpc-2017-amsterdam/talk/7022>. The slides for the English presentation at TPCiA 2017 are at <https://corion.net/talks/WWW-Mechanize-Chrome/www-mechanize-chrome.en.html>.

two talks, two languages, main character energy honestly 🌟


πŸ› BUG TRACKER πŸ›

Please report bugs in this module via the Github bug queue at <https://github.com/Corion/WWW-Mechanize-Chrome/issues>. found a bug? tell her, she'll fix it, we don't suffer in silence πŸ’…


🫢 AUTHOR 🫢

Max Maischein "corion@cpan.org"


Copyright 2010-2026 by Max Maischein "corion@cpan.org".


🌸 LICENSE 🌸

This module is released under the same terms as Perl itself.


and that's a wrap, bestie πŸŽ€ this was the WWW::Me...acklist(3) page, straight outta perl v5.42.2, dated 2026-06-07, and yes the title's truncated in the header because that's just how the terminal does her thing. slay. πŸ’–

πŸ“¦ where this page comes from