Config-Eggdrop-Userfile
view release on metacpan or search on metacpan
lib/Config/Eggdrop/Userfile.pm view on Meta::CPAN
#! perl
package Config::Eggdrop::Userfile;
=head1 NAME
Config::Eggdrop::Userfile - parse userfiles generated by Eggdrop
=head1 SYNOPSIS
If you want to read from a file handle, you can use something like this:
use Config::Eggdrop::Userfile;
open my $fh, '<', '/path/to/eggdrop/userfile';
my $parsed = Config::Eggdrop::Userfile::parse_file $fh;
Or, provided that you have a userfile read into $content, you can read from a string:
use Config::Eggdrop::Userfile;
my $parsed = Config::Eggdrop::Userfile::parse_string $content;
=head1 DESCRIPTION
This is a fairly simple regex-based parser module for Eggdrop userfiles.
Eggdrop userfiles contain information (including passwords) about eggdrop
partyline user accounts.
=cut
use v5.10.1;
use strict;
use warnings;
use Carp qw/croak carp/;
use feature qw/switch/;
our $VERSION = 0.01;
my $BADNICKCHARS = '-,+*=:!.@#;$%&'; # from eggdrop1.6.21/src/eggdrop.h:62
# TODO
# - implement at least the lines that could be written by eggdrop 1.6. Older
# userfiles shouldn't be very relevant anymore
# - This means fix all FIXMEs below
# - add a limited mode that only searches for a certain user/password you're
# looking for rather than taking apart the whole userfile as they can become
# relatively big. => OO module with callbacks?
# - write documentation
# - put on CPAN
=head2 Functions
These functions are in C<@EXPORT_OK>.
=cut
BEGIN {
use base 'Exporter';
our @EXPORT_OK = qw/parse_file parse_string/;
}
################################################################################
# This module currently only understands a subset of the userfile entries
# defined by eggdrop as follows. The best compatible eggdrop version with this
# module is the most recent one, at the time of writing.
# If your userfile can not be parsed correctly, please file a bug report..
#
# Sadly, eggdrop's userfile parser seems to be a bit messy, so this module will
# probably not provide 100% identical features
#
# from eggdrop1.6.21/src/users.c:637:
#
# tagged lines in the user file:
# * OLD:
# # (comment)
# ; (comment)
# - hostmask(s)
# + email
# * dcc directory
# = comment
# : info line
# . xtra (Tcl)
# ! channel-specific
# !! global laston
# :: channel-specific bans
# NEW:
# *ban global bans
# *ignore global ignores
# ::#chan channel bans
# - entries in each
# <handle> begin user entry
# --KEY INFO - info on each
# NEWER:
# % exemptmask(s)
# @ Invitemask(s)
# *exempt global exempts
# *Invite global Invites
# && channel-specific exempts
# &&#chan channel exempts
# $$ channel-specific Invites
# $$#chan channel Invites
################################################################################
sub parse_xtra {
my ($user, $key, $value) = @_;
# FIXME add special cases for other "well known" values here which are not
( run in 0.564 second using v1.01-cache-2.11-cpan-39bf76dae61 )