Roman-1.24000755000000000000 012474677621 13063 5ustar00unknownunknown000000000000Changes000644000000000000 142512474677222 14435 0ustar00unknownunknown000000000000Roman-1.24Revision history for Perl module Roman 1.24 2015-03-01 CHORNY - Added SEE ALSO section with links to similar modules. - Reformatted this file as per CPAN::Changes::Spec - Improved wording of the abstract 1.23 2008-12-18 CHORNY - Minimum Perl version required in META.yml - Perl 21st birthday version 1.22 2007-12-21 CHORNY - Require a new version of Exporter - Perl 20th birthday version 1.21 2007-11-26 CHORNY - Requires 5.006 instead of 5.6.0. - Do not subclass Exporter 1.20 2007-03-09 CHORNY - Same as 1.10_01 1.10_01 2007-03-06 CHORNY - Rewrite by Alexandr Ciornii 1.1 1997-09-03 OZAWA - Author's address is now 1.0 1995-09-01 OZAWA - First version released to CPAN Makefile.PL000644000000000000 417712474677561 15131 0ustar00unknownunknown000000000000Roman-1.24use 5.006; use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile1( NAME => 'Roman', AUTHOR => 'Alexandr Ciornii ', VERSION_FROM => 'lib/Roman.pm', ABSTRACT_FROM => 'lib/Roman.pm', PL_FILES => {}, PREREQ_PM => { 'Exporter' => 5.57, }, TEST_REQUIRES => { 'Test::More' => 0, }, 'LICENSE' => 'perl', 'MIN_PERL_VERSION' => 5.006, META_MERGE => { resources => { repository => 'http://github.com/chorny/Roman', }, keywords => ['roman numbers',], }, $^O =~/win/i ? ( dist => { TAR => 'ptar', TARFLAGS => '-c -C -f', }, ) : (), clean => { FILES => 'Roman-*' }, ); sub WriteMakefile1 { #Compatibility code for old versions of EU::MM. Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade. my %params=@_; my $eumm_version=$ExtUtils::MakeMaker::VERSION; $eumm_version=eval $eumm_version; die "EXTRA_META is deprecated" if exists $params{EXTRA_META}; die "License not specified" if not exists $params{LICENSE}; if ($params{AUTHOR} and ref($params{AUTHOR}) eq 'ARRAY' and $eumm_version < 6.5705) { $params{META_ADD}->{author}=$params{AUTHOR}; $params{AUTHOR}=join(', ',@{$params{AUTHOR}}); } if ($params{TEST_REQUIRES} and $eumm_version < 6.64) { $params{BUILD_REQUIRES}={ %{$params{BUILD_REQUIRES} || {}} , %{$params{TEST_REQUIRES}} }; delete $params{TEST_REQUIRES}; } if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) { #EUMM 6.5502 has problems with BUILD_REQUIRES $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} }; delete $params{BUILD_REQUIRES}; } delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52; delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48; delete $params{META_MERGE} if $eumm_version < 6.46; delete $params{META_ADD} if $eumm_version < 6.46; delete $params{LICENSE} if $eumm_version < 6.31; WriteMakefile(%params); } MANIFEST000644000000000000 34612474677622 14260 0ustar00unknownunknown000000000000Roman-1.24Changes MANIFEST META.yml # Will be created by "make dist" Makefile.PL README lib/Roman.pm t/00-load.t t/01.t t/pod-coverage.t t/pod.t META.json Module JSON meta-data (added by MakeMaker) META.json000644000000000000 222712474677621 14567 0ustar00unknownunknown000000000000Roman-1.24{ "abstract" : "functions for converting between Roman and Arabic numerals", "author" : [ "Alexandr Ciornii " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.143240", "keywords" : [ "roman numbers" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Roman", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Test::More" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Exporter" : "5.57", "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "repository" : { "url" : "http://github.com/chorny/Roman" } }, "version" : "1.24" } META.yml000644000000000000 122612474677616 14421 0ustar00unknownunknown000000000000Roman-1.24--- abstract: functions for converting between Roman and Arabic numerals author: - 'Alexandr Ciornii ' build_requires: ExtUtils::MakeMaker: 0 Test::More: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.143240' keywords: - roman numbers license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Roman no_index: directory: - t - inc requires: Exporter: 5.57 perl: 5.006 resources: repository: http://github.com/chorny/Roman version: 1.24 README000644000000000000 265711254254066 14022 0ustar00unknownunknown000000000000Roman-1.24Roman.pm version 1.23 NAME Roman - Perl module for conversion between Roman and Arabic numerals. SYNOPSIS use Roman; $arabic = arabic($roman) if isroman($roman); $roman = Roman($arabic); $roman = roman($arabic); DESCRIPTION This package provides some functions which help conversion of numeric notation between Roman and Arabic. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install Or use `cpan` or `cpanp` (best way). BUGS Domain of valid Roman numerals is limited to less than 4000, since proper Roman digits for the rest are not available in ASCII. SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Roman You can also look for information at: Search CPAN http://search.cpan.org/dist/Roman CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Roman AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/Roman CPAN Ratings: http://cpanratings.perl.org/d/Roman COPYRIGHT AND LICENCE Copyright (c) 1995-1997 OZAWA Sakuro. Copyright (C) 2007-2008 Alexandr Ciornii This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. lib000755000000000000 012474677614 13554 5ustar00unknownunknown000000000000Roman-1.24Roman.pm000644000000000000 752012474675345 15330 0ustar00unknownunknown000000000000Roman-1.24/libpackage Roman; use 5.006; use strict; use warnings; our $VERSION='1.24'; =head1 NAME Roman - functions for converting between Roman and Arabic numerals =head1 VERSION Version 1.24 =cut =head1 SYNOPSIS use Roman; $arabic = arabic($roman) if isroman($roman); $roman = Roman($arabic); $roman = roman($arabic); =head1 DESCRIPTION This package provides some functions which help conversion of numeric notation between Roman and Arabic. =head1 Functions =head2 isroman Tests if argument is valid roman number =head2 arabic roman => arabic =head2 Roman arabic => roman =head2 roman Same as Roman, lowercase =head1 BUGS Domain of valid Roman numerals is limited to less than 4000, since proper Roman digits for the rest are not available in ASCII. Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SEE ALSO L - also handles conversion between Arabic and Roman numerals, but can handle a larger range than this module. L - another module for converting between Arabic and Roman numerals. L - handles the same conversion, but also lets you specify upper or lower case. L - make Roman numerals, using Unicode characters. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Roman You can also look for information at: =over 4 =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * RT: CPAN's request tracker L =item * Search CPAN L =back =head1 AUTHOR OZAWA Sakuro 1995-1997 Alexandr Ciornii, C<< >> 2007 =head1 COPYRIGHT Copyright (c) 1995 OZAWA Sakuro. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut use Exporter 'import'; #our @ISA = qw(Exporter); our @EXPORT = qw(isroman arabic Roman roman); our %roman2arabic = qw(I 1 V 5 X 10 L 50 C 100 D 500 M 1000); my %roman_digit = qw(1 IV 10 XL 100 CD 1000 MMMMMM); my @figure = reverse sort keys %roman_digit; #my %roman_digit; $roman_digit{$_} = [split(//, $roman_digit{$_}, 2)] foreach @figure; sub isroman($) { my $arg = shift; $arg ne '' and $arg =~ /^(?: M{0,3}) (?: D?C{0,3} | C[DM]) (?: L?X{0,3} | X[LC]) (?: V?I{0,3} | I[VX])$/ix; } sub arabic($) { my $arg = shift; isroman $arg or return undef; my($last_digit) = 1000; my($arabic); foreach (split(//, uc $arg)) { my($digit) = $roman2arabic{$_}; $arabic -= 2 * $last_digit if $last_digit < $digit; $arabic += ($last_digit = $digit); } $arabic; } sub Roman($) { my $arg = shift; 0 < $arg and $arg < 4000 or return undef; my($x, $roman); foreach (@figure) { my($digit, $i, $v) = (int($arg / $_), @{$roman_digit{$_}}); if (1 <= $digit and $digit <= 3) { $roman .= $i x $digit; } elsif ($digit == 4) { $roman .= "$i$v"; } elsif ($digit == 5) { $roman .= $v; } elsif (6 <= $digit and $digit <= 8) { $roman .= $v . $i x ($digit - 5); } elsif ($digit == 9) { $roman .= "$i$x"; } $arg -= $digit * $_; $x = $i; } $roman; } sub roman($) { lc Roman shift; } 1; # End of Roman t000755000000000000 012474677614 13251 5ustar00unknownunknown000000000000Roman-1.2400-load.t000644000000000000 20611254254066 14672 0ustar00unknownunknown000000000000Roman-1.24/t#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Roman' ); } diag( "Testing Roman $Roman::VERSION, Perl $], $^X" ); 01.t000644000000000000 63111254254066 13760 0ustar00unknownunknown000000000000Roman-1.24/t#!perl -T use 5.006; use strict; use warnings; our %test; BEGIN{ %test=( 'I'=>1, 'II'=>2, 'III'=>3, qw/V 5 X 10 L 50 C 100 D 500 M 1000 MCDXLIV 1444 MMVII 2007/ ); } use Test::More tests => (scalar(keys %test)*3); use Roman; while (my ($rom,$arab)=each %test) { ok(isroman($rom),"$rom is roman"); is(arabic($rom),$arab,"$rom is $arab"); is(Roman($arab),$rom,"$arab is $rom"); } pod-coverage.t000644000000000000 26211254254066 16113 0ustar00unknownunknown000000000000Roman-1.24/t#!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); pod.t000644000000000000 22211254254066 14316 0ustar00unknownunknown000000000000Roman-1.24/t#!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok();