| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 1 |  |  | 1 |  | 692 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 2 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 62 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | package App::Addex::Plugin::Nobody; | 
| 5 |  |  |  |  |  |  | { | 
| 6 |  |  |  |  |  |  | $App::Addex::Plugin::Nobody::VERSION = '0.005'; | 
| 7 |  |  |  |  |  |  | } | 
| 8 | 1 |  |  | 1 |  | 24 | use 5.006; # our | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 9 | 1 |  |  | 1 |  | 676 | use Sub::Install; | 
|  | 1 |  |  |  |  | 1753 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 10 |  |  |  |  |  |  | # ABSTRACT: automatically add a recipient that goes nowhere | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub import { | 
| 14 | 0 |  |  | 0 |  |  | my ($mixin, %arg) = @_; | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 0 |  | 0 |  |  |  | my $group_name = $arg{group} || 'undisclosed-recipients'; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 0 |  |  |  |  |  | require App::Addex::Entry; | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 0 | 0 | 0 |  |  |  | my $nobody = App::Addex::Entry->new({ | 
| 22 |  |  |  |  |  |  | name   => $arg{name} || 'Undisclosed Recipients', | 
| 23 |  |  |  |  |  |  | nick   => exists $arg{nick} ? $arg{nick} : 'nobody', | 
| 24 |  |  |  |  |  |  | fields => { skip_hiveminder => 1 }, | 
| 25 |  |  |  |  |  |  | emails => [ | 
| 26 |  |  |  |  |  |  | App::Addex::Entry::EmailAddress->new({ | 
| 27 |  |  |  |  |  |  | address  => "$group_name: ;", | 
| 28 |  |  |  |  |  |  | sends    => 0, | 
| 29 |  |  |  |  |  |  | receives => 1, | 
| 30 |  |  |  |  |  |  | }), | 
| 31 |  |  |  |  |  |  | ], | 
| 32 |  |  |  |  |  |  | }); | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 0 |  |  |  |  |  | my $caller = caller; | 
| 35 | 0 |  |  |  |  |  | my $original_sub = $caller->can('entries'); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | my $new_entries = sub { | 
| 38 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 0 |  |  |  |  |  | my @entries = $self->$original_sub; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 0 |  |  |  |  |  | return (@entries, $nobody); | 
| 43 | 0 |  |  |  |  |  | }; | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  |  | Sub::Install::reinstall_sub({ | 
| 46 |  |  |  |  |  |  | code => $new_entries, | 
| 47 |  |  |  |  |  |  | into => $caller, | 
| 48 |  |  |  |  |  |  | as   => 'entries', | 
| 49 |  |  |  |  |  |  | }); | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | 1; | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | __END__ | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =pod | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head1 NAME | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | App::Addex::Plugin::Nobody - automatically add a recipient that goes nowhere | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 VERSION | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | version 0.005 | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | The only valid "To" header that doesn't imply delivery somewhere | 
| 69 |  |  |  |  |  |  | looks something like this: | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | To: undisclosed-recipients: ; | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | This plugin adds a virtual entry to your address book with that address. | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head1 CONFIGURATION | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | First, you have to add the plugin to your Addex configuration file's top | 
| 78 |  |  |  |  |  |  | section: | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | plugin = App::Addex::Plugin::Nobody | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | You can supply the following options for the plugin: | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | name  - the "full name" to use (default: "Undisclosed Recipients") | 
| 85 |  |  |  |  |  |  | nick  - the nick (if any) to provide (default: nobody) | 
| 86 |  |  |  |  |  |  | group - the name of the address group (default: undisclosed-recipients) | 
| 87 |  |  |  |  |  |  | this option is not well-validated, so maybe you should leave it alone | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | The entry will have a true C<skip_hiveminder> field, to avoid bizarre | 
| 90 |  |  |  |  |  |  | interactions with the Hiveminder plugin. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =head1 AUTHOR | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | Ricardo SIGNES <rjbs@cpan.org> | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | This software is copyright (c) 2008 by Ricardo SIGNES. | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 101 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =cut |