| 1 | # This code is part of Perl distribution Mail-Box version 4.02. | ||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||
| 4 | |||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||
| 6 | |||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | package Mail::Box::Tie::ARRAY;{ | ||||||||||
| 13 | 2 | our $VERSION = '4.02'; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 2 | ▶ | use parent 'Mail::Box::Tie'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | 2 | ▶ | use Log::Report 'mail-box', import => [ qw/__x error/ ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | use Scalar::Util qw/blessed/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | #-------------------- | ||||||||||
| 26 | |||||||||||
| 27 | sub TIEARRAY(@) | ||||||||||
| 28 | 1 | ▶ | { my ($class, $folder) = @_; | ||||||||
|
Subroutine
TIEARRAY: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 1 | $class->new($folder, 'ARRAY'); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | #-------------------- | ||||||||||
| 33 | |||||||||||
| 34 | #-------------------- | ||||||||||
| 35 | |||||||||||
| 36 | sub FETCH($) | ||||||||||
| 37 | 3 | ▶ | { my ($self, $index) = @_; | ||||||||
|
Subroutine
FETCH: called CC=2 SCAR=7.1
| |||||||||||
| 38 | 3 | my $msg = $self->folder->message($index); | |||||||||
| 39 | 3 | ▶ | $msg->isDeleted ? undef : $msg; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | sub STORE($$) | ||||||||||
| 44 | 0 | ▶ | { my ($self, $index, $msg) = @_; | ||||||||
|
Subroutine
STORE: not called CC=2 SCAR=17.9
| |||||||||||
| 45 | 0 | my $folder = $self->folder; | |||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | $index == $folder->messages | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | or error __x"cannot simply replace messages in a folder: use delete old, then push new."; | ||||||||||
| 49 | |||||||||||
| 50 | 0 | $folder->addMessages($msg); | |||||||||
| 51 | 0 | $msg; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | 6 | ▶ | sub FETCHSIZE() { scalar $_[0]->folder->messages } | ||||||||
|
Subroutine
FETCHSIZE: called CC=1 SCAR=0.0
| |||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | sub PUSH(@) | ||||||||||
| 59 | 2 | ▶ | { my $folder = shift->folder; | ||||||||
|
Subroutine
PUSH: called CC=1 SCAR=0.0
| |||||||||||
| 60 | 2 | $folder->addMessages(@_); | |||||||||
| 61 | 2 | scalar $folder->messages; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | 1 | ▶ | sub DELETE($) { $_[0]->folder->message($_[1])->delete } | ||||||||
|
Subroutine
DELETE: called CC=1 SCAR=0.0
| |||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | sub STORESIZE($) | ||||||||||
| 69 | 0 | ▶ | { my $folder = $_[0]->folder; | ||||||||
|
Subroutine
STORESIZE: not called CC=2 SCAR=17.9
| |||||||||||
| 70 | 0 | my $length = $_[1]; | |||||||||
| 71 | 0 | $folder->message($_) for $length..$folder->messages; | |||||||||
| 72 | 0 | $length; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | # DESTROY is implemented in Mail::Box | ||||||||||
| 76 | |||||||||||
| 77 | #-------------------- | ||||||||||
| 78 | |||||||||||
| 79 | 2 | 1; | |||||||||