use strict;
use warnings;
use Carp 'croak';
-use Exporter 'import';
use List::Util;
use Scalar::Util 'blessed';
our $VERSION = '0.001';
-our @EXPORT_OK = ('c');
-
-sub c { __PACKAGE__->new(@_) }
-
sub new {
my $class = shift;
return bless [@_], ref $class || $class;
say "$num: $word";
});
- # Use the alternative constructor
- use DOM::Tiny::Collection 'c';
- c(qw(a b c))->join('/')->url_escape->say;
-
=head1 DESCRIPTION
L<DOM::Tiny::Collection> is an array-based container for collections of
$collection->[23] += 100;
say for @$collection;
-=head1 FUNCTIONS
-
-L<DOM::Tiny::Collection> implements the following functions, which can be imported
-individually.
-
-=head2 c
-
- my $collection = c(1, 2, 3);
-
-Construct a new array-based L<DOM::Tiny::Collection> object.
-
=head1 METHODS
L<DOM::Tiny::Collection> implements the following methods.
use strict;
use warnings;
use Test::More;
-use DOM::Tiny::Collection 'c';
+use DOM::Tiny::Collection;
use JSON::PP ();
+sub c { DOM::Tiny::Collection->new(@_) }
+
# Array
is c(1, 2, 3)->[1], 2, 'right result';
is_deeply [@{c(3, 2, 1)}], [3, 2, 1], 'right result';