Acme-Study-OS-DateLocales

 view release on metacpan or  search on metacpan

DateLocales.pm  view on Meta::CPAN

package Acme::Study::OS::DateLocales;

use 5.008;

use strict;
our $VERSION = '0.03';

use base qw(Exporter);
our @EXPORT = qw(weekday_and_month_names_dump);

use Data::Dumper qw(Dumper);
use File::Spec::Functions qw(file_name_is_absolute);
use POSIX qw(strftime);

sub all_locales {
    my @res;
    if (_is_in_path("locale")) {
	open my $fh, "-|", "locale", "-a"
	    or die $!;
	while(<$fh>) {
	    chomp;

DateLocales.pm  view on Meta::CPAN

sub weekday_and_month_names {
    my @res;
    my @locales = all_locales();
    if (!@locales) {
	push @locales, ""; # means: use default locale
    }

    my %register;
    my $fingerprint_data = sub {
	my($ref) = @_;
	local $Data::Dumper::Indent = 0;
	local $Data::Dumper::Useqq = 0;
	local $Data::Dumper::Sortkeys = 1;
	Dumper($ref);
    };
    my $register_and_use_data = sub {
	my($ref, $name) = @_;
	my $fingerprint = $fingerprint_data->($ref);
	if (exists $register{$fingerprint}) {
	    +{ '==' => $register{$fingerprint} };
	} else {
	    $register{$fingerprint} = $name;
	    $ref;

DateLocales.pm  view on Meta::CPAN

		    " n" => $locname,
		    "d" => $locale_res,
		   };
    }
    @res;
}

sub weekday_and_month_names_dump {
    my @res = weekday_and_month_names();
    join "\n", map {
	Data::Dumper->new([$_],['r'])->Useqq(1)->Indent(0)->Sortkeys(1)->Dump
    } @res;
}

# REPO BEGIN
sub _is_in_path {
    my($prog) = @_;
    if (file_name_is_absolute($prog)) {
	if ($^O eq 'MSWin32') {
	    return $prog       if (-f $prog && -x $prog);
	    return "$prog.bat" if (-f "$prog.bat" && -x "$prog.bat");

META.yml  view on Meta::CPAN

name:               Acme-Study-OS-DateLocales
version:            0.03
abstract:           study date-specific locales
author:
    - Slaven Rezic <srezic@cpan.org>
license:            perl
distribution_type:  module
configure_requires:
    ExtUtils::MakeMaker:  0
requires:
    Data::Dumper:         0
    File::Spec::Functions:  0
    POSIX:                0
    Test::More:           0
resources:
    repository:  git://github.com/eserte/acme-study-os-datelocales.git
no_index:
    directory:
        - t
        - inc
generated_by:       ExtUtils::MakeMaker version 6.48

Makefile.PL  view on Meta::CPAN

WriteMakefile(NAME          => 'Acme::Study::OS::DateLocales',
	      AUTHOR        => 'Slaven Rezic <srezic@cpan.org>',
	      VERSION_FROM  => 'DateLocales.pm',
	      ABSTRACT_FROM => 'DateLocales.pm',
	      LICENSE       => 'perl',
	      ($ExtUtils::MakeMaker::VERSION >= 6.46
	       ? (META_MERGE => { resources => { repository => 'git://github.com/eserte/acme-study-os-datelocales.git' },
				})
	       : ()
	      ),
	      PREREQ_PM => { 'Data::Dumper' => 0,
			     'File::Spec::Functions' => 0,
			     'POSIX' => 0,
			     'Test::More' => 0,
			   },
	     );



( run in 0.718 second using v1.01-cache-2.11-cpan-a5abf4f5562 )