| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Elastic::Model::Deleted; | 
| 2 |  |  |  |  |  |  | $Elastic::Model::Deleted::VERSION = '0.51'; | 
| 3 | 23 |  |  | 23 |  | 126 | use Moose; | 
|  | 23 |  |  |  |  | 46 |  | 
|  | 23 |  |  |  |  | 189 |  | 
| 4 | 23 |  |  | 23 |  | 139361 | use strict; | 
|  | 23 |  |  |  |  | 106 |  | 
|  | 23 |  |  |  |  | 1051 |  | 
| 5 | 23 |  |  | 23 |  | 113 | use warnings; | 
|  | 23 |  |  |  |  | 45 |  | 
|  | 23 |  |  |  |  | 778 |  | 
| 6 | 23 |  |  | 23 |  | 125 | use Carp; | 
|  | 23 |  |  |  |  | 43 |  | 
|  | 23 |  |  |  |  | 1833 |  | 
| 7 | 23 |  |  | 23 |  | 145 | use namespace::autoclean; | 
|  | 23 |  |  |  |  | 43 |  | 
|  | 23 |  |  |  |  | 246 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has 'uid' => ( | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | is       => 'ro', | 
| 13 |  |  |  |  |  |  | isa      => 'Elastic::Model::UID', | 
| 14 |  |  |  |  |  |  | required => 1, | 
| 15 |  |  |  |  |  |  | ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 0 |  |  | 0 |  |  | sub _can_inflate     {0} | 
| 19 | 0 |  |  | 0 |  |  | sub _inflate_doc     { } | 
| 20 | 0 |  |  | 0 | 1 |  | sub has_been_deleted {1} | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | our $AUTOLOAD; | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | sub AUTOLOAD { | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 29 | 0 |  |  |  |  |  | my $uid  = $self->uid; | 
| 30 | 0 |  |  |  |  |  | croak | 
| 31 |  |  |  |  |  |  | sprintf( | 
| 32 |  |  |  |  |  |  | "Object type (%s) with ID (%s) in index (%s) has been deleted", | 
| 33 |  |  |  |  |  |  | $uid->type, $uid->id, $uid->index ); | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | 1; | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =pod | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =encoding UTF-8 | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 NAME | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Elastic::Model::Deleted - A class to represent deleted doc objects which are still in scope | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 VERSION | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | version 0.51 | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | When an object in scope is deleted, it is reblessed into | 
| 55 |  |  |  |  |  |  | Elastic::Model::Deleted, which throws an error if any method other than | 
| 56 |  |  |  |  |  |  | those listed below are called. | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | For instance: | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | $user = $domain->get( user => 1 ); | 
| 61 |  |  |  |  |  |  | $user->delete; | 
| 62 |  |  |  |  |  |  | print $user->name; | 
| 63 |  |  |  |  |  |  | # throws error | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head2 uid | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | $uid = $deleted_doc->uid | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | The original UID of the deleted doc. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 METHODS | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head2 has_been_deleted() | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | 1 == $deleted->has_been_deleted() | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | Returns true without checking Elasticsearch. This method is provided | 
| 80 |  |  |  |  |  |  | so that it can be called in an L<Elastic::Model::Role::Doc/on_conflict> | 
| 81 |  |  |  |  |  |  | handler. | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | Also see L<Elastic::Model::Role::Doc/has_been_deleted()>. | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 AUTHOR | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | Clinton Gormley <drtech@cpan.org> | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | This software is copyright (c) 2015 by Clinton Gormley. | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 94 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =cut | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | __END__ | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | # ABSTRACT: A class to represent deleted doc objects which are still in scope | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  |  |