view release on metacpan or search on metacpan
- Add debug opt to Bot::Cobalt::Conf constructor. Pass our --debug value
to Conf as well (in bin/cobalt2 and Plugin::Rehash).
- Bot::Cobalt::Serializer should complain when freeze() or thaw() are
given no data.
- Improved ::Core log object handling. Create initial log object at
construction-time (not Syndicator start time) and ensure that
replacement log objects can handle log methods in use in the core set.
- Use Try::Tiny in place of previous block evals and $@ checks.
- Depend on newer POE::Component::Client::HTTP and
POE::Component::Resolver. Systems with older Components that happened
to grab newer Socket::GetAddrInfo would produce failures due to
Socket::GetAddrInfo API changes -- newer POE bits make use of newer
Socket.pm and drop the GetAddrInfo dependency entirely.
...Not technically "our problem" but this makes my life less annoying
on a couple machines :-)
- Some POD improvements and widely expanded tests.
"Net::IP::Minimal" : "0.04",
"POE" : "1.3",
"POE::Component::Client::DNS" : "0",
"POE::Component::Client::HTTP" : "0.947",
"POE::Component::Client::Keepalive" : "0",
"POE::Component::IRC" : "6.78",
"POE::Component::Resolver" : "0.920",
"POE::Component::Syndicator" : "0.06",
"Path::Tiny" : "0.05",
"Proc::PID::File" : "1.26",
"Try::Tiny" : "0",
"Type::Tiny" : "0.04",
"Types::Path::Tiny" : "0.005",
"URI::Escape" : "0",
"YAML::XS" : "0.34",
"perl" : "v5.12.1",
"strictures" : "2"
}
},
"test" : {
"recommends" : {
Net::IP::Minimal: '0.04'
POE: '1.3'
POE::Component::Client::DNS: '0'
POE::Component::Client::HTTP: '0.947'
POE::Component::Client::Keepalive: '0'
POE::Component::IRC: '6.78'
POE::Component::Resolver: '0.920'
POE::Component::Syndicator: '0.06'
Path::Tiny: '0.05'
Proc::PID::File: '1.26'
Try::Tiny: '0'
Type::Tiny: '0.04'
Types::Path::Tiny: '0.005'
URI::Escape: '0'
YAML::XS: '0.34'
perl: v5.12.1
strictures: '2'
resources:
repository: git://github.com/avenj/bot-cobalt.git
version: '0.021003'
x_serialization_backend: 'YAML::Tiny version 1.69'
Makefile.PL view on Meta::CPAN
"Net::IP::Minimal" => "0.04",
"POE" => "1.3",
"POE::Component::Client::DNS" => 0,
"POE::Component::Client::HTTP" => "0.947",
"POE::Component::Client::Keepalive" => 0,
"POE::Component::IRC" => "6.78",
"POE::Component::Resolver" => "0.920",
"POE::Component::Syndicator" => "0.06",
"Path::Tiny" => "0.05",
"Proc::PID::File" => "1.26",
"Try::Tiny" => 0,
"Type::Tiny" => "0.04",
"Types::Path::Tiny" => "0.005",
"URI::Escape" => 0,
"YAML::XS" => "0.34",
"strictures" => 2
},
"TEST_REQUIRES" => {
"Capture::Tiny" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
Makefile.PL view on Meta::CPAN
"POE::Component::Client::DNS" => 0,
"POE::Component::Client::HTTP" => "0.947",
"POE::Component::Client::Keepalive" => 0,
"POE::Component::IRC" => "6.78",
"POE::Component::Resolver" => "0.920",
"POE::Component::Syndicator" => "0.06",
"Path::Tiny" => "0.05",
"Proc::PID::File" => "1.26",
"Test::File::ShareDir" => 0,
"Test::More" => "0.88",
"Try::Tiny" => 0,
"Type::Tiny" => "0.04",
"Types::Path::Tiny" => "0.005",
"URI::Escape" => 0,
"YAML::XS" => "0.34",
"strictures" => 2
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
requires "Path::Tiny" => "0.05";
requires "POE" => "1.3";
requires "POE::Component::Resolver" => "0.920";
requires "POE::Component::Client::HTTP" => "0.947";
requires "POE::Component::Client::Keepalive" => "0";
requires "POE::Component::Client::DNS" => "0";
requires "POE::Component::IRC" => "6.78";
requires "POE::Component::Syndicator" => "0.06";
requires "Proc::PID::File" => "1.26";
requires "Try::Tiny" => "0";
requires "Type::Tiny" => "0.04";
requires "Types::Path::Tiny" => "0.005";
requires "URI::Escape" => "0";
requires "YAML::XS" => "0.34";
recommends "POE::Component::SSLify" => "1.006";
on 'test' => sub {
lib/Bot/Cobalt/Common.pm view on Meta::CPAN
use strictures 2;
use Carp;
use List::Objects::WithUtils;
use Import::Into;
use Bot::Cobalt::Utils ();
use IRC::Utils ();
use Object::Pluggable::Constants ();
use Try::Tiny ();
use Types::Standard ();
use List::Objects::Types ();
our $ImportMap = hash(
string => hash(
'Bot::Cobalt::Utils' => array( qw/
rplprintf
color
glob_to_re
lib/Bot/Cobalt/Common.pm view on Meta::CPAN
@func_pkg_pairs
})
->inflate;
sub import {
my (undef, @items) = @_;
my $target = caller;
feature->import( ':5.10' );
strictures->import::into($target);
Try::Tiny->import::into($target);
my $toimport = hash;
# : or - prefixed tags are valid, everything else is a func/symbol:
my (@tags, @funcs);
for my $item (@items) {
my $maybe_prefix = substr $item, 0, 1;
if ($maybe_prefix eq ':' || $maybe_prefix eq '-') {
push @tags, lc substr $item, 1;
} else {
lib/Bot/Cobalt/Common.pm view on Meta::CPAN
use Bot::Cobalt::Common;
=head1 DESCRIPTION
This is a small exporter module providing easy inclusion of commonly
used tools and constants to make life easier on plugin authors.
L<strictures> are also enabled. This will turn on 'strict' and make (most)
warnings fatal.
L<Try::Tiny> is always imported.
=head2 Exported
=head3 Constants
=over
=item *
PLUGIN_EAT_NONE (L<Object::Pluggable::Constants>)
lib/Bot/Cobalt/Conf/File.pm view on Meta::CPAN
package Bot::Cobalt::Conf::File;
$Bot::Cobalt::Conf::File::VERSION = '0.021003';
use v5.10;
use strictures 2;
use Carp;
use Bot::Cobalt::Common ':types';
use Bot::Cobalt::Serializer;
use Try::Tiny;
use Types::Path::Tiny -types;
use List::Objects::WithUtils;
use List::Objects::Types -types;
use Moo;
with 'Bot::Cobalt::Conf::Role::Reader';
lib/Bot/Cobalt/Conf/Role/Reader.pm view on Meta::CPAN
package Bot::Cobalt::Conf::Role::Reader;
$Bot::Cobalt::Conf::Role::Reader::VERSION = '0.021003';
use Carp;
use strictures 2;
use Try::Tiny;
use Bot::Cobalt::Common -types;
use Bot::Cobalt::Serializer;
use Moo::Role;
has _serializer => (
is => 'ro',
isa => InstanceOf['Bot::Cobalt::Serializer'],
builder => sub { Bot::Cobalt::Serializer->new },
lib/Bot/Cobalt/Core.pm view on Meta::CPAN
use Bot::Cobalt::Common;
use Bot::Cobalt::IRC;
use Bot::Cobalt::Lang;
use Bot::Cobalt::Logger;
use Bot::Cobalt::Core::ContextMeta::Auth;
use Bot::Cobalt::Core::ContextMeta::Ignore;
use Bot::Cobalt::Core::Loader;
use Scalar::Util 'blessed';
use Try::Tiny;
use Path::Tiny;
use Types::Path::Tiny -types;
use Moo;
has cfg => (
required => 1,
is => 'rw',
isa => InstanceOf['Bot::Cobalt::Conf'],
lib/Bot/Cobalt/Core/Loader.pm view on Meta::CPAN
package Bot::Cobalt::Core::Loader;
$Bot::Cobalt::Core::Loader::VERSION = '0.021003';
use strictures 2;
use Carp;
use Scalar::Util 'blessed';
use Try::Tiny;
sub new { bless [], shift }
sub is_reloadable {
my ($class, $obj) = @_;
confess "is_reloadable() needs a plugin object"
unless $obj and blessed $obj;
$obj->can('NON_RELOADABLE') && $obj->NON_RELOADABLE ?
lib/Bot/Cobalt/Core/Loader.pm view on Meta::CPAN
__END__
=pod
=head1 NAME
Bot::Cobalt::Core::Loader - Object loader/unloader
=head1 SYNOPSIS
use Try::Tiny;
require Bot::Cobalt::Core::Loader;
## Attempt to import a module:
my $plugin_obj = try {
Bot::Cobalt::Core::Loader->load($module_name, @args)
} catch {
# . . . load failed, maybe die with an error . . .
};
## Check reloadable status of a plugin object:
lib/Bot/Cobalt/Error.pm view on Meta::CPAN
## ... same as:
die Bot::Cobalt::Error->new(
"Some errors occured:\n",
join("\n", @errors)
);
}
package CallerPackage;
use Try::Tiny;
try {
SomePackage->some_method();
} catch {
## $error isa Bot::Cobalt::Error
my $error = $_;
## Stringifies to the error string:
warn "$error\n";
};
lib/Bot/Cobalt/Frontend/RC.pm view on Meta::CPAN
package Bot::Cobalt::Frontend::RC;
$Bot::Cobalt::Frontend::RC::VERSION = '0.021003';
use strictures 2;
use Carp;
use Cwd ();
use File::Spec ();
use Try::Tiny;
use Bot::Cobalt::Serializer;
use parent 'Exporter::Tiny';
our @EXPORT_OK = qw/
rc_read
rc_write
/;
lib/Bot/Cobalt/IRC/Role/AdminCmds.pm view on Meta::CPAN
package Bot::Cobalt::IRC::Role::AdminCmds;
$Bot::Cobalt::IRC::Role::AdminCmds::VERSION = '0.021003';
use strictures 2;
use Scalar::Util 'reftype';
use Bot::Cobalt;
use Bot::Cobalt::Common;
use Try::Tiny;
use Moo::Role;
sub Bot_public_cmd_server {
my ($self, $core) = splice @_, 0, 2;
my $msg = ${ $_[0] };
my $context = $msg->context;
my $src_nick = $msg->src_nick;
lib/Bot/Cobalt/Lang.pm view on Meta::CPAN
use Carp;
use Bot::Cobalt::Common qw/:types/;
use Bot::Cobalt::Serializer;
use File::ShareDir 'dist_dir';
use Types::Path::Tiny -types;
use Path::Tiny;
use Try::Tiny;
use Moo;
## Configurable:
has lang_dir => (
# BUILD dies without me or absolute_path (unless use_core_only => 1)
lazy => 1,
is => 'ro',
isa => Dir,
lib/Bot/Cobalt/Logger/Output.pm view on Meta::CPAN
package Bot::Cobalt::Logger::Output;
$Bot::Cobalt::Logger::Output::VERSION = '0.021003';
use Carp;
use strictures 2;
use Bot::Cobalt::Common qw/:types :string/;
use POSIX ();
use Try::Tiny;
use Moo;
has time_format => (
is => 'rw',
isa => Str,
builder => sub { "%Y-%m-%d %H:%M:%S" }, # strftime
);
has log_format => (
lib/Bot/Cobalt/Plugin/Auth.pm view on Meta::CPAN
use Bot::Cobalt;
use Bot::Cobalt::Common;
use Bot::Cobalt::Error;
use Bot::Cobalt::Serializer;
use Scalar::Util 'reftype';
use Storable 'dclone';
use Try::Tiny;
use File::Spec;
### Constants, mostly for internal retvals:
sub ACCESS_LIST() { 0 }
sub DB_PATH() { 1 }
sub new {
lib/Bot/Cobalt/Plugin/Extras/CPAN.pm view on Meta::CPAN
use Bot::Cobalt;
use Bot::Cobalt::Common;
use Bot::Cobalt::Serializer;
our $Serializer = Bot::Cobalt::Serializer->new('JSON');
use HTTP::Request;
use Module::CoreList;
use Try::Tiny;
our $HelpText
= 'try: dist, latest, tests, abstract, changes, belongs, license';
## FIXME cachedb?
sub new { bless [], shift }
sub Cobalt_register {
my ($self, $core) = splice @_, 0, 2;
lib/Bot/Cobalt/Plugin/RDB/Database.pm view on Meta::CPAN
use Bot::Cobalt::DB;
use Bot::Cobalt::Error;
use Bot::Cobalt::Utils qw/ glob_to_re_str /;
use Bot::Cobalt::Plugin::RDB::SearchCache;
use Path::Tiny;
use List::Util qw/shuffle/;
use Time::HiRes;
use Try::Tiny;
sub new {
my $self = {};
my $class = shift;
bless $self, $class;
my %opts = @_;
my $core;
lib/Bot/Cobalt/Serializer.pm view on Meta::CPAN
=head1 DESCRIPTION
Various pieces of L<Bot::Cobalt> need to read and write serialized perl data
from/to disk.
This simple OO frontend makes it trivially easy to work with a selection of
serialization formats, automatically enabling Unicode encode/decode and
optionally providing the ability to read/write files directly.
Errors will typically throw fatal exceptions (usually with a stack
trace) via L<Carp/confess> -- you may want to look into L<Try::Tiny> for
handling them cleanly.
=head1 METHODS
=head2 new
my $serializer = Bot::Cobalt::Serializer->new;
my $serializer = Bot::Cobalt::Serializer->new( $format );
my $serializer = Bot::Cobalt::Serializer->new( %opts );
t/00-report-prereqs.dd view on Meta::CPAN
'Net::IP::Minimal' => '0.04',
'POE' => '1.3',
'POE::Component::Client::DNS' => '0',
'POE::Component::Client::HTTP' => '0.947',
'POE::Component::Client::Keepalive' => '0',
'POE::Component::IRC' => '6.78',
'POE::Component::Resolver' => '0.920',
'POE::Component::Syndicator' => '0.06',
'Path::Tiny' => '0.05',
'Proc::PID::File' => '1.26',
'Try::Tiny' => '0',
'Type::Tiny' => '0.04',
'Types::Path::Tiny' => '0.005',
'URI::Escape' => '0',
'YAML::XS' => '0.34',
'perl' => 'v5.12.1',
'strictures' => '2'
}
},
'test' => {
'recommends' => {
t/01_utils/08_error.t view on Meta::CPAN
use Test::More tests => 20;
use strict; use warnings;
use Try::Tiny;
use_ok( 'Bot::Cobalt::Error' );
my $obj = new_ok( 'Bot::Cobalt::Error' => [
"SOME_ERROR"
],
);
cmp_ok( $obj, 'eq', 'SOME_ERROR', 'Stringification seems to work' );
t/02_logger/01_output_file.t view on Meta::CPAN
use Test::More;
use strict; use warnings;
use Path::Tiny;
use Try::Tiny;
my $this_class = 'Bot::Cobalt::Logger::Output::File';
my $test_log_path = Path::Tiny->tempfile(CLEANUP => 1);
use_ok( $this_class );
eval {; $this_class->new };
ok $@, 'new() with no args dies';
t/02_logger/03_output.t view on Meta::CPAN
use Test::More;
use strict; use warnings FATAL => 'all';
use Path::Tiny;
use Try::Tiny;
my $this_class = 'Bot::Cobalt::Logger::Output';
my $test_log_path = Path::Tiny->tempfile(CLEANUP => 1);
use_ok( $this_class );
my $output = new_ok( $this_class );
ok( $output->time_format, 'has time_format' );
t/02_logger/04_logger.t view on Meta::CPAN
use Test::More;
use strict; use warnings;
use Path::Tiny;
use Try::Tiny;
my $this_class = 'Bot::Cobalt::Logger';
my $test_log_path = Path::Tiny->tempfile(CLEANUP => 1);
use_ok( $this_class );
eval {; $this_class->new };
ok $@, 'new() with no args dies';
t/04_core/02_lang.t view on Meta::CPAN
RDB_ITEM_INFO
RDB_UNLINK_FAILED
/ ],
);
BEGIN {
use_ok( 'Bot::Cobalt::Lang' );
}
use Try::Tiny;
use File::Spec;
my $langdir = File::Spec->catdir( 'share', 'etc', 'langs' );
## Should die:
try {
Bot::Cobalt::Lang->new(
lang => 'somelang',
);
} catch {
t/07_plugins/04_rdb_database.t view on Meta::CPAN
use Test::More tests => 22;
use strict; use warnings;
use Fcntl ':flock';
use Try::Tiny;
use Path::Tiny;
BEGIN {
use_ok( 'Bot::Cobalt::Conf' );
use_ok( 'Bot::Cobalt::Core' );
use_ok( 'Bot::Cobalt::Plugin::RDB::Database' );
}
my $tempdir = Path::Tiny->tempdir(CLEANUP => 1);
my $etcdir = path( 'share/etc' );