Permalink
Browse files

Can't print fatal unknown objects, either.

  • Loading branch information...
1 parent 07ed579 commit 4e8dc96342fa7eee9a7f577b90daef27cc7cf3bf Ovid committed Feb 21, 2013
Showing with 12 additions and 2 deletions.
  1. +1 −1 dist.ini
  2. +3 −1 lib/Unknown/Values/Instance.pm
  3. +5 −0 lib/Unknown/Values/Instance/Fatal.pm
  4. +3 −0 t/fatal.t
View
@@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Curtis "Ovid" Poe
copyright_year = 2013
-version = 0.004
+version = 0.005
[@Basic]
[@Git]
@@ -26,7 +26,9 @@ BEGIN {
}
}
-use overload @to_overload, '""' => sub {'[unknown]'};
+use overload @to_overload, '""' => 'to_string';
+
+sub to_string { '[unknown]' }
sub new {
my $class = shift;
@@ -15,8 +15,13 @@ sub compare {
confess("Comparison operations not allowed with 'fatal unknown' objects");
}
+
sub sort {
confess("Sorting operations not allowed with 'fatal unknown' objects");
}
+sub to_string {
+ confess("Printing not allowed with 'fatal unknown' objects");
+}
+
1;
View
@@ -16,5 +16,8 @@ qr/Boolean operations not allowed with 'fatal unknown' objects/,
throws_ok { my @foo = sort ( 1, unknown, 2 ) }
qr/Sorting operations not allowed with 'fatal unknown' objects/,
'... or sorting operations';
+throws_ok { print unknown }
+qr/Printing not allowed with 'fatal unknown' objects/,
+ '... or printing unknown values';
done_testing;

0 comments on commit 4e8dc96

Please sign in to comment.