Ignore:
Timestamp:
05/21/12 19:37:04 (12 years ago)
Author:
nanardon
Message:
  • Add documentation to LATMOS::Accounts::Mail
Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/DataRequest.pm

    r1004 r1011  
    284284 
    285285    if ($lamail->process( 
    286         {}, # no variables 
    287286        \%mail, 
    288287        )) { 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Mail.pm

    r990 r1011  
    1010use FindBin qw($Bin); 
    1111use Sys::Hostname; 
     12 
     13=head1 NAME 
     14 
     15    LATMOS::Accounts::Mail - Send mail using Template 
     16 
     17=head1 SYNOPSIS 
     18 
     19    use LATMOS::Accounts::Mail; 
     20    # Prepare the mail 
     21    my $mail = LATMOS::Accounts::Mail->new( 
     22        $la, 
     23        'foo.mail', 
     24        { 
     25            'Subject' => 'a mail', 
     26        } 
     27    ); 
     28    # Send it 
     29    $mail->process({}, { to => 'dest@domain' }); 
     30 
     31=head1 FUNCTIONS 
     32 
     33=cut 
     34 
     35=head2 LATMOS::Accounts::Mail->new($la, $template, $header) 
     36 
     37Create a new C<LATMOS::Accounts::Mail> object. C<$la> is a reference to 
     38a C<LATMOS::Accounts> object, C<$template> is the name of the template to use, 
     39C<$header> is a hashref containing default mail header to use when sending mail. 
     40 
     41=cut 
    1242 
    1343sub new { 
     
    3262} 
    3363 
     64=head2 $lamail->process($headers, $vars) 
     65 
     66Process the template as mail body and send the mail. 
     67 
     68C<$headers> is a hashref to header to use to send the mail (See 
     69L<Mail::Sendmail>. 
     70 
     71C<$var> is a hashref to be used by L<Template>. 
     72 
     73=cut 
     74 
    3475sub process { 
    35     my ($self, $vars, $headers) = @_; 
     76    my ($self, $headers, $vars) = @_; 
     77 
     78    $vars ||= {}; 
    3679 
    3780    my $message; 
     
    79122} 
    80123 
     124=head1 SEE ALSO 
     125 
     126L<Template>, L<Mail::Sendmail> 
     127 
     128=head1 AUTHOR 
     129 
     130Thauvin Olivier, E<lt>olivier.thauvin@latmos.ipsl.fr<gt> 
     131 
     132=head1 COPYRIGHT AND LICENSE 
     133 
     134Copyright (C) 2012 by Thauvin Olivier 
     135 
     136This library is free software; you can redistribute it and/or modify 
     137it under the same terms as Perl itself, either Perl version 5.10.0 or, 
     138at your option, any later version of Perl 5 you may have available. 
     139 
     140=cut 
     141 
    811421; 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Maintenance.pm

    r990 r1011  
    110110        ); 
    111111        my $message; 
    112         if ($lamail->process($user, \%mail)) { 
     112        if ($lamail->process(\%mail, $user)) { 
    113113            la_log(LA_NOTICE, "Expiration mail for %s (%s) sent to %s; cc %s", 
    114114                $user->{obj}->id, 
     
    132132                my %mail = ( 
    133133                ); 
    134                 if ($summail->process({}, { 
     134                if ($summail->process({ 
    135135                    Subject => 'LATMOS account expiration summary', 
    136136                    To => $self->val('_default_', 'expire_summary_to'), 
     
    185185        ); 
    186186        $mail{to} = $options{to} || $mail; 
    187         if ($lamail->process($managers{$oman->id}, \%mail)) { 
     187        if ($lamail->process(\%mail, $managers{$oman->id})) { 
    188188            la_log(LA_NOTICE, 
    189189                "Expired account reminder mail for %s sent to %s (cc: %s) for %s", 
     
    223223                    $self, \join('', @summary), {} 
    224224                ); 
    225                 if ($summail->process({}, \%mail)) { 
     225                if ($summail->process(\%mail)) { 
    226226                    la_log(LA_NOTICE, "Expiration summary mail sent to %s", 
    227227                        $self->val('_default_', 'expire_summary_to'), 
Note: See TracChangeset for help on using the changeset viewer.