File Coverage

blib/lib/Language/Befunge/lib/ROMA.pm
Criterion Covered Total %
statement 11 17 64.7
branch n/a
condition n/a
subroutine 5 11 45.4
pod 8 8 100.0
total 24 36 66.6


line stmt bran cond sub pod time code
1             #
2             # This file is part of Language-Befunge
3             #
4             # This software is copyright (c) 2003 by Jerome Quelin.
5             #
6             # This is free software; you can redistribute it and/or modify it under
7             # the same terms as the Perl 5 programming language system itself.
8             #
9 1     1   3 use strict;
  1         1  
  1         27  
10 1     1   3 use warnings;
  1         1  
  1         48  
11              
12             package Language::Befunge::lib::ROMA;
13             #ABSTRACT: Roman numerals extension
14             $Language::Befunge::lib::ROMA::VERSION = '5.000';
15 1     1   4 use Language::Befunge::Vector;
  1         2  
  1         8  
16              
17 1     1 1 3 sub new { return bless {}, shift; }
18              
19             # -- roman numbers
20              
21             #
22             # push the corresponding value onto the stack:
23             # - M: 1000
24             # - D: 500
25             # - C: 100
26             # - L: 50
27             # - X: 10
28             # - V: 5
29             # - I: 1
30             #
31 0     0 1 0 sub C { $_[1]->get_curip->spush(100); }
32 0     0 1 0 sub D { $_[1]->get_curip->spush(500); }
33 0     0 1 0 sub I { $_[1]->get_curip->spush(1); }
34 0     0 1 0 sub L { $_[1]->get_curip->spush(50); }
35 1     1 1 4 sub M { $_[1]->get_curip->spush(1000); }
36 0     0 1   sub V { $_[1]->get_curip->spush(5); }
37 0     0 1   sub X { $_[1]->get_curip->spush(10); }
38              
39              
40             1;
41              
42             __END__