aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lib/Test/Irssi.pm
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-02-21 01:58:22 +0000
committerTom Feist <shabble@metavore.org>2011-02-21 01:58:22 +0000
commit71c173db56f8e462fbaa8c0472788c04982478db (patch)
treecb47d04905cc897be7e3d90d39d0c971e7d5184d /testing/lib/Test/Irssi.pm
parentmodified gitignore to ignore compilation products from modules/ subdirs (diff)
downloadirssi-scripts-71c173db56f8e462fbaa8c0472788c04982478db.tar.gz
irssi-scripts-71c173db56f8e462fbaa8c0472788c04982478db.zip
start of makign this a proper module
Diffstat (limited to '')
-rw-r--r--testing/lib/Test/Irssi.pm90
1 files changed, 90 insertions, 0 deletions
diff --git a/testing/lib/Test/Irssi.pm b/testing/lib/Test/Irssi.pm
new file mode 100644
index 0000000..cb350ee
--- /dev/null
+++ b/testing/lib/Test/Irssi.pm
@@ -0,0 +1,90 @@
+use strictures 1;
+use MooseX::Declare
+
+our $VERSION = 0.01;
+
+class Test::Irssi {
+
+ use Term::VT102;
+ use Term::Terminfo;
+ use feature qw/say switch/;
+ use Data::Dump;
+ use IO::File;
+
+ has 'irssi_binary'
+ => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+ );
+
+ has 'irssi_homedir'
+ => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+ );
+
+ has 'terminal_width'
+ => (
+ is => 'ro',
+ isa => 'Int',
+ required => 1,
+ default => 80,
+ );
+
+ has 'terminal_height'
+ => (
+ is => 'ro',
+ isa => 'Int',
+ required => 1,
+ default => 24,
+ );
+
+ has 'logfile'
+ => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+ default => 'irssi-test.log',
+ );
+
+ has '_logfile_fh'
+ => (
+ is => 'ro',
+ isa => 'IO::File',
+ required => 1,
+ lazy => 1,
+ builder => '_build_logfile_fh',
+ );
+
+
+ method _build_logfile_fh {
+ my $fh = IO::File->new($self->logfile, 'w');
+ die "Couldn't open $logfile for writing: $!" unless defined $fh;
+ $fh->autoflush(1);
+
+ return $fh;
+ }
+
+
+
+
+
+ method log (Str $msg) {
+ say $self->_logfile_fh $msg;
+ }
+}
+__END__
+
+=head1 NAME
+
+Test::Irssi
+
+=head1 ABSTRACT
+
+Abstract goes here
+
+=head1 SYNOPSIS
+
+blah blah blah