BSON/MaxKey.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 96.8% 31 / 32 CC 2 SCAR 2.2
CC
2
Cov
100%
TO_JSON
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« BSON/Raw.pm ↑ Summary BSON/MinKey.pm »
1 71 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package BSON::MaxKey;
6 # ABSTRACT: BSON type wrapper for MaxKey
7  
8 71 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 71 our $VERSION = 'v1.12.2';
10  
11 71 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 71 my $singleton = bless \(my $x), __PACKAGE__;
14  
15 17712 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
16 17712 return $singleton;
17 }
18  
19 #pod =method TO_JSON
20 #pod
21 #pod If the C<BSON_EXTJSON> option is true, returns a hashref compatible with
22 #pod MongoDB's L<extended JSON|https://github.com/mongodb/specifications/blob/master/source/extended-json.rst>
23 #pod format, which represents it as a document as follows:
24 #pod
25 #pod {"$maxKey" : 1}
26 #pod
27 #pod If the C<BSON_EXTJSON> option is false, an error is thrown, as this value
28 #pod can't otherwise be represented in JSON.
29 #pod
30 #pod =cut
31  
32 6 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=2 SCAR=6.9
Pod documented
33 6 ▶ if ( $ENV{BSON_EXTJSON} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"BSON_EXTJSON"}) 5 1 6
34 5 return { '$maxKey' => 1 };
35 }
36  
37 1 croak( "The value '$_[0]' is illegal in JSON" );
38 }
39  
40 71 1;
41  
42 =pod
43  
44 =encoding UTF-8
45  
46 =head1 NAME
47  
48 BSON::MaxKey - BSON type wrapper for MaxKey
49  
50 =head1 VERSION
51  
52 version v1.12.2
53  
54 =head1 SYNOPSIS
55  
56 use BSON::Types ':all';
57  
58 bson_maxkey();
59  
60 =head1 DESCRIPTION
61  
62 This module provides a BSON type wrapper for the special BSON "MaxKey" type.
63 The object returned is a singleton.
64  
65 =head1 METHODS
66  
67 =head2 TO_JSON
68  
69 If the C<BSON_EXTJSON> option is true, returns a hashref compatible with
70 MongoDB's L<extended JSON|https://github.com/mongodb/specifications/blob/master/source/extended-json.rst>
71 format, which represents it as a document as follows:
72  
73 {"$maxKey" : 1}
74  
75 If the C<BSON_EXTJSON> option is false, an error is thrown, as this value
76 can't otherwise be represented in JSON.
77  
78 =for Pod::Coverage new
79  
80 =head1 AUTHORS
81  
82 =over 4
83  
84 =item *
85  
86 David Golden <david@mongodb.com>
87  
88 =item *
89  
90 Stefan G. <minimalist@lavabit.com>
91  
92 =back
93  
94 =head1 COPYRIGHT AND LICENSE
95  
96 This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.
97  
98 This is free software, licensed under:
99  
100 The Apache License, Version 2.0, January 2004
101  
102 =cut
103  
104 __END__
« BSON/Raw.pm ↑ Summary BSON/MinKey.pm »