Toon posts:

[PERL] Probleem virusUpdates.pl => File nog open?

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hallo mensen,


/me gebruikt de Mime::Lite perl-module voor het virusNotification.pl script.
Nou download hij voor me de super-dat files van mcafee, en saved die ergens, het path naar die file heb ik in de var $basePage->{exeFileComp}.


Hier is de output van het programma:
[root@taiga:/home/adm/tools/sdat-check] # ./sdat-check-met-mail.pl
/home/misc/virusupdates/,/home/adm/tools/sdat-check/state/,http://*****.dyndns.org/virusupdates/
/home/misc/virusupdates/sdat4171.exe
sdat4171.exe: not readable


de regel /home/misc/virusupdates/sdat4171.exe is een print() van mezelf. Uiteindelijk stuurt de script de file naar een emailadres via de volgende sub:


sub SendMail
{
(my $recipient, my $subject, my $msg) = @_;



my $command = sprintf("chmod 664 %s%s", $DATStorageDirectory, $basePage->{exeFileComp});
system($command);


# Send Email Message
$mesg = MIME::Lite->new(
From => "$fromAddress",
To => "$recipient",
Subject => "$subject",
Type => "multipart/mixed"
);
$mesg->attach( Type => 'TEXT',
DATA => "$msg"
);
$mesg->attach( Type => 'application/octet-stream',
Path => "$basePage->{exeFilename}",
Filename => "$DATStorageDirectory$basePage->{exeFileComp}",
Disposition => 'attachment'
);
$mesg->send;
}


Alle variabelen bestaan en zijn goed ingevuld. Maar omdat ik de volgende regel kreeg: sdat4171.exe: not readable, heb ik via het system() gebeuren geprobeerd de file-perms goed te zetten, maar dat staan ze al. Dus, zou het aan het bestand zelf liggen omdat het binair is? In de README van de module staat:


MIME::Lite is intended as a simple, standalone module for generating
(not parsing!) MIME messages... specifically, it allows you to output a
simple, decent single- or multi-part message with text or binary
attachments. It does not require that you have the Mail:: or MIME::
modules installed.


Wat is het probleem hier? hoe krijg ik die exe-file de deur uit?

Bedankt!

Janno

Verwijderd

Topicstarter
In de laatste attach doetn 'ie als filename het volledige path, dus inclusief de slashes, dat was het probleem. Nu is er *nog* een probleem. Zodra ik de ->send; doe, klapt 'ie eruit met 'this part contained no data' oid. Maar ik vul ze toch echt !

-- Janno