| 1 | # | ||
| 2 | # Copyright (c) 2021 Christian Jaeger, copying@christianjaeger.ch | ||
| 3 | # | ||
| 4 | # This is free software, offered under either the same terms as perl 5 | ||
| 5 | # or the terms of the Artistic License version 2 or the terms of the | ||
| 6 | # MIT License (Expat version). See the file COPYING.md that came | ||
| 7 | # bundled with this file. | ||
| 8 | # | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | FP::Abstract::Id - identity protocol | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | This protocol handles identification for values (objects). An | ||
| 19 | identifier is a string. Classes implementing this protocol must | ||
| 20 | provide a `FP_Id_id' method that takes no other arguments and returns | ||
| 21 | the identifier for the set of objects which are considered identical | ||
| 22 | by the class. | ||
| 23 | |||
| 24 | The identifier may be used for sorting (e.g. L<FP::Collection> uses it | ||
| 25 | to determine the sort order of the elements in L<FP::Show>::show). It | ||
| 26 | doesn't need to be human readable (thus could be implemented via | ||
| 27 | hashing) but it might be useful if it is. | ||
| 28 | |||
| 29 | =head1 SEE ALSO | ||
| 30 | |||
| 31 | L<FP::Collection> | ||
| 32 | |||
| 33 | =head1 NOTE | ||
| 34 | |||
| 35 | This is alpha software! Read the status section in the package README | ||
| 36 | or on the L<website|http://functional-perl.org/>. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | package FP::Abstract::Id; | ||
| 41 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 43 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | 1 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | 1 | ▶ | use Exporter "import"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | |||
| 47 | 0 | ▶ | sub FP_Interface__method_names { |
|
Subroutine
FP_Interface__method_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 48 | 0 | my $class = shift; | |
| 49 | 0 | qw(FP_Id_id) | |
| 50 | } | ||
| 51 | |||
| 52 | 1 | 1 | |