line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Typesense::Version; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
45
|
use Moo; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
22
|
|
4
|
4
|
|
|
4
|
|
1552
|
use Carp qw(croak); |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
242
|
|
5
|
4
|
|
|
|
|
29
|
use Search::Typesense::Types qw( |
6
|
|
|
|
|
|
|
NonEmptyStr |
7
|
|
|
|
|
|
|
PositiveOrZeroInt |
8
|
4
|
|
|
4
|
|
24
|
); |
|
4
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has version_string => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
isa => NonEmptyStr, |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has [qw/major minor patch/] => ( |
19
|
|
|
|
|
|
|
is => 'rwp', |
20
|
|
|
|
|
|
|
isa => PositiveOrZeroInt, |
21
|
|
|
|
|
|
|
init_arg => undef, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
25
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
26
|
0
|
|
|
|
|
|
my $version = $self->version_string; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# this isn't quite semver, but it seems to fit what Typesense is doing |
29
|
|
|
|
|
|
|
# See https://semver.org/ if this breaks |
30
|
0
|
0
|
|
|
|
|
unless ( $version =~ /^\d+\.\d+\.\d+$/a ) { |
31
|
0
|
|
|
|
|
|
croak("Invalid version string: $version"); |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
|
my @version = split /\./ => $version; |
34
|
0
|
|
|
|
|
|
$self->_set_major( $version[0] ); |
35
|
0
|
|
|
|
|
|
$self->_set_minor( $version[1] ); |
36
|
0
|
|
|
|
|
|
$self->_set_patch( $version[2] ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub comparator { |
40
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
return sprintf "%03d%03d%03d" => $self->major, $self->minor, $self->patch; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Search::Typesense::Version - Version object for the Typesense server |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Do not use directly. This is returned by the C<typesense_version> method from |
55
|
|
|
|
|
|
|
L<Search::Typesense>. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C<version_string> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $version = $typesense->typesense_version; |
62
|
|
|
|
|
|
|
my $version_string = $version->version_string; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns the semantic version string, such as C<0.19.0>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C<major> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $version = $typesense->typesense_version; |
69
|
|
|
|
|
|
|
my $major = $version->major; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns the major version number. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 C<minor> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $version = $typesense->typesense_version; |
76
|
|
|
|
|
|
|
my $minor = $version->minor; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns the minor version number. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 C<patch> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $version = $typesense->typesense_version; |
83
|
|
|
|
|
|
|
my $patch = $version->patch; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the patch version number. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 C<comparator> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns a numeric string suitable for numeric comparisons between versions. |