nobody is really working on xs accessors anymore
[gitmo/Moose.git] / lib / Moose / Cookbook / Basics / Recipe5.pod
index 5967bf0..d381182 100644 (file)
@@ -1,23 +1,22 @@
+package Moose::Cookbook::Basics::Recipe5;
+
+# ABSTRACT: More subtypes, coercion in a B<Request> class
+
+__END__
+
 
 =pod
 
 =begin testing-SETUP
 
-BEGIN {
-    eval 'use HTTP::Headers; use Params::Coerce; use URI;';
-    if ($@) {
-        diag 'HTTP::Headers, Params::Coerce & URI required for this test';
-        ok(1);
-        exit 0;
-    }
-}
+use Test::Requires {
+    'HTTP::Headers'  => '0',
+    'Params::Coerce' => '0',
+    'URI'            => '0',
+};
 
 =end testing-SETUP
 
-=head1 NAME
-
-Moose::Cookbook::Basics::Recipe5 - More subtypes, coercion in a B<Request> class
-
 =head1 SYNOPSIS
 
   package Request;
@@ -206,21 +205,6 @@ opposed to from a plain C<ArrayRef>
 
 =back
 
-=head1 AUTHORS
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Dave Rolsky E<lt>autarch@urth.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2006-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
 =begin testing
 
 my $r = Request->new;
@@ -260,25 +244,43 @@ isa_ok( $r, 'Request' );
     is( $header4->content_type, 'application/pdf',
         '... got the right content type in the header' );
 
-    dies_ok {
-        $r->headers('Foo');
-    }
-    '... dies when it gets bad params';
+    isnt(
+        exception {
+            $r->headers('Foo');
+        },
+        undef,
+        '... dies when it gets bad params'
+    );
 }
 
 {
     is( $r->protocol, undef, '... got nothing by default' );
 
-    lives_ok {
-        $r->protocol('HTTP/1.0');
-    }
-    '... set the protocol correctly';
+    is(
+        exception {
+            $r->protocol('HTTP/1.0');
+        },
+        undef,
+        '... set the protocol correctly'
+    );
+
     is( $r->protocol, 'HTTP/1.0', '... got nothing by default' );
 
-    dies_ok {
-        $r->protocol('http/1.0');
-    }
-    '... the protocol died with bar params correctly';
+    isnt(
+        exception {
+            $r->protocol('http/1.0');
+        },
+        undef,
+        '... the protocol died with bar params correctly'
+    );
+}
+
+{
+    $r->base('http://localhost/');
+    isa_ok( $r->base, 'URI' );
+
+    $r->uri('http://localhost/');
+    isa_ok( $r->uri, 'URI' );
 }
 
 =end testing