Giter Site home page Giter Site logo

p5-number-phone-jp's People

Contributors

manwar avatar nipotan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

p5-number-phone-jp's Issues

Problem with cpan installation

Hi nipotan,

Wesley here,

I recently joined the 2015 cpan pull request challenge and was assigned to this module.

So, I went in to check MetaCpan regarding your module for any outstanding bugs.
It pointed me to this, here's the report

I believe the dependency for Number::Phone was not declared in a metacpan friendly manner, ie. requiring either a meta.yml or meta.json file. see this

I've forked the repo and will submit a pull request for meta.json.

Do you have any more suggestions?
(maybe you can take a look at this, a list of suggestions from the organisers)

suggest: stop using Module::Install

Number-Phone-JP uses Module::Install as an module installer. But now it is discouraged because:

  • It is discouraged by the maintainers themselves. See pod
  • It only generates META.yml which is outdated. Thus, for example, it cannot handle TEST_REQUIRES properly.
  • It apparently assumes . in @INC, but perl 5.26 removes . from @INC. So, if people install your modules, they may need to append . to @INC manually.

Why don't you switch Module::Install to another module maker?

Although you can use ExtUtils::MakeMaker or Module::Build directly,
I would suggest to use authoring tools such as Dist::Zilla, Dist::Milla or Minilla.

is_valid() returns unexpected validation when /^\d+$/ was set

I have made my validation routine like below:

sub optimize {
    my $phone = shift;
    $phone = alnum_z2h($phone); # 全角数字を半角に
    $phone =~ s/[^\d\-\s]+/ /g; # 関係ない文字の削除 
    $phone =~ s/[\s\-]+/ /g;    # デリミタを統一
    
    return '電話番号をもう一度確認してください。'
      unless Number::Phone::JP->new->set_number($phone)->is_valid();
    return $phone;
}

But it returns message with some warn like below:

The number is invalid telephone number. at xxxx.pl line xx.
Any number was not set at xxxx.pl line xx.
電話番号をもう一度確認してください。

It seems that numbers with no space( /^\d+$/ ) return same errors.
the full of my test code is here:

use feature qw(say);
use strict;
use warnings;

use utf8;
use Lingua::JA::Regular::Unicode qw(alnum_z2h);
use Number::Phone::JP qw(Freedial);

binmode STDOUT,':utf8';
binmode STDERR, ':utf8';

my $do_divide = 0;
my $phone = optimize('0120893893'); # 全角数字(ハイフン無し)
say $phone; # 0120 893 893 を期待
#The number is invalid telephone number. at test.pl line 36.
#Any number was not set at test.pl line 36.
#電話番号をもう一度確認してください。

say optimize('0120893893');     # 半角数字でも同じ結果
say optimize('0120 893 893');   # スペースを入れると解決
$do_divide = 1;                 # またはスペースを挿入する処理を呼び出す
say optimize('0120893893');     # と解決

exit;

sub optimize {
    my $phone = shift;
    $phone = alnum_z2h($phone); # 全角数字を半角に
    $phone =~ s/[^\d\-\s]+/ /g; # 関係ない文字の削除 
    $phone =~ s/[\s\-]+/ /g;    # デリミタを統一
    if( $do_divide and $phone !~ / / ) {       # 連番を分離する
        $phone =~ /^0120(\d{3})(\d{3})$/;
        $phone = "0120 $1 $2";
    }
    
    return '電話番号をもう一度確認してください。'
      unless Number::Phone::JP->new->set_number($phone)->is_valid();
    return $phone;
}

Does it deserve to write a PR?

Link to GitHub repo is not in META.json

and thus it does not show up on MetaCPAN either. It is strange as I can see the code in the Makefile.PL file.

Looking again, I see META.json is commited to git (and it should not as it is a generated file) and it is probably not re-generated on release so the information from Makefile.PL did not make it into the package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.