| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Podman::Containers; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 547303 | use Mojo::Base 'Podman::Client'; | 
|  | 2 |  |  |  |  | 11 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 2 |  |  | 2 |  | 238 | use Mojo::Collection; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 72 |  | 
| 6 | 2 |  |  | 2 |  | 12 | use Scalar::Util qw(blessed); | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 129 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 2 |  |  | 2 |  | 453 | use Podman::Container; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 603 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has 'names_only' => undef; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub list { | 
| 13 | 1 |  |  | 1 | 1 | 30881 | my $self = shift; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 | 50 |  |  |  | 31 | if (!blessed($self)) { | 
| 16 | 0 |  |  |  |  | 0 | $self = __PACKAGE__->new(); | 
| 17 | 0 |  |  |  |  | 0 | my %opts = @_; | 
| 18 | 0 |  |  |  |  | 0 | $self->names_only($opts{names_only}); | 
| 19 |  |  |  |  |  |  | } | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 1 |  |  |  |  | 73 | my $images = $self->get('containers/json', parameters => {all => 1},)->json; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | my @list = map { | 
| 24 | 1 |  | 50 |  |  | 16 | my $name = $_->{Names}->[0] || 'none'; | 
| 25 | 1 | 50 |  |  |  | 72 | $self->names_only ? $name : Podman::Container->new(name => $name); | 
| 26 | 1 |  |  |  |  | 277 | } @{$images}; | 
|  | 1 |  |  |  |  | 3 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 1 |  |  |  |  | 78 | return Mojo::Collection->new(@list); | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | sub prune { | 
| 32 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 0 | 0 |  |  |  |  | $self = __PACKAGE__->new() unless blessed($self); | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 0 |  |  |  |  |  | $self->post('containers/prune'); | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 0 |  |  |  |  |  | return 1; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | 1; | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | __END__ |