<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>xt/author/critic.t</filename>
    </added>
    <added>
      <filename>xt/perlcriticrc</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 Revision history for Perl extension Image::TextMode.
 
+0.06  XXX
+    - conform to Perl::Critic policies
+
 0.05  Fri Feb 13 2009
     - tidy up ANSI and ANSIMation write() to only write the columns needed
     - add basic RLE encoding to ANSI and ANSIMation write()</diff>
      <filename>Changes</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ package Image::TextMode;
 use strict;
 use warnings;
 
-our $VERSION = '0.05';
+our $VERSION = '0.06';
 
 =head1 NAME
 </diff>
      <filename>lib/Image/TextMode.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,11 @@
 package Image::TextMode::Animation;
 
 use Moose;
-require Class::MOP;
+use Symbol ();
 
 BEGIN {
     for my $sub ( qw( getpixel getpixel_obj putpixel clear_screen clear_line ) ) {
-        no strict 'refs';
-        *{ __PACKAGE__ . &quot;\::$sub&quot; } = sub {
+        *{ Symbol::qualify_to_ref( __PACKAGE__ . &quot;\::$sub&quot; ) } = sub {
             shift-&gt;frames-&gt;[ -1 ]-&gt;$sub( @_ );
         }
     }
@@ -16,6 +15,11 @@ BEGIN {
 
 Image::TextMode::Animation - A base class for text mode animation file formats
 
+=head1 DESCRIPTION
+
+This class should be used for any format that requires a sequence of frames
+for display.
+
 =head1 ACCESSORS
 
 =over 4</diff>
      <filename>lib/Image/TextMode/Animation.pm</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,11 @@ use Image::TextMode::Pixel;
 
 Image::TextMode::Canvas - A canvas of text mode pixels
 
+=head1 DESCRIPTION
+
+This module represents the graphical portion of an image, i.e. a grid
+of pixels.
+
 =head1 ACCESSORS
 
 =over 4</diff>
      <filename>lib/Image/TextMode/Canvas.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-package Image::TextMode::Font::8x16;
+package Image::TextMode::Font::8x16; ## no critic (Modules::RequireFilenameMatchesPackage)
 
 use Moose;
 </diff>
      <filename>lib/Image/TextMode/Font/8x16.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-package Image::TextMode::Font::8x8;
+package Image::TextMode::Font::8x8; ## no critic (Modules::RequireFilenameMatchesPackage)
 
 use Moose;
 </diff>
      <filename>lib/Image/TextMode/Font/8x8.pm</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,12 @@ use Image::TextMode::Canvas;
 
 Image::TextMode::Format - A base class for text mode file formats
 
+=head1 DESCRIPTION
+
+This is a base class for all textmode formats. It provides the basic
+structure for reading and writing, plus provides some defaults for
+common attributes (e.g. font and palette).
+
 =head1 ACCESSORS
 
 =over 4
@@ -56,14 +62,14 @@ sub _build_writer {
 
 sub _xs_or_not {
     my ( $class, $type ) = @_;
-    ( my $result = ( ref $class || $class ) ) =~ s{\bFormat\b}{$type};
+    ( my $name = ( ref $class || $class ) ) =~ s{\bFormat\b}{$type}s;
 
-    my $xs = $result . '::XS';
-    eval { Class::MOP::load_class( $xs ); };
-    return $xs-&gt;new if !$@;
+    my $xs = $name. '::XS';
+    my $result = eval { Class::MOP::load_class( $xs ); };
+    if( $result &amp;&amp; !$@ ) { return $xs-&gt;new; }
 
-    Class::MOP::load_class( $result );
-    return $result-&gt;new;
+    Class::MOP::load_class( $name );
+    return $name-&gt;new;
 }
 
 has 'font' =&gt; (
@@ -100,7 +106,7 @@ Proxies to the reader's C&lt;read()&gt; method.
 
 =cut
 
-sub read {
+sub read { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, @rest ) = @_;
     $self-&gt;reader-&gt;read( $self, @rest );
 }
@@ -111,7 +117,7 @@ Proxies to the writer's C&lt;write()&gt; method.
 
 =cut
 
-sub write {
+sub write { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, @rest ) = @_;
     $self-&gt;writer-&gt;write( $self, @rest );
 }</diff>
      <filename>lib/Image/TextMode/Format.pm</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,11 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Format::ANSI - read and write ANSI files
 
+=head1 DESCRIPTION
+
+ANSI is a text-based image format that uses escape sequences to give the
+parser a particular command.
+
 =head1 METHODS
 
 =head2 new( %args )</diff>
      <filename>lib/Image/TextMode/Format/ANSI.pm</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,13 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Format::ANSIMation - read and write ANSIMation files
 
+=head1 DESCRIPTION
+
+ANSIMation is an pseudo-format whereby the ANSI is displayed at a slow
+enough rate so that it appears to animate the image. This module simulates
+this by assuming a C&lt;position(0,0)&gt; command is the start of a new &quot;frame&quot; in
+the sequence.
+
 =head1 METHODS
 
 =head2 new( %args )</diff>
      <filename>lib/Image/TextMode/Format/ANSIMation.pm</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,13 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Format::Bin - read and write Bin files
 
+=head1 DESCRIPTION
+
+The Bin format is essentially a raw VGA video dump. It is a sequence of
+character and attribute byte pairs. It holds no width information, so any
+images over 80 columns will have to be described in an alternate way (i.e.
+via SAUCE metadata).
+
 =head1 METHODS
 
 =head2 new( %args )</diff>
      <filename>lib/Image/TextMode/Format/Bin.pm</filename>
    </modified>
    <modified>
      <diff>@@ -21,6 +21,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Format::IDF - read and write IDF files
 
+=head1 DESCRIPTION
+
+The IDF format.
+
 =head1 ACCESSORS
 
 =over 4</diff>
      <filename>lib/Image/TextMode/Format/IDF.pm</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Format::Tundra - read and write Tundra files
 
+=head1 DESCRIPTION
+
+The Tundra format.
+
 =head1 ACCESSORS
 
 =over 4</diff>
      <filename>lib/Image/TextMode/Format/Tundra.pm</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,8 @@ use warnings;
 use Module::Pluggable::Object;
 use Image::TextMode::SAUCE;
 
+use Carp 'croak';
+
 sub load {
     my ( $self, @files ) = @_;
     my @result;
@@ -25,16 +27,16 @@ sub load {
             ( $file, $read_options ) = @$file;
         }
 
-        my( $ext ) = $file =~ m{([^.]+?)$};
+        my( $ext ) = $file =~ m{([^.]+?)$}s;
         $ext = lc $ext;
         my $format = $exts{ $ext } || $default;
 
         # if we get ANSI, we need to see if it's ansimation or not from the SAUCE data.
         if( $format eq $default ) {
             my $sauce = Image::TextMode::SAUCE-&gt;new;
-            open( my $fh, $file );
+            open( my $fh, '&lt;', $file ) or croak &quot;Unable to read SAUCE data for '$file': $!&quot;;
             $sauce-&gt;read( $fh );
-            close( $fh );
+            close( $fh ) or croak &quot;Unable to close '$file': $!&quot;;
             if( $sauce-&gt;has_sauce &amp;&amp; $sauce-&gt;filetype eq 'ANSiMation' ) {
                 $format = 'Image::TextMode::Format::ANSIMation';
             }
@@ -56,6 +58,11 @@ Image::TextMode::Loader - Load text mode images by best-guess
 
     my $img = Image::TextMode::Loader-&gt;load( $filename );
 
+=head1 DESCRIPTION
+
+This module allows you to load a set of images without having to explicitly
+specify the format before-hand.
+
 =head1 METHODS
 
 =head2 load( @files )</diff>
      <filename>lib/Image/TextMode/Loader.pm</filename>
    </modified>
    <modified>
      <diff>@@ -71,13 +71,14 @@ should it exist.
 =cut
 
 sub BUILDARGS {
-    my $class   = shift;
+    my( $class, @rest ) = @_;
+
     my $options = {};
-    if ( @_ % 2 != 0 ) {
-        $options = pop;
+    if ( @rest % 2 != 0 ) {
+        $options = pop @rest;
     }
 
-    my %args = @_;
+    my %args = @rest;
     my $attr = delete $args{ attr };
 
     if ( $attr ) {</diff>
      <filename>lib/Image/TextMode/Pixel.pm</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,16 @@ package Image::TextMode::Reader;
 
 use Moose;
 
+use Carp 'croak';
+
 =head1 NAME
 
 Image::TextMode::Reader - A base class for file readers
 
+=head1 DESCRIPTION
+
+This module provides some of the basic functionality for all reader classes.
+
 =head1 METHODS
 
 =head2 new( %args )
@@ -19,7 +25,7 @@ method.
 
 =cut
 
-sub read {
+sub read { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, $image, $fh, $options ) = @_;
     $options ||= {};
     $fh = _get_fh( $fh );
@@ -41,7 +47,7 @@ sub _get_fh {
     my $fh = $file;
     if ( !ref $fh ) {
         undef $fh;
-        open $fh, $file;
+        open $fh, '&lt;', $file or croak &quot;Unable to open '$file': $!&quot;; ## no critic (InputOutput::RequireBriefOpen)
     }
 
     binmode( $fh );</diff>
      <filename>lib/Image/TextMode/Reader.pm</filename>
    </modified>
    <modified>
      <diff>@@ -82,6 +82,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::ADF - Reads ADF files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the ADF format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Reader/ADF.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Image::TextMode::Reader::ANSI;
 
 use Moose;
+use charnames ':full';
 
 extends 'Image::TextMode::Reader';
 
@@ -49,10 +50,10 @@ sub _read {
     while ( read( $fh, $ch, 1 ) ) {
         my $state = $self-&gt;state;
         if ( $state == $S_TXT ) {
-            if ( $ch eq &quot;\x1a&quot; ) {
+            if ( $ch eq &quot;\N{SUBSTITUTE}&quot; ) {
                 $self-&gt;state( $S_END );
             }
-            elsif ( $ch eq &quot;\x1b&quot; ) {
+            elsif ( $ch eq &quot;\N{ESCAPE}&quot; ) {
                 $self-&gt;state( $S_CHK_B );
             }
             elsif ( $ch eq &quot;\n&quot; ) {
@@ -80,8 +81,8 @@ sub _read {
             }
         }
         elsif ( $state == $S_WAIT_LTR ) {
-            if ( $ch =~ /[a-zA-Z]/ ) {
-                my @args = split( /;/, $argbuf );
+            if ( $ch =~ /[a-zA-Z]/s ) {
+                my @args = split( /;/s, $argbuf );
 
                 if ( $ch eq 'm' ) {
                     $self-&gt;set_attributes( @args );
@@ -133,9 +134,9 @@ sub _read {
 }
 
 sub set_position {
-    my $self = shift;
-    my $y    = ( shift || 1 ) - 1;
-    my $x    = ( shift || 1 ) - 1;
+    my( $self, $y, $x ) = @_;
+    $y = ( $y || 1 ) - 1;
+    $x = ( $x || 1 ) - 1;
 
     $y = 0 if $y &lt; 0;
     $x = 0 if $x &lt; 0;
@@ -145,8 +146,7 @@ sub set_position {
 }
 
 sub set_attributes {
-    my $self = shift;
-    my @args = @_;
+    my( $self, @args ) = @_;
 
     foreach ( @args ) {
         if ( $_ == 0 ) {
@@ -287,6 +287,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::ANSI - Reads ANSI files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the ANSI format.
+
 =head1 ACCESSORS
 
 =over 4</diff>
      <filename>lib/Image/TextMode/Reader/ANSI.pm</filename>
    </modified>
    <modified>
      <diff>@@ -6,26 +6,26 @@ use Image::TextMode::Canvas;
 extends 'Image::TextMode::Reader::ANSI';
 
 sub _read {
-    my( $self, $animation ) = ( shift, shift );
+    my( $self, $animation, @args ) = @_;
     $animation-&gt;add_frame( Image::TextMode::Canvas-&gt;new );
-    $self-&gt;SUPER::_read( $animation, @_ );
+    $self-&gt;SUPER::_read( $animation, @args );
 }
 
 sub set_position {
-	my $self = shift;
+	my( $self, @args ) = @_;
 
-	if( ( $_[ 0 ] || 1 ) == 1 &amp;&amp; ( $_[ 1 ] || 1 ) == 1 ) {
+	if( ( $args[ 0 ] || 1 ) == 1 &amp;&amp; ( $args[ 1 ] || 1 ) == 1 ) {
 		$self-&gt;next_frame;
 	}
 
-	$self-&gt;SUPER::set_position( @_ );
+	$self-&gt;SUPER::set_position( @args );
 }
 
 sub next_frame {
 	my $self  = shift;
     my $animation = $self-&gt;image;
 
-	return unless $animation-&gt;frames-&gt;[ -1 ]-&gt;height &gt; 0;
+	return unless $animation-&gt;frames-&gt;[ -1 ]-&gt;height;
 
 	$animation-&gt;add_frame( Image::TextMode::Canvas-&gt;new );
 }
@@ -38,6 +38,12 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::ANSIMation - Reads ANSI Animation files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the ANSIMation format. This module
+extends the ANSI reader, and simply creates a new frame for every
+C&lt;set_position(0,0)&gt; command executed.
+
 =head1 METHODS
 
 =head2 set_position( [$x, $y] )</diff>
      <filename>lib/Image/TextMode/Reader/ANSIMation.pm</filename>
    </modified>
    <modified>
      <diff>@@ -39,6 +39,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::Bin - Reads Bin files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the Bin format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Reader/Bin.pm</filename>
    </modified>
    <modified>
      <diff>@@ -103,6 +103,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::IDF - Reads IDF files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the IDF format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Reader/IDF.pm</filename>
    </modified>
    <modified>
      <diff>@@ -99,6 +99,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::Tundra - Reads Tundra files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the Tundra format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Reader/Tundra.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Image::TextMode::Reader::XBin;
 
 use Moose;
+use Carp 'croak';
 
 extends 'Image::TextMode::Reader';
 
@@ -32,8 +33,8 @@ sub _read {
     my $headerlength = read( $fh, $headerdata, 11 );
 
     # does it start with the right data?
-    die 'Not an XBin file.'
-        unless $headerlength == 11 and $headerdata =~ /^XBIN$eof_char/;
+    croak 'Not an XBin file.'
+        unless $headerlength == 11 and $headerdata =~ m{^XBIN$eof_char}s;
 
     # parse header data
     _read_header( $image, $headerdata );
@@ -195,6 +196,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Reader::XBin - Reads XBin files
 
+=head1 DESCRIPTION
+
+Provides reading capabilities for the XBin format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Reader/XBin.pm</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ package Image::TextMode::Renderer::GD;
 use Moose;
 use GD;
 use Image::TextMode::Palette::ANSI;
+use Carp 'croak';
 
 =head1 NAME
 
@@ -42,7 +43,7 @@ sub thumbnail {
     }
 
     my $image_l = do {
-        local $options-&gt;{ format } = 'object';
+        local $options-&gt;{ format } = 'object'; ## no critic (Variables::ProhibitLocalVar)
         $self-&gt;fullscale( $source, $options );
     };
 
@@ -231,7 +232,7 @@ sub _font_to_gd {
     for my $charval ( 0 .. $font_size ) {
         my $char = $chars-&gt;[ $charval ];
         for ( @$char ) {
-            my @binary = split( //, sprintf( '%08b', $_ ) );
+            my @binary = split( //s, sprintf( '%08b', $_ ) );
 
             if ( $ninth ) {
                 push @binary,
@@ -242,7 +243,7 @@ sub _font_to_gd {
             print $temp pack( 'C*', @binary );
         }
     }
-    close $temp;
+    close $temp or croak &quot;Unable to close temp file: $!&quot;;
 
     return GD::Font-&gt;load( $temp-&gt;filename );
 }</diff>
      <filename>lib/Image/TextMode/Renderer/GD.pm</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,11 @@ my $COMNT_ID      = 'COMNT';
 
 Image::TextMode::SAUCE - Create, manipulate and save SAUCE metadata
 
+=head1 DESCRIPTION
+
+This module reads and writes SAUCE metadata. SAUCE metadata is a 128-byte
+record stored after an EOF char at the end of a given file.
+
 =head1 ACCESSORS
 
 =over 4
@@ -184,7 +189,7 @@ Read the sauce record from C&lt;$fh&gt;.
 
 =cut
 
-sub read {
+sub read { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, $fh ) = @_;
 
     my $buffer;
@@ -219,7 +224,7 @@ sub read {
         if ( substr( $buffer, 0, 5 ) eq $COMNT_ID ) {
             my $template
                 = $comnt_template
-                . ( split( / /, $comnt_template ) )[ 1 ]
+                . ( split( / /s, $comnt_template ) )[ 1 ]
                 x ( $comment_count - 1 );
             my ( $id, @comments ) = unpack( $template, $buffer );
             $self-&gt;comment_id( $id );
@@ -234,7 +239,7 @@ Write the sauce record to C&lt;$fh&gt;.
 
 =cut
 
-sub write {
+sub write { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, $fh ) = @_;
 
     seek( $fh, 0, 2 );
@@ -246,7 +251,7 @@ sub write {
         print $fh pack(
             $comnt_template
                 . (
-                ( split( / /, $comnt_template ) )[ 1 ] x ( $comments - 1 )
+                ( split( / /s, $comnt_template ) )[ 1 ] x ( $comments - 1 )
                 ),
             $self-&gt;comment_id,
             @{ $self-&gt;comments }
@@ -254,7 +259,7 @@ sub write {
     }
 
     # SAUCE...
-    my @template = split( / /, $sauce_template );
+    my @template = split( / /s, $sauce_template );
     for ( 0 .. $#sauce_fields ) {
         my $field = $sauce_fields[ $_ ];
         my $value = ( $field ne 'comments' ) ? $self-&gt;$field : $comments;</diff>
      <filename>lib/Image/TextMode/SAUCE.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,16 @@
 package Image::TextMode::Writer;
 
 use Moose;
+use Carp 'croak';
 
 =head1 NAME
 
 Image::TextMode::Writer - A base class for file writers
 
+=head1 DESCRIPTION
+
+This module provides some of the basic functionality for all writer classes.
+
 =head1 METHODS
 
 =head2 new( %args )
@@ -19,7 +24,7 @@ method.
 
 =cut
 
-sub write {
+sub write { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
     my ( $self, $image, $fh, $options ) = @_;
     $options ||= {};
     $fh = _get_fh( $fh );
@@ -35,7 +40,7 @@ sub _get_fh {
     my $fh = $file;
     if ( !ref $fh ) {
         undef $fh;
-        open $fh, '&gt;', $file;
+        open $fh, '&gt;', $file or croak &quot;Unable to open '$file': $!&quot;; ## no critic (InputOutput::RequireBriefOpen)
     }
 
     binmode( $fh );</diff>
      <filename>lib/Image/TextMode/Writer.pm</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,10 @@ use Moose;
 extends 'Image::TextMode::Writer';
 
 # generates a 64 color palette
+## no critic (BuiltinFunctions::ProhibitComplexMappings)
 my $default_pal = [
     map {
-        my @d = split( //, sprintf( '%06b', $_ ) );
+        my @d = split( //s, sprintf( '%06b', $_ ) );
         {
             [   oct( &quot;0b$d[ 3 ]$d[ 0 ]&quot; ) * 63,
                 oct( &quot;0b$d[ 4 ]$d[ 1 ]&quot; ) * 63,
@@ -16,6 +17,7 @@ my $default_pal = [
         }
         } 0 .. 63
 ];
+## use critic
 
 sub _write {
     my ( $self, $image, $fh, $options ) = @_;
@@ -27,7 +29,7 @@ sub _write {
 
     for my $row ( @{ $image-&gt;pixeldata } ) {
         print $fh
-            join( '', map { pack( 'aC', @{ $_ }{ 'char', 'attr' } ) } @$row );
+            join( '', map { pack( 'aC', @{ $_ }{ qw( char attr ) } ) } @$row );
     }
 }
 
@@ -59,6 +61,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::ADF - Writes ADF files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the ADF format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/ADF.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Image::TextMode::Writer::ANSI;
 
 use Moose;
+use charnames ':full';
 
 extends 'Image::TextMode::Writer';
 
@@ -9,7 +10,7 @@ sub _write {
     my( $width, $height ) = $image-&gt;dimensions;
 
     # clear screen
-    print $fh &quot;\x1b[2J&quot;;
+    print $fh &quot;\N{ESCAPE}[2J&quot;;
 
     my $prevattr = '';
     for my $y ( 0..$height - 1 ) {
@@ -24,7 +25,7 @@ sub _write {
             my $pixel = $image-&gt;getpixel( $x, $y ) || { char =&gt; ' ', attr =&gt; 7 };
             my $attr = _gen_args( $pixel-&gt;{ attr } );
             if( $attr ne $prevattr ) {
-                print $fh &quot;\x1b[0;&quot;, _gen_args( $pixel-&gt;{ attr } ), 'm';
+                print $fh &quot;\N{ESCAPE}[0;&quot;, _gen_args( $pixel-&gt;{ attr } ), 'm';
                 $prevattr = $attr;
             }
             print $fh $pixel-&gt;{ char }; 
@@ -33,7 +34,7 @@ sub _write {
     }
 
     # clear attrs
-    print $fh &quot;\x1b[0m&quot;;
+    print $fh &quot;\N{ESCAPE}[0m&quot;;
 }
 
 sub _gen_args {
@@ -42,7 +43,7 @@ sub _gen_args {
     my $bg = 40 + ( ( $attr &amp; 112 ) &gt;&gt; 4 );
     my $bl = ( $attr &amp; 128 ) ? 5 : '';
     my $in = ( $attr &amp; 8 ) ? 1 : '';
-    return join ( ';', grep { length } ( $bl, $in, $fg, $bg ) ); 
+    return join ( q{;}, grep { length } ( $bl, $in, $fg, $bg ) ); 
 }
 
 no Moose;
@@ -53,6 +54,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::ANSI - Writes ANSI files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the ANSI format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/ANSI.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Image::TextMode::Writer::ANSIMation;
 
 use Moose;
+use charnames ':full';
 
 extends 'Image::TextMode::Writer';
 
@@ -8,7 +9,7 @@ sub _write {
     my ( $self, $anim, $fh, $options ) = @_;
 
     # clear screen
-    print $fh &quot;\x1b[2J&quot;;
+    print $fh &quot;\N{ESCAPE}[2J&quot;;
 
     my $prevattr = '';
     for my $image ( @{ $anim-&gt;frames } ) {
@@ -26,7 +27,7 @@ sub _write {
                 my $pixel = $image-&gt;getpixel( $x, $y ) || { char =&gt; ' ', attr =&gt; 7 };
                 my $attr = _gen_args( $pixel-&gt;{ attr } );
                 if( $attr ne $prevattr ) {
-                    print $fh &quot;\x1b[0;&quot;, _gen_args( $pixel-&gt;{ attr } ), 'm';
+                    print $fh &quot;\N{ESCAPE}[0;&quot;, _gen_args( $pixel-&gt;{ attr } ), 'm';
                     $prevattr = $attr;
                 }
                 print $fh $pixel-&gt;{ char }; 
@@ -36,12 +37,12 @@ sub _write {
 
         # set position
         if( $image ne $anim-&gt;frames-&gt;[ -1 ] ) {
-            print $fh &quot;\x1b[H&quot;;
+            print $fh &quot;\N{ESCAPE}[H&quot;;
         }
     }
 
     # clear attrs
-    print $fh &quot;\x1b[0m&quot;;
+    print $fh &quot;\N{ESCAPE}[0m&quot;;
 }
 
 sub _gen_args {
@@ -50,7 +51,7 @@ sub _gen_args {
     my $bg = 40 + ( ( $attr &amp; 112 ) &gt;&gt; 4 );
     my $bl = ( $attr &amp; 128 ) ? 5 : '';
     my $in = ( $attr &amp; 8 ) ? 1 : '';
-    return join ( ';', grep { length } ( $bl, $in, $fg, $bg ) ); 
+    return join ( q{;}, grep { length } ( $bl, $in, $fg, $bg ) ); 
 }
 
 no Moose;
@@ -61,6 +62,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::ANSIMation - Writes ANSIMation files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the ANSIMation format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/ANSIMation.pm</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ sub _write {
 
     for my $row ( @{ $image-&gt;pixeldata } ) {
         print $fh
-            join( '', map { pack( 'aC', @{ $_ }{ 'char', 'attr' } ) } @$row );
+            join( '', map { pack( 'aC', @{ $_ }{ qw( char attr ) } ) } @$row );
     }
 }
 
@@ -21,6 +21,10 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::Bin - Writes Bin files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the Bin format.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/Bin.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Image::TextMode::Writer::IDF;
 
 use Moose;
+use charnames ':full';
 
 extends 'Image::TextMode::Writer';
 
@@ -11,7 +12,7 @@ sub _write {
 
     my( $max_x, $max_y ) = map { $_ - 1 } $image-&gt;dimensions;
 
-    print $fh pack( $header_template, &quot;\x041.4&quot;, 0, 0, $max_x, $max_y);
+    print $fh pack( $header_template, &quot;\N{END OF TRANSMISSION}1.4&quot;, 0, 0, $max_x, $max_y);
 
     # Don't bother with RLE compression for now
     for my $y ( 0..$max_y ) {
@@ -38,6 +39,11 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::IDF - Writes IDF files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the IDF format. It currently does not
+support any RLE compression.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/IDF.pm</filename>
    </modified>
    <modified>
      <diff>@@ -40,6 +40,11 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::Tundra - Writes Tundra files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the Tundra format. It currently does not
+support any RLE compression.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/Tundra.pm</filename>
    </modified>
    <modified>
      <diff>@@ -40,6 +40,11 @@ __PACKAGE__-&gt;meta-&gt;make_immutable;
 
 Image::TextMode::Writer::XBin - Writes XBin files
 
+=head1 DESCRIPTION
+
+Provides writing capabilities for the XBin format. It currently only
+supports uncompressed XBin files.
+
 =head1 AUTHOR
 
 Brian Cassidy E&lt;lt&gt;bricas@cpan.orgE&lt;gt&gt;</diff>
      <filename>lib/Image/TextMode/Writer/XBin.pm</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ use Image::TextMode::Loader;
 use Image::TextMode::Renderer::GD;
 use Getopt::Long ();
 use Pod::Usage   ();
+use Carp 'croak';
 
 my %options;
 my $result = Getopt::Long::GetOptions(
@@ -25,29 +26,43 @@ if ( !@files || $options{ help } ) {
 my $read_options   = $options{ readopts };
 my $render_options = $options{ renderopt };
 my $method         = $options{ thumbnail } ? 'thumbnail' : 'fullscale';
-my $force_filename = ( @files &gt; 1 or !$options{ output } ) ? 1 : 0;
+my $force_filename = ( @files &gt; 1 || !$options{ output } ) ? 1 : 0;
 my $renderer       = Image::TextMode::Renderer::GD-&gt;new;
 
 my ( $font, $pal ) = @options{ qw( font pal ) };
 if ( $font ) {
     my $class = &quot;Image::TextMode::Font::${font}&quot;;
-    eval &quot;use $class;&quot;;
+    my $return = eval &quot;use $class;&quot;;
+
+    if( !$return &amp;&amp; $@ ) {
+        croak &quot;Unable to load font '$font'&quot;;
+    }
+
     $font = $class-&gt;new;
 }
 if ( $pal ) {
     my $class = &quot;Image::TextMode::Palette::${pal}&quot;;
-    eval &quot;use $class;&quot;;
+    my $return = eval &quot;use $class;&quot;;
+
+    if( !$return &amp;&amp; $@ ) {
+        croak &quot;Unable to load palette '$pal'&quot;;
+    }
+
     $pal = $class-&gt;new;
 }
 
 for my $file ( @files ) {
-    die 'file not found'    if !-e $file;
-    die 'file not readable' if !-r $file;
+    croak &quot;file not found: '$file'&quot;    if !-e $file;
+    croak &quot;file not readable: '$file'&quot; if !-r $file;
 
     my $image;
     if ( my $format = $options{ inputformat } ) {
         my $package = &quot;Image\::TextMode\::Format\::${format}&quot;;
-        eval &quot;use $package;&quot;;
+        my $return = eval &quot;use $package;&quot;;
+
+        if( !$return &amp;&amp; $@ ) {
+            croak &quot;Unable to load format '$format'&quot;;
+        }
 
         $image = $package-&gt;new;
         $image-&gt;read( $file, $read_options );
@@ -60,12 +75,12 @@ for my $file ( @files ) {
     if ( $force_filename ) {
         $output
             = $file
-            . ( $options{ thumbnail } ? '.t' : '' ) . '.'
+            . ( $options{ thumbnail } ? q{.t} : '' ) . q{.}
             . ( $options{ outputformat } || 'png' );
     }
 
-    $output =~ s{[^.]+?$}{gif}
-        if $output ne '-'
+    $output =~ s{[^.]+?$}{gif}s
+        if $output ne q{-}
             &amp;&amp; $image-&gt;isa( 'Image::TextMode::Format::ANSIMation' );
 
     $image-&gt;font( $font )   if $font;
@@ -73,13 +88,13 @@ for my $file ( @files ) {
 
     my $data = $renderer-&gt;$method( $image, $render_options );
 
-    if ( $output eq '-' ) {
+    if ( $output eq q{-} ) {
         print $data;
     }
     else {
-        open( my $fh, '&gt;', $output ) or die &quot;cannot write file ($output): $!&quot;;
+        open( my $fh, '&gt;', $output ) or croak &quot;Unable to open file '$output': $!&quot;;
         print $fh $data;
-        close( $fh );
+        close( $fh ) or croak &quot;Unable to close file '$output': $!&quot;;
     }
 }
 </diff>
      <filename>script/textmode2png</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>def1fa3392fc944c0242952ab59324ac026058b6</id>
    </parent>
  </parents>
  <author>
    <name>Brian Cassidy</name>
    <email>bricas@cpan.org</email>
  </author>
  <url>http://github.com/bricas/image-textmode/commit/0889b780fb657359c3494dbc85c200d8434b6e90</url>
  <id>0889b780fb657359c3494dbc85c200d8434b6e90</id>
  <committed-date>2009-02-16T18:11:07-08:00</committed-date>
  <authored-date>2009-02-16T18:11:07-08:00</authored-date>
  <message>conform to Perl::Critic policies. added xt/author test for it.</message>
  <tree>41b646a08984c4b9271aa9db5b035b899eeceb32</tree>
  <committer>
    <name>Brian Cassidy</name>
    <email>bricas@cpan.org</email>
  </committer>
</commit>
