App-Pocoirc

 view release on metacpan or  search on metacpan

bin/pocoirc  view on Meta::CPAN

        for my $chanspec (@{ $args{chan_specs} }) {
            my ($chan, $pass) = split /,/, $chanspec, 2;
            $chans{$chan} = $pass;
        }
        push @plugins, ['AutoJoin', { Channels => \%chans }];
    }

    # process -N option
    if (defined $args{nspassword}) {
        push @plugins, ['NickServID', { Password => $args{nspassword}} ],
    }

    # process -a options
    my %direct_args;
    if ($args{args}) {
        for my $arg (@{ $args{args} }) {
            my ($key, $val) = split /:/, $arg, 2;
            if (!defined $key || !defined $val) {
                die "Invalid argument to -a or --arg: $arg\n";
            }
            $direct_args{$key} = $val;
        }
    }

    $config = {
        (map { defined $args{$_} ? ($_ => $args{$_}) : () } qw(lib log_file pid_file)),
        networks => {
            default => {
                local_plugins => \@plugins,
                %direct_args,
                (map {
                    defined $args{$_} ? ($_ => $args{$_}) : ()
                } qw(class server port password nick username ircname ipv6 ssl)),
            }
        },
    };
}

require App::Pocoirc;
App::Pocoirc->new(
    cfg       => $config,
    cfg_file  => $args{cfg_file},
    (map {
        defined $args{$_} ? ($_ => $args{$_}) : ()
    } qw(check_cfg daemonize verbose trace no_color list_plugins interactive))
)->run();

=encoding utf8

=head1 NAME

pocoirc - A command line tool for launching L<POE::Component::IRC|POE::Component::IRC> clients

=head1 SYNOPSIS

B<pocoirc> <options>

 Options:
   -c, --check                  Check if config is valid and code compiles
   -f FOO, --config FOO         Use config file FOO
   -d, --daemonize              Run in the background
   -v, --verbose                Show IRC protocol messages
   -t, --trace                  Show all IRC events
   -L, --list-plugins           List available plugins
   -b, --no-color               Don't use terminal colors
   -i, --interactive            Interactive mode (type 'help' for help)
   -V, --version                Print version
   -h, --help                   Print this usage message

 When not using a config file, you can use these:
   -s FOO, --server FOO         Connect to server FOO
   -p FOO, --port FOO           Connect to port FOO
   -P FOO, --password FOO       Use server password FOO
   -n FOO, --nickname FOO       Use nickname FOO
   -u FOO, --username FOO       Use username FOO
   -r FOO, --realname FOO       Use realname FOO
   -j FOO, --join FOO           Join channel FOO (see below)
   -N FOO, --nspassword FOO     NickServ password (see below)
   -a FOO, --plugin FOO         Add plugin FOO (see below)
   -6, --ipv6,                  Use IPv6
   -S, --ssl,                   Use SSL
   -A FOO:BAR, --arg FOO:BAR    Arbitrary argument to POE::Component::IRC
   -C FOO, --class FOO          Component class, e.g. State or Qnet::State
   -I FOO, --lib FOO            A Perl library directory to include
   -l FOO, --log-file FOO       Write status messages to this log file
   -F FOO, --pid-file FOO       Use this file as a pid file

When you specify a pid file with B<-F>, pocoirc will refuse to run if the pid
file already exists.

Arguments to the B<-j> option can be a channel name (e.g. '#foo') or a channel
name and a password separated by a comma (e.g. '#foo,bar'). If you specify
any channels, an L<AutoJoin|POE::Component::IRC::Plugin::AutoJoin> plugin with
these parameters will be added to your IRC component.

When you use the B<-N> option, a
L<NickServID|POE::Component::IRC::Plugin::NickServID> plugin will be added
for you with the supplied password.

Arguments to the B<-a> option should consist of the class name (the
"POE::Component::IRC::Plugin::" prefix can be omitted if it applies), zero
or more whitespace, and optionally a JSON hash of arguments to the plugin's
constructor:

 -a AutoJoin
 -a 'AutoJoin{"ReJoinOnKick":0}'
 -a 'AutoJoin{"ReJoinOnKick":0,"Channels":["#foo","#bar"]}'
 -a 'AutoJoin {"ReJoinOnKick": 0, "Channels": ["#foo", "#bar"]}'

For documentation of the configuration file, do "perldoc
L<App::Pocoirc|App::Pocoirc>".

=head1 AUTHOR

Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com

=head1 LICENSE AND COPYRIGHT

Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson

This program is free software, you can redistribute it and/or modify



( run in 1.961 second using v1.01-cache-2.11-cpan-d8267643d1d )