Text-Roman-3.5/000755 000765 000024 00000000000 12101537744 013500 5ustar00stasstaff000000 000000 Text-Roman-3.5/Changes000644 000765 000024 00000001263 12101537744 014775 0ustar00stasstaff000000 000000 Changelog for Text-Roman 3.5 2013-01-28T18:13:55 [Stanislaw Pusep ] - removed Scalar::Util dependency - eg/unroman.pl fixed - fixes to comply with the new tests - better tests - better aliases to deprecated functions - probable roman2int() typo fix (slow $& instead of plain $_) - version bump - tests cleanup - added usage example v3.4 2013-01-22T20:37:07 [Stanislaw Pusep ] - merge complete - merging back with ECALDER fork [Stanislaw Pusep ] - Changes v3.02 2012-02-01T18:29:16 [Stanislaw Pusep ] - CPAN test compliance - released at CPAN Text-Roman-3.5/dist.ini000644 000765 000024 00000001717 12101537744 015152 0ustar00stasstaff000000 000000 name = Text-Roman author = Stanislaw Pusep license = Perl_5 copyright_holder = Erick Calder copyright_year = 2003 version = 3.5 ; authordep Perl::Critic::Policy::Modules::ProhibitModuleShebang ; authordep Pod::Elemental::Transformer::List ; authordep Pod::Weaver::Plugin::Encoding [@Git] [@Basic] [ChangelogFromGit::CPAN::Changes] file_name = Changes [OurPkgVersion] [MetaResourcesFromGit] homepage = https://github.com/%a/%r bugtracker.web = https://github.com/%a/%r/issues [@TestingMania] critic_config = perlcritic.rc [PodWeaver] [ReadmeAnyFromPod / text.build] filename = README type = text [ReadmeAnyFromPod / pod.root] filename = README.pod type = pod [CopyFilesFromBuild] move = README.pod [AutoPrereqs] [MinimumPerl] perl = 5.006 [ManifestSkip] Text-Roman-3.5/eg/000755 000765 000024 00000000000 12101537744 014073 5ustar00stasstaff000000 000000 Text-Roman-3.5/lib/000755 000765 000024 00000000000 12101537744 014246 5ustar00stasstaff000000 000000 Text-Roman-3.5/LICENSE000644 000765 000024 00000043744 12101537744 014521 0ustar00stasstaff000000 000000 This software is copyright (c) 2003 by Erick Calder . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2003 by Erick Calder . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2003 by Erick Calder . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Text-Roman-3.5/Makefile.PL000644 000765 000024 00000002212 12101537744 015447 0ustar00stasstaff000000 000000 use strict; use warnings; use 5.006; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "Allows conversion between Roman and Arabic algarisms.", "AUTHOR" => "Stanislaw Pusep ", "BUILD_REQUIRES" => { "File::Find" => 0, "File::Temp" => 0, "Test::More" => 0, "Test::Simple" => 0 }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Text-Roman", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "Text::Roman", "PREREQ_PM" => { "Carp" => 0, "Exporter" => 0, "strict" => 0, "warnings" => 0 }, "VERSION" => "3.5", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Text-Roman-3.5/MANIFEST000644 000765 000024 00000001126 12101537744 014631 0ustar00stasstaff000000 000000 Changes LICENSE MANIFEST MANIFEST.SKIP META.yml Makefile.PL README dist.ini eg/unroman.pl lib/Text/Roman.pm perlcritic.rc t/00-compile.t t/00-load.t t/05-ecalder.t t/10-simple.t t/11-void.t t/15-aliased.t t/20-predef.t t/author-critic.t t/author-test-eol.t t/release-cpan-changes.t t/release-dist-manifest.t t/release-distmeta.t t/release-kwalitee.t t/release-minimum-version.t t/release-mojibake.t t/release-no-tabs.t t/release-pod-coverage.t t/release-pod-linkcheck.t t/release-pod-syntax.t t/release-portability.t t/release-synopsis.t t/release-test-version.t t/release-unused-vars.t weaver.ini Text-Roman-3.5/MANIFEST.SKIP000644 000765 000024 00000001767 12101537744 015411 0ustar00stasstaff000000 000000 #!start included /Users/stas/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /Users/stas/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/ExtUtils/MANIFEST.SKIP Text-Roman-3.5/META.yml000644 000765 000024 00000001340 12101537744 014747 0ustar00stasstaff000000 000000 --- abstract: 'Allows conversion between Roman and Arabic algarisms.' author: - 'Stanislaw Pusep ' build_requires: File::Find: 0 File::Temp: 0 Test::More: 0 Test::Simple: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300029, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Text-Roman requires: Carp: 0 Exporter: 0 perl: 5.006 strict: 0 warnings: 0 resources: bugtracker: https://github.com/creaktive/Text-Roman/issues homepage: https://github.com/creaktive/Text-Roman repository: git://github.com/creaktive/Text-Roman.git version: 3.5 Text-Roman-3.5/perlcritic.rc000644 000765 000024 00000000337 12101537744 016171 0ustar00stasstaff000000 000000 severity = harsh [TestingAndDebugging::RequireUseWarnings] equivalent_modules = common::sense [TestingAndDebugging::RequireUseStrict] equivalent_modules = common::sense [Modules::ProhibitModuleShebang] severity = gentle Text-Roman-3.5/README000644 000765 000024 00000010270 12101537744 014360 0ustar00stasstaff000000 000000 NAME Text::Roman - Allows conversion between Roman and Arabic algarisms. VERSION version 3.5 SYNOPSIS #!/usr/bin/env perl use strict; use warnings; use Text::Roman qw(:all); print int2roman(123), "\n"; my $roman = "XXXV"; print roman2int($roman), "\n" if isroman($roman); my $milhar = 'L_X_XXIII'; # = 60,023 print milhar2int($milhar), "\n" if ismilhar($milhar); DESCRIPTION This package supports both conventional Roman algarisms (which range from *1* to *3999*) and Milhar Romans, a variation which uses a bar across the algarism to indicate multiplication by *1_000*. For the purposes of this module, acceptable syntax consists of an underscore suffixed to the algarism e.g. IV_V = *4_005*. The term Milhar apparently derives from the Portuguese word for "thousands" and the range of this notation extends the range of Roman numbers to *3999 * 1000 + 3999 = 4_002_999*. Note: the functions in this package treat Roman algarisms in a case-insensitive manner such that "VI" == "vI" == "Vi" == "vi". The following functions may be imported into the caller package by name: FUNCTIONS isroman Tests a string to be a valid Roman algarism. Returns a boolean value. int2roman Converts an integer expressed in Arabic numerals, to its corresponding Roman algarism. If the integer provided is out of the range expressible in Roman notation, an *undef* is returned. roman2int Does the converse of "int2roman", converting a Roman algarism to its integer value. ismilhar Determines whether a string qualifies as a Milhar Roman algarism. milhar2int Converts a Milhar Roman algarism to an integer. ismroman/mroman2int/roman These functions belong to the module's old interface and are considered deprecated. Do not use them in new code and they will eventually be discontinued; they map as follows: * ismroman => ismilhar * mroman2int => milhar2int * roman => int2roman CHANGES Some changes worth noting from this module's previous incarnation: *namespace imports* The call to use must now explicitly request function names imported into it's namespace. *argument defaults/void context* All functions now will operate on $_ when no arguments are passed, and will set $_ when called in a void context. This allows for writing code like: @x = qw/V III XI IV/; roman2int() for @x; print join("-", @x); instead of the uglier: @x = qw/V III XI IV/; $_ = roman2int($_) for @x; print join("-", @x); SPECIFICATION Roman algarisms may be described using the following BNF-like formula: a = I{1,3} b = V\a?|IV|\a e = X{1,3}\b?|X{0,3}IX|\b ee = IX|\b f = L\e?|XL\ee?|\e g = C{1,3}\f?|C{0,3}XC\ee?|\f gg = XC\ee?|\f h = D\g?|CD\gg?|\g j = M{1,3}\h?|M{0,3}CM\gg?|\h REFERENCES For a description of the Roman numeral system see: . A reference to Milhar Roman alagarisms (in Portuguese) may be found at: . ACKNOWLEDGEMENTS This module was originally written by Peter de Padua Krauss and submitted to CPAN by Stanislaw Pusep who has relinquished control to Erick Calder since the original author has never maintained it and can no longer be reached. Erick have completely rewritten the module, implementing simpler algorithms to perform the same functionality, adding a test suite, a Changes file, etc. and providing more comprehensive documentation. Ten years later, Stanislaw returned as a maintainer. AUTHOR Stanislaw Pusep COPYRIGHT AND LICENSE This software is copyright (c) 2003 by Erick Calder . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Text-Roman-3.5/t/000755 000765 000024 00000000000 12101537744 013743 5ustar00stasstaff000000 000000 Text-Roman-3.5/weaver.ini000644 000765 000024 00000000113 12101537744 015465 0ustar00stasstaff000000 000000 [@Default] [-Encoding] encoding = utf8 [-Transformer] transformer = List Text-Roman-3.5/t/00-compile.t000644 000765 000024 00000003125 12101537744 015776 0ustar00stasstaff000000 000000 #!perl use strict; use warnings; use Test::More; use File::Find; use File::Temp qw{ tempdir }; my @modules; find( sub { return if $File::Find::name !~ /\.pm\z/; my $found = $File::Find::name; $found =~ s{^lib/}{}; $found =~ s{[/\\]}{::}g; $found =~ s/\.pm$//; # nothing to skip push @modules, $found; }, 'lib', ); sub _find_scripts { my $dir = shift @_; my @found_scripts = (); find( sub { return unless -f; my $found = $File::Find::name; # nothing to skip open my $FH, '<', $_ or do { note( "Unable to open $found in ( $! ), skipping" ); return; }; my $shebang = <$FH>; return unless $shebang =~ /^#!.*?\bperl\b\s*$/; push @found_scripts, $found; }, $dir, ); return @found_scripts; } my @scripts; do { push @scripts, _find_scripts($_) if -d $_ } for qw{ bin script scripts }; my $plan = scalar(@modules) + scalar(@scripts); $plan ? (plan tests => $plan) : (plan skip_all => "no tests to run"); { # fake home for cpan-testers # no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 ); like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" ) for sort @modules; SKIP: { eval "use Test::Script 1.05; 1;"; skip "Test::Script needed to test script compilation", scalar(@scripts) if $@; foreach my $file ( @scripts ) { my $script = $file; $script =~ s!.*/!!; script_compiles( $file, "$script script compiles" ); } } } Text-Roman-3.5/t/00-load.t000644 000765 000024 00000000251 12101537744 015262 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Test::More tests => 1; BEGIN { use_ok(q(Text::Roman)); } diag(qq(Text::Roman v$Text::Roman::VERSION, Perl $], $^X)); Text-Roman-3.5/t/05-ecalder.t000644 000765 000024 00000001056 12101537744 015753 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Carp qw(croak); use Test::Simple tests => 7; use Text::Roman qw/isroman roman2int int2roman ismilhar milhar2int/; ok(1, 'use Text::Roman'); # test reciprocity my $n = 3999; my @r; $r[$_] = int2roman($_) for 1 .. $n; ok(1, "array created"); for (1 .. $n) { my $ar; croak "$_: $r[$_] != $ar" unless ($ar = roman2int($r[$_])) == $_; } ok(1, "reciprocity tested"); ok(isroman("IV"), "is roman"); ok(!isroman("IVI"), "is not roman"); ok(milhar2int("IV_VIII") == 4008, "milhar converted"); ok(1, "done"); Text-Roman-3.5/t/10-simple.t000644 000765 000024 00000001277 12101537744 015646 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Test::More; use Text::Roman qw(:all); ok(isroman('DCLXVI'), 'isroman'); ok((not isroman(666)), 'not isroman'); ok(ismilhar('L_X_XXIII'), 'ismilhar'); ok((not ismilhar(60023)), 'not ismilhar'); is(roman2int('DCLXVI'), 666, 'roman2int'); is(roman2int('VV'), undef, 'bad roman2int'); is(milhar2int('L_X_XXIII'), 60023, 'milhar2int'); is(milhar2int('X_VV'), undef, 'bad milhar2int'); is(int2roman(666), 'DCLXVI', 'int2roman'); is(int2roman('DCLXVI'), undef, 'bad int2roman 1'); is(int2roman(-666), undef, 'bad int2roman 2'); is(int2roman(4666), undef, 'bad int2roman 3'); my @x = qw[v iii xi iv]; ok(isroman(), qq(isroman($_))) for @x; done_testing 16; Text-Roman-3.5/t/11-void.t000644 000765 000024 00000000606 12101537744 015312 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Test::More; use Text::Roman qw(roman2int int2roman milhar2int); my @x = qw[v iii xi iv]; roman2int() for @x; is_deeply(\@x, [qw[5 3 11 4]], q(roman2int)); int2roman() for @x; is_deeply(\@x, [qw[V III XI IV]], q(roman2int)); my @y = qw[L_X_XXIII IV_VIII]; milhar2int() for @y; is_deeply(\@y, [60023, 4008], q(milhar2int)); done_testing 3; Text-Roman-3.5/t/15-aliased.t000644 000765 000024 00000000343 12101537744 015755 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Test::More; use Text::Roman qw(:all); ok(ismroman('L_X_XXIII'), 'ismroman'); is(mroman2int('L_X_XXIII'), 60023, 'mroman2int'); is(roman(666), 'DCLXVI', 'roman'); done_testing 3; Text-Roman-3.5/t/20-predef.t000644 000765 000024 00000003235 12101537744 015617 0ustar00stasstaff000000 000000 #!perl use strict; use warnings qw(all); use Test::More; use Text::Roman qw(:all); my $i = 0; while () { my ($int, $roman) = /^(\d+)\s+([MDCLXVI]+)/x; ok($int && $roman, 'pair'); ok(isroman($roman), 'isroman'); is(int2roman($int), $roman, 'int2roman'); is(roman2int($roman), $int, 'roman2int'); ++$i; } done_testing 4 * $i; __DATA__ 26 XXVI 27 XXVII 39 XXXIX 55 LV 128 CXXVIII 163 CLXIII 197 CXCVII 255 CCLV 257 CCLVII 312 CCCXII 366 CCCLXVI 373 CCCLXXIII 401 CDI 421 CDXXI 469 CDLXIX 532 DXXXII 536 DXXXVI 663 DCLXIII 687 DCLXXXVII 706 DCCVI 717 DCCXVII 747 DCCXLVII 764 DCCLXIV 897 DCCCXCVII 903 CMIII 931 CMXXXI 934 CMXXXIV 1072 MLXXII 1123 MCXXIII 1138 MCXXXVIII 1177 MCLXXVII 1233 MCCXXXIII 1411 MCDXI 1440 MCDXL 1481 MCDLXXXI 1488 MCDLXXXVIII 1492 MCDXCII 1573 MDLXXIII 1602 MDCII 1642 MDCXLII 1726 MDCCXXVI 1901 MCMI 1907 MCMVII 1991 MCMXCI 2003 MMIII 2021 MMXXI 2039 MMXXXIX 2213 MMCCXIII 2296 MMCCXCVI 2299 MMCCXCIX 2326 MMCCCXXVI 2345 MMCCCXLV 2351 MMCCCLI 2357 MMCCCLVII 2418 MMCDXVIII 2436 MMCDXXXVI 2499 MMCDXCIX 2593 MMDXCIII 2611 MMDCXI 2626 MMDCXXVI 2649 MMDCXLIX 2750 MMDCCL 2762 MMDCCLXII 2767 MMDCCLXVII 2848 MMDCCCXLVIII 2926 MMCMXXVI 2930 MMCMXXX 2939 MMCMXXXIX 2970 MMCMLXX 3001 MMMI 3108 MMMCVIII 3110 MMMCX 3123 MMMCXXIII 3138 MMMCXXXVIII 3192 MMMCXCII 3195 MMMCXCV 3215 MMMCCXV 3231 MMMCCXXXI 3252 MMMCCLII 3269 MMMCCLXIX 3271 MMMCCLXXI 3272 MMMCCLXXII 3407 MMMCDVII 3449 MMMCDXLIX 3461 MMMCDLXI 3489 MMMCDLXXXIX 3495 MMMCDXCV 3576 MMMDLXXVI 3653 MMMDCLIII 3666 MMMDCLXVI 3671 MMMDCLXXI 3674 MMMDCLXXIV 3682 MMMDCLXXXII 3701 MMMDCCI 3740 MMMDCCXL 3762 MMMDCCLXII 3813 MMMDCCCXIII 3837 MMMDCCCXXXVII 3934 MMMCMXXXIV 3939 MMMCMXXXIX Text-Roman-3.5/t/author-critic.t000644 000765 000024 00000000666 12101537744 016715 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); Text-Roman-3.5/t/author-test-eol.t000644 000765 000024 00000000615 12101537744 017166 0ustar00stasstaff000000 000000 BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::EOL 0.07 eval "use Test::EOL; 1;" or die $@; # ^^ hack to get around prereqscanner detection, remove someday all_perl_files_ok({ trailing_whitespace => 1 }); Text-Roman-3.5/t/release-cpan-changes.t000644 000765 000024 00000000471 12101537744 020077 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); done_testing(); Text-Roman-3.5/t/release-dist-manifest.t000644 000765 000024 00000000466 12101537744 020323 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::DistManifest"; plan skip_all => "Test::DistManifest required for testing the manifest" if $@; manifest_ok(); Text-Roman-3.5/t/release-distmeta.t000644 000765 000024 00000000455 12101537744 017364 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); Text-Roman-3.5/t/release-kwalitee.t000644 000765 000024 00000000617 12101537744 017357 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This test is generated by Dist::Zilla::Plugin::Test::Kwalitee use strict; use warnings; use Test::More; # needed to provide plan. eval "use Test::Kwalitee"; plan skip_all => "Test::Kwalitee required for testing kwalitee" if $@; Text-Roman-3.5/t/release-minimum-version.t000644 000765 000024 00000000526 12101537744 020707 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_from_metayml_ok(); Text-Roman-3.5/t/release-mojibake.t000644 000765 000024 00000000644 12101537744 017333 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings qw(all); use Test::More; ## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval) eval q(use Test::Mojibake); plan skip_all => q(Test::Mojibake required for source encoding testing) if $@; all_files_encoding_ok(); Text-Roman-3.5/t/release-no-tabs.t000644 000765 000024 00000000450 12101537744 017110 0ustar00stasstaff000000 000000 BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; eval 'use Test::NoTabs'; plan skip_all => 'Test::NoTabs required' if $@; all_perl_files_ok(); Text-Roman-3.5/t/release-pod-coverage.t000644 000765 000024 00000000765 12101537744 020131 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Text-Roman-3.5/t/release-pod-linkcheck.t000644 000765 000024 00000000775 12101537744 020272 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } Text-Roman-3.5/t/release-pod-syntax.t000644 000765 000024 00000000450 12101537744 017653 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); Text-Roman-3.5/t/release-portability.t000644 000765 000024 00000000501 12101537744 020104 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; run_tests(); Text-Roman-3.5/t/release-synopsis.t000644 000765 000024 00000000463 12101537744 017440 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Synopsis"; plan skip_all => "Test::Synopsis required for testing synopses" if $@; all_synopsis_ok('lib'); Text-Roman-3.5/t/release-test-version.t000644 000765 000024 00000001101 12101537744 020201 0ustar00stasstaff000000 000000 BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } my @imports = ( 'version_all_ok' ); my $params = { is_strict => 0, has_version => 1, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Text-Roman-3.5/t/release-unused-vars.t000644 000765 000024 00000000445 12101537744 020025 0ustar00stasstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Vars"; plan skip_all => "Test::Vars required for testing unused vars" if $@; all_vars_ok(); Text-Roman-3.5/lib/Text/000755 000765 000024 00000000000 12101537744 015172 5ustar00stasstaff000000 000000 Text-Roman-3.5/lib/Text/Roman.pm000644 000765 000024 00000015772 12101537744 016620 0ustar00stasstaff000000 000000 package Text::Roman; # ABSTRACT: Allows conversion between Roman and Arabic algarisms. use strict; use warnings qw(all); use Carp qw(carp); use Exporter; ## no critic (ProhibitAutomaticExportation, ProhibitExplicitISA) our @ISA = qw(Exporter); our %EXPORT_TAGS = (all => [qw(roman int2roman roman2int isroman mroman2int milhar2int ismroman ismilhar)]); our @EXPORT_OK = @{$EXPORT_TAGS{all}}; our $VERSION = '3.5'; # VERSION our @RSN = qw/I V X L C D M/; # Roman Simple Numerals our @RCN = qw/IV IX XL XC CD CM/; # Roman Complex Numerals our %R2A; @R2A{@RSN, @RCN} = qw/ 1 5 10 50 100 500 1000 4 9 40 90 400 900 /; # numeric values our %A2R = reverse %R2A; # reverse for convenience ## no critic (RequireArgUnpacking) sub isroman { local $_ = uc(@_ ? shift : $_); return if !/^[@RSN]+$/x; return if /([IXCM])\1{3,}|([VLD])\2+/x; # tests repeatability my @re = qw/IXI|XCX|CMC/; for (1 .. $#RSN) { push @re, "$RSN[$_ - 1]$RSN[$_]$RSN[$_ - 1]"; # tests IVI push @re, "$RSN[$_]$RSN[$_ - 1]$RSN[$_]"; # and VIV conditions } my $re = join "|", @re; return !/$re/x; } sub int2roman { my $n = @_ ? shift : $_; return if not $n =~ /^[0-9]+$/x or $n <= 0 or $n >= 4000; my $ret = ''; for (reverse sort { $a <=> $b } values %R2A) { $ret .= $A2R{$_} x int($n / $_); $n %= $_; } return defined(wantarray) ? $ret : $_ = $ret; } sub roman2int { my $ret = 0; do { local $_ = uc(@_ ? shift : $_); return unless isroman(); my ($r, $_ret) = ($_, 0); while ($r) { $r =~ s/^$_//x and ($ret += $R2A{$_}, last) for @RCN, @RSN; return if $ret <= $_ret; $_ret = $ret; } }; return defined(wantarray) ? $ret : $_ = $ret; } sub ismilhar { local $_ = uc(@_ ? shift : $_); return unless /^[_@RSN]+$/x; my @r = split /_/; isroman() || return for @r; return 1; } sub milhar2int { my $ret; do { local $_ = uc(@_ ? shift : $_); return unless ismilhar(); my @r = split /_/; $ret = roman2int(pop @r); $ret += 1000 * roman2int() for @r; }; return defined(wantarray) ? $ret : $_ = $ret; } my %deprecated = ( ismroman => [ ismilhar => \&ismilhar ], mroman2int => [ milhar2int => \&milhar2int ], roman => [ int2roman => \&int2roman ], ); for my $aliased (keys %deprecated) { ## no critic (ProhibitNoStrict) no strict 'refs'; *{'Text::Roman::' . $aliased} = sub { carp sprintf( '%s() deprecated, use %s() instead', $aliased, $deprecated{$aliased}->[0] ); goto $deprecated{$aliased}->[1]; }; } 1; __END__ =pod =encoding utf8 =head1 NAME Text::Roman - Allows conversion between Roman and Arabic algarisms. =head1 VERSION version 3.5 =head1 SYNOPSIS #!/usr/bin/env perl use strict; use warnings; use Text::Roman qw(:all); print int2roman(123), "\n"; my $roman = "XXXV"; print roman2int($roman), "\n" if isroman($roman); my $milhar = 'L_X_XXIII'; # = 60,023 print milhar2int($milhar), "\n" if ismilhar($milhar); =head1 DESCRIPTION This package supports both conventional Roman algarisms (which range from I<1> to I<3999>) and Milhar Romans, a variation which uses a bar across the algarism to indicate multiplication by I<1_000>. For the purposes of this module, acceptable syntax consists of an underscore suffixed to the algarism e.g. IV_V = I<4_005>. The term Milhar apparently derives from the Portuguese word for "thousands" and the range of this notation extends the range of Roman numbers to I<3999 * 1000 + 3999 = 4_002_999>. Note: the functions in this package treat Roman algarisms in a case-insensitive manner such that "VI" == "vI" == "Vi" == "vi". The following functions may be imported into the caller package by name: =head1 FUNCTIONS =head2 isroman Tests a string to be a valid Roman algarism. Returns a boolean value. =head2 int2roman Converts an integer expressed in Arabic numerals, to its corresponding Roman algarism. If the integer provided is out of the range expressible in Roman notation, an I is returned. =head2 roman2int Does the converse of L, converting a Roman algarism to its integer value. =head2 ismilhar Determines whether a string qualifies as a Milhar Roman algarism. =head2 milhar2int Converts a Milhar Roman algarism to an integer. =head2 ismroman/mroman2int/roman These functions belong to the module's old interface and are considered deprecated. Do not use them in new code and they will eventually be discontinued; they map as follows: =over 4 =item * ismroman => B =item * mroman2int => B =item * roman => B =back =head1 CHANGES Some changes worth noting from this module's previous incarnation: =over =item I The call to B must now explicitly request function names imported into it's namespace. =item I All functions now will operate on B<$_> when no arguments are passed, and will set B<$_> when called in a void context. This allows for writing code like: @x = qw/V III XI IV/; roman2int() for @x; print join("-", @x); instead of the uglier: @x = qw/V III XI IV/; $_ = roman2int($_) for @x; print join("-", @x); =back =head1 SPECIFICATION Roman algarisms may be described using the following BNF-like formula: a = I{1,3} b = V\a?|IV|\a e = X{1,3}\b?|X{0,3}IX|\b ee = IX|\b f = L\e?|XL\ee?|\e g = C{1,3}\f?|C{0,3}XC\ee?|\f gg = XC\ee?|\f h = D\g?|CD\gg?|\g j = M{1,3}\h?|M{0,3}CM\gg?|\h =head1 REFERENCES For a description of the Roman numeral system see: L. A reference to Milhar Roman alagarisms (in Portuguese) may be found at: L. =head1 ACKNOWLEDGEMENTS This module was originally written by Peter de Padua Krauss and submitted to CPAN by L who has relinquished control to L since the original author has never maintained it and can no longer be reached. Erick have completely rewritten the module, implementing simpler algorithms to perform the same functionality, adding a test suite, a Changes file, etc. and providing more comprehensive documentation. Ten years later, Stanislaw returned as a maintainer. =head1 AUTHOR Stanislaw Pusep =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2003 by Erick Calder . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Text-Roman-3.5/eg/unroman.pl000755 000765 000024 00000000560 12101537744 016113 0ustar00stasstaff000000 000000 #!/usr/bin/env perl use strict; use warnings qw(all); use Text::Roman qw(ismilhar milhar2int); # Filter text, replacing Roman numerals by Arabic equivalent while (<>) { my $n; s/ \b ([IVXLCDM_]{2,}) \b / ( ismilhar($1) and defined($n = milhar2int($1)) ) ? $n : $1 /egix; print; }