/usr/share/perl5/Octopussy/Export.pm is in octopussy 1.0.6-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | # $HeadURL$
# $Revision: 353 $
# $Date: 2010-05-17 18:44:55 +0100 (Mon, 17 May 2010) $
# $Author: sebthebert $
=head1 NAME
Octopussy::Export - Octopussy Export module
=cut
package Octopussy::Export;
use strict;
use warnings;
use Net::FTP;
use Net::SCP;
use AAT::SMTP;
use AAT::Utils qw( NOT_NULL );
=head1 FUNCTIONS
=head2 Using_Ftp($conf_ftp, $file)
Export file '$file' using FTP with '$conf_ftp' configuration
=cut
sub Using_Ftp
{
my ($conf_ftp, $file) = @_;
if (NOT_NULL($conf_ftp->{host}))
{
my $ftp = Net::FTP->new($conf_ftp->{host}, Passive => 0);
$ftp->login($conf_ftp->{user}, $conf_ftp->{pwd});
$ftp->cwd($conf_ftp->{dir});
$ftp->binary();
$ftp->put($file);
return ($file);
}
return (undef);
}
=head2 Using_Mail($conf_mail, $file)
Export file '$file' using Mail with '$conf_mail' configuration
=cut
sub Using_Mail
{
my ($conf_mail, $file) = @_;
if (NOT_NULL($conf_mail->{recipients}))
{
my @dests = ();
foreach my $r (split /,/, $conf_mail->{recipients}) { push @dests, $r; }
AAT::SMTP::Send_Message(
'Octopussy',
{
subject => $conf_mail->{subject},
body => 'Report generated by Octopussy',
file => $file,
dests => \@dests
}
);
return (scalar @dests);
}
return (undef);
}
=head2 Using_Scp($conf_scp, $file)
Export file '$file' using Scp with '$conf_scp' configuration
=cut
sub Using_Scp
{
my ($conf_scp, $file) = @_;
if (NOT_NULL($conf_scp->{host}))
{
my $scp = Net::SCP->new($conf_scp->{host}, $conf_scp->{user});
$scp->scp($file, $conf_scp->{dir});
print $scp->{errstr};
return ($file);
}
return (undef);
}
1;
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=cut
|