Skip Menu |
 

This queue is for tickets about the App-Software-License CPAN distribution.

Report information
The Basics
Id: 82924
Status: resolved
Priority: 0/
Queue: App-Software-License

People
Owner: ether [...] cpan.org
Requestors: RWSTAUNER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.01
Fixed in: 0.03

Attachments


Subject: Year option doesn't accept argument
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1358997791-20475-5"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 536
Download (untitled) / with headers
text/plain 536b
*$ software-license --year=2011 --license=BSD Option year does not take an argument usage: software-license [-?h] [long options...] -h -? --usage --help Prints this usage information. --holder --year --license --configfile --type It says year doesn't take an argument, but I don't know what "--year" should do without one. I think MooseX::Getopt doesn't recognize the "Maybe" type. Dropping that and using a predicate seems to work.
Subject: app-software-license-year.patch
MIME-Version: 1.0
Content-Type: text/x-diff; name="app-software-license-year.patch"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="app-software-license-year.patch"
Content-Transfer-Encoding: binary
Content-Length: 1648
diff --git a/lib/App/Software/License.pm b/lib/App/Software/License.pm index de9e9fc..79a2eea 100644 --- a/lib/App/Software/License.pm +++ b/lib/App/Software/License.pm @@ -23,8 +23,8 @@ has holder => ( has year => ( is => 'ro', - isa => Maybe[Num], - default => undef, + isa => Num, + predicate => 'has_year', ); @@ -64,7 +64,7 @@ sub _build__software_license { Class::MOP::load_class($class); return $class->new({ holder => $self->holder, - year => $self->year, + ($self->has_year ? (year => $self->year) : ()), }); } diff --git a/t/options.t b/t/options.t new file mode 100644 index 0000000..2de6b73 --- /dev/null +++ b/t/options.t @@ -0,0 +1,40 @@ +use strict; +use warnings; +use Test::More 0.88; +use File::Spec::Functions qw( catfile ); # core + +use App::Software::License; + +my $holder = 'A.Holder'; +my $year = (localtime)[5] + 1900; + +sub test_opts { + my ($argv, $re, $desc) = @_; + local @ARGV = @$argv; + my $holder = 'A.Holder'; + like( + App::Software::License->new_with_options->_software_license->notice, + $re, + $desc, + ); +} + +test_opts( + [qw( --holder=A.Holder --license=BSD )], + qr/^\QThis software is Copyright (c) $year by $holder.\E/, + 'basic args', +); + +test_opts( + [qw( --holder=A.Holder BSD )], + qr/^\QThis software is Copyright (c) $year by $holder.\E/, + 'license as last (non-option) argument', +); + +test_opts( + [qw( --year=2000 --holder=A.Holder BSD )], + qr/^\QThis software is Copyright (c) 2000 by $holder.\E/, + 'specify year', +); + +done_testing;
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-16968-1359832023-456.82924-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 458
Download (untitled) / with headers
text/plain 458b
On Wed Jan 23 19:23:11 2013, RWSTAUNER wrote: Show quoted text
> I think MooseX::Getopt doesn't recognize the "Maybe" type. > Dropping that and using a predicate seems to work.
Yes, MooseX::Getopt doesn't understand either Maybe[Foo] or Foo|Undef, as undef can't really be passed on the command line. :) However, Foo|Bool should work properly, so if you just said --year with no argument you'd get a 1 in the attribute (not that a boolean makes sense for this argument).
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-16968-1359832023-456.82924-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-3.8.HEAD-16968-1359832023-456.82924-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-9903-1390659967-875.82924-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 83
So, what would be the appropriate solution for this? I just found this issue again.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-9903-1390659967-875.82924-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-3.8.HEAD-16968-1359832023-456.82924-0-0 [...] rt.cpan.org> <rt-4.0.18-9903-1390659967-875.82924-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-25263-1435286907-929.82924-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 187
Download (untitled) / with headers
text/plain 187b
On 2014-01-25 06:26:07, RWSTAUNER wrote: Show quoted text
> So, what would be the appropriate solution for this? > I just found this issue again.
Hey, I just ran into this again! Fixed finally in 0.03 :)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.