Mojo/Autobox/Array.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 2 / 2 totaltotal 100% 16 / 16 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
collection
1.0
json
1.0
CRAP 1.0
« Mojo/Autobox.pm ↑ Summary Mojo/Autobox/Hash.pm »
1 package Mojo::Autobox::Array;
2  
3 4 ▶use Mojo::Base -strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶sub collection {
Subroutine collection: called CC=1 SCAR=0.0
Pod documented
6 2 require Mojo::Collection;
7 2 Mojo::Collection->new(@{shift()});
8 }
9  
10 4 *c = \&collection;
11  
12 2 ▶sub json {
Subroutine json: called CC=1 SCAR=0.0
Pod documented
13 2 require Mojo::JSON;
14 2 Mojo::JSON::encode_json(shift);
15 }
16  
17 4 *j = \&json;
18  
19 4 1;
20  
21 =head1 NAME
22  
23 Mojo::Autobox::Array - Autobox array methods for Mojo::Autobox
24  
25 =head1 SYNOPSIS
26  
27 use Mojo::Autobox;
28  
29 # "a"
30 [qw/a b c/]->collection->first;
31  
32 # '["x", "y", "z"]'
33 @array = (qw/x y z/);
34 @array->json;
35  
36 =head1 DESCRIPTION
37  
38 Array methods for L<Mojo::Autobox>. These methods also apply to array references.
39  
40 =head1 METHODS
41  
42 =head2 collection
43  
44 Returns an instance of L<Mojo::Collection>, contructed from the elements of the invocant array.
45  
46 =head2 json
47  
48 Serializes the invocant array using L<Mojo::JSON/encode_json> and returns the result.
49  
50 =head2 j
51  
52 An alias for L</json>.
53  
« Mojo/Autobox.pm ↑ Summary Mojo/Autobox/Hash.pm »