| 1 | ##-*- Mode: CPerl -*- | ||
| 2 | |||
| 3 | ##====================================================================== | ||
| 4 | package DDC::PP; | ||
| 5 | |||
| 6 | ##-------------------------------------------------------------- | ||
| 7 | ## ddcConfig.h | ||
| 8 | 3 | ▶ | sub library_version { return "2.2.8"; } |
|
Subroutine
library_version: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 9 | |||
| 10 | |||
| 11 | ##-------------------------------------------------------------- | ||
| 12 | ## ConcCommon.h: HitSortEnum | ||
| 13 | 20 | our @HitSortEnum = qw( | |
| 14 | NoSort | ||
| 15 | LessByDate GreaterByDate | ||
| 16 | LessBySize GreaterBySize | ||
| 17 | LessByFreeBiblField GreaterByFreeBiblField | ||
| 18 | LessByRank GreaterByRank | ||
| 19 | LessByMiddleContext GreaterByMiddleContext | ||
| 20 | LessByLeftContext GreaterByLeftContext | ||
| 21 | LessByRightContext GreaterByRightContext | ||
| 22 | RandomSort | ||
| 23 | LessByCountKey GreaterByCountKey | ||
| 24 | LessByCountValue GreaterByCountValue | ||
| 25 | LessByPruneKey GreaterByPruneKey | ||
| 26 | ); | ||
| 27 | 20 | our @HitSortEnumStrings = qw( | |
| 28 | no_sort | ||
| 29 | asc_by_date desc_by_date | ||
| 30 | asc_by_size desc_by_size | ||
| 31 | asc desc | ||
| 32 | asc_by_rank desc_by_rank | ||
| 33 | asc_middle desc_middle | ||
| 34 | asc_left desc_left | ||
| 35 | asc_right desc_right | ||
| 36 | random | ||
| 37 | asc_by_key desc_by_key | ||
| 38 | asc_by_count desc_by_count | ||
| 39 | prune_asc prune_desc | ||
| 40 | ); | ||
| 41 | |||
| 42 | 440 | our %HitSortEnum = ((map {($HitSortEnum[$_] =>$_)} (0..$#HitSortEnum)), | |
| 43 | 20 | (map {($HitSortEnumStrings[$_]=>$_)} (0..$#HitSortEnumStrings)) | |
| 44 | ); | ||
| 45 | 0 | ▶ | sub HitSortEnumName { return $HitSortEnum[$_[0]]; } |
|
Subroutine
HitSortEnumName: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 46 | 0 | ▶ | sub HitSortsCount { return scalar @HitSortEnum; } |
|
Subroutine
HitSortsCount: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 47 | 0 | ▶ | sub HitSortEnumString { return $HitSortEnumStrings[$_[0]]; } |
|
Subroutine
HitSortEnumString: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 48 | |||
| 49 | 20 | foreach my $ename (@HitSortEnum) { | |
| 50 | 20 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | 140 | ▶ | *$ename = sub { return $HitSortEnum{$ename}; }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 52 | } | ||
| 53 | |||
| 54 | ##====================================================================== | ||
| 55 | ## Exports | ||
| 56 | 20 | our %EXPORT_TAGS = | |
| 57 | ( | ||
| 58 | 'hitsort' => [qw(@HitSortEnum @HitSortEnumStrings %HitSortEnum HitSortEnumString), @HitSortEnum], | ||
| 59 | ); | ||
| 60 | 20 | $EXPORT_TAGS{all} = [map {@$_} values %EXPORT_TAGS]; | |
| 61 | 20 | $EXPORT_TAGS{constants} = [map {@$_} @EXPORT_TAGS{qw(hitsort)}]; | |
| 62 | 20 | our @EXPORT_OK = @{$EXPORT_TAGS{all}}; | |
| 63 | 20 | our @EXPORT = qw(); | |
| 64 | |||
| 65 | ##====================================================================== | ||
| 66 | package DDC::PP::Constants; | ||
| 67 | 20 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 68 | |||
| 69 | 20 | 1; ##-- be happy | |
| 70 | |||
| 71 | =pod | ||
| 72 | |||
| 73 | =head1 NAME | ||
| 74 | |||
| 75 | DDC::PP::Constants - pure-perl DDC::XS clone: constants | ||
| 76 | |||
| 77 | =head1 SYNOPSIS | ||
| 78 | |||
| 79 | use DDC::PP; | ||
| 80 | # or | ||
| 81 | use DDC::PP qw(:constants); | ||
| 82 | |||
| 83 | ##--------------------------------------------------------------------- | ||
| 84 | ## Top-Level constants (not exported) | ||
| 85 | |||
| 86 | $string = DDC::PP::library_version(); | ||
| 87 | |||
| 88 | ##--------------------------------------------------------------------- | ||
| 89 | ## ConcCommon.h: HitSortEnum (export-tag ":hitsort") | ||
| 90 | |||
| 91 | # enum values are also available as $DDC::PP::HitSortEnum{NoSort}, etc. | ||
| 92 | $i = DDC::PP::NoSort(); | ||
| 93 | $i = DDC::PP::LessByDate(); | ||
| 94 | $i = DDC::PP::GreaterByDate(); | ||
| 95 | $i = DDC::PP::LessBySize(); | ||
| 96 | $i = DDC::PP::GreaterBySize(); | ||
| 97 | $i = DDC::PP::LessByFreeBiblField(); | ||
| 98 | $i = DDC::PP::GreaterByFreeBiblField(); | ||
| 99 | $i = DDC::PP::LessByRank(); | ||
| 100 | $i = DDC::PP::GreaterByRank(); | ||
| 101 | $i = DDC::PP::LessByMiddleContext(); | ||
| 102 | $i = DDC::PP::GreaterByMiddleContext(); | ||
| 103 | $i = DDC::PP::LessByLeftContext(); | ||
| 104 | $i = DDC::PP::GreaterByLeftContext(); | ||
| 105 | $i = DDC::PP::LessByRightContext(); | ||
| 106 | $i = DDC::PP::GreaterByRightContext(); | ||
| 107 | $i = DDC::PP::RandomSort(); | ||
| 108 | $i = DDC::PP::LessByCountKey(); | ||
| 109 | $i = DDC::PP::GreaterByCountKey(); | ||
| 110 | $i = DDC::PP::LessByCountValue(); | ||
| 111 | $i = DDC::PP::GreaterByCountValue(); | ||
| 112 | $i = DDC::PP::LessByPruneKey(); | ||
| 113 | $i = DDC::PP::GreaterByPruneKey(); | ||
| 114 | $i = DDC::PP::HitSortsCount(); | ||
| 115 | |||
| 116 | # enum labels are also available as $DDC::PP::HitSortEnum[DDC::PP::NoSort], etc. | ||
| 117 | $s = DDC::PP::HitSortName($i); | ||
| 118 | |||
| 119 | |||
| 120 | =head1 DESCRIPTION | ||
| 121 | |||
| 122 | The DDC::PP::Constants is pure-perl fork of the L<DDC::XS::Constants|DDC::XS::Constants> module. | ||
| 123 | |||
| 124 | =head1 SEE ALSO | ||
| 125 | |||
| 126 | perl(1), | ||
| 127 | DDC::PP(3perl). | ||
| 128 | |||
| 129 | =head1 AUTHOR | ||
| 130 | |||
| 131 | Bryan Jurish E<lt>moocow@cpan.orgE<gt> | ||
| 132 | |||
| 133 | =head1 COPYRIGHT AND LICENSE | ||
| 134 | |||
| 135 | Copyright (C) 2016-2020 by Bryan Jurish | ||
| 136 | |||
| 137 | This library is free software; you can redistribute it and/or modify | ||
| 138 | it under the same terms as Perl itself, either Perl version 5.14.2 or, | ||
| 139 | at your option, any later version of Perl 5 you may have available. | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||