NAME

Webservice::Purgomalum::API - Filter and removes profanity and unwanted text from input using PurgoMalum.com's free API

SYNOPSIS

use Webservice::Purgomalum::API;

my $api = Webservice::Purgomalum::API->new();

print $api->contains_profanity(
        text => "what the hell?",
    )."\n";

print $api->get(
    text => "what the heck dude?", #required
    add => "heck",             #optional
    fill_text => "[explicit]"  #optional
    fill_char => '-',          #optional (overridden by fill_text param)
)."\n";

# output debugging data to STDERR
$api->debug(1);
print $api->get(
    text => "what the heck dude?",
    add => "heck",
)."\n";

DESCRIPTION

This module provides an object oriented interface to the PurgoMalum free API endpoint provided by https://Purgomalum.com/.

METHODS

All methods have the same available parameters. Only the "text" parameter is required.

  • text Required Input text to be processed.

  • add Optional Comma separated list of words to be added to the profanity list. Accepts letters, numbers, underscores (_) and commas (,). Accepts up to 10 words (or 200 maximum characters in length). The PurgoMalum filter is case-insensitive, so the case of your entry is not important.

  • fill_text Optional Text used to replace any words matching the profanity list. Accepts letters, numbers, underscores (_) tildes (~), exclamation points (!), dashes/hyphens (-), equal signs (=), pipes (|), single quotes ('), double quotes ("), asterisks (*), open and closed curly brackets ({ }), square brackets ([ ]) and parentheses (). Maximum length of 20 characters. When not used, the default is an asterisk (*) fill.

  • fill_char Optional Single character used to replace any words matching the profanity list. Fills designated character to length of word replaced. Accepts underscore (_) tilde (~), dash/hyphen (-), equal sign (=), pipe (|) and asterisk (*). When not used, the default is an asterisk (*) fill.

contains_profanity()

Returns either "true" if profanity is detected or "false" otherwise.

get()

Returns the string with all profanities replaced with either the fill_text or fill_char

SEE ALSO

AUTHOR

Joshua Day, <hax@cpan.org>

SOURCECODE

Source code is available on Github.com : https://github.com/haxmeister/perl-purgomalum

COPYRIGHT AND LICENSE

Copyright (C) 2024 by Joshua Day

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.