-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
155 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{$NEXT}} | ||
|
||
- Add basic/naive implementation of roles using 'with' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name = Simple-Accessor | ||
version = 1.11 | ||
version = 1.12 | ||
author = Nicolas R. <[email protected]> | ||
license = Perl_5 | ||
copyright_holder = Nicolas R. | ||
|
@@ -16,6 +16,9 @@ copyright_holder = Nicolas R. | |
[GatherDir] | ||
exclude_filename = Makefile.PL | ||
|
||
[NextRelease] | ||
filename = Changes | ||
|
||
[MetaJSON] | ||
;[AutoMetaResources] | ||
;bugtracker.rt = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package Role::Age; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Simple::Accessor qw{age}; | ||
|
||
sub _build_age { 42 } | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package Role::Time; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Simple::Accessor qw{date}; | ||
|
||
sub _build_date { '20210102' } | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package TestRole; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Simple::Accessor qw{name}; | ||
|
||
with 'Role::Age'; | ||
with 'Role::Time'; | ||
|
||
sub _build_name { 'default-name' } | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use warnings; | ||
|
||
use Test::More tests => 4; | ||
use FindBin; | ||
|
||
use lib $FindBin::Bin. '/lib'; | ||
|
||
use_ok 'TestRole'; | ||
|
||
my $o = TestRole->new(); | ||
is $o->name, 'default-name'; | ||
is $o->age, 42, 'default age'; | ||
is $o->date, '20210102', 'default date'; | ||
|
||
1; |