Skip to content
Browse files

Fixed 02.array.t so it actually uses nb.pm locale.

Also removed 'version' prereq, and changed t/* requirements to be
build reqs instead of normal reqs.
  • Loading branch information...
1 parent 8909015 commit eee700e974115c15927bef1d6f557fd3bcf5d43a @mstratman committed Apr 11, 2012
Showing with 35 additions and 4 deletions.
  1. +4 −2 Build.PL
  2. +4 −2 Makefile.PL
  3. +3 −0 t/02.array.t
  4. +24 −0 t/lib/DateTime/Format/Human/Duration/Locale/nb.pm
View
6 Build.PL
@@ -7,10 +7,12 @@ my $builder = Module::Build->new(
license => 'perl',
dist_author => 'Daniel Muey <http://drmuey.com/cpan_contact.pl>',
dist_version_from => 'lib/DateTime/Format/Human/Duration.pm',
- requires => {
+ build_requires => {
'Test::More' => 0,
- 'version' => 0,
+ 'File::Spec' => 0,
+ 'FindBin' => 0,
},
+ requires => { },
add_to_cleanup => [ 'DateTime-Format-Human-Duration-*' ],
);
View
6 Makefile.PL
@@ -8,10 +8,12 @@ WriteMakefile(
VERSION_FROM => 'lib/DateTime/Format/Human/Duration.pm',
ABSTRACT_FROM => 'lib/DateTime/Format/Human/Duration.pm',
PL_FILES => {},
- PREREQ_PM => {
+ BUILD_REQUIRES => {
'Test::More' => 0,
- 'version' => 0,
+ 'File::Spec' => 0,
+ 'FindBin' => 0,
},
+ PREREQ_PM => { },
META_MERGE => {
resources => {
repository => 'https://github.com/mstratman/DateTime-Format-Human-Duration',
View
3 t/02.array.t
@@ -2,6 +2,9 @@ use Test::More;
use lib 't/lib';
use DateTime::Format::Human::Duration;
use DateTime;
+use FindBin qw($Bin);
+use File::Spec;
+BEGIN { push @INC, File::Spec->catfile($Bin, 'lib'); }
my $dta = DateTime->now( locale => 'nb' );
View
24 t/lib/DateTime/Format/Human/Duration/Locale/nb.pm
@@ -0,0 +1,24 @@
+package DateTime::Format::Human::Duration::Locale::nb;
+# XXX: this isn't really NB locale, I just cheat the system.
+#
+sub get_human_span_from_units_array {
+ my ($years, $months, $weeks, $days, $hours, $minutes, $seconds, $nanoseconds, $args_hr) = @_; # note: has no negative numbers
+ if ($years) {
+ $s = $years . "y";
+ } elsif ($months) {
+ $s = $months . "mo";
+ } elsif ($weeks) {
+ $s = $weeks . "w";
+ } elsif ($days) {
+ $s = $days . "d";
+ } elsif ($hours) {
+ $s = $hours . "h";
+ } elsif ($minutes) {
+ $s = $minutes . "mi";
+ } elsif ($seconds) {
+ $s = "moments";
+ }
+ return $s;
+}
+
+1;

0 comments on commit eee700e

Please sign in to comment.
Something went wrong with that request. Please try again.