in reply to loading files

Mail::Internet->new( ARG, OPTIONS );
This constructor is waiting for a file descriptor or a reference to an array
From the doc :
ARG is optional and may be either a file descriptor (reference to a GLOB) or a reference to an array.

So ARGV[0] is your file to be opened (or slurped).

Almost Same thing with $parser->parse( INSTREAM );
From the doc :
The INSTREAM can be given as an IO::File, a globref filehandle (like \*STDIN), or as any blessed object conforming to the IO:: interface (which minimally implements getline() and read()).


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Replies are listed 'Best First'.
Re^2: loading files
by Bass-Fighter (Beadle) on Dec 22, 2008 at 10:37 UTC
    when I change Mail::Internet->new(ARGV[0]); into Mail::Internet->new( ARG, OPTIONS );
    and my $entity = $parser->parse(ARGV[0]); into my $entity = $parser->parse(INSTREAM);

    I got this:
    Bareword "ARG" not allowed while "strict subs" in use at emailprogramma3.txt line 13.
    Bareword "OPTIONS" not allowed while "strict subs" in use at emailprogramma3.txt line 13.
    Bareword "INSTREAM" not allowed while "strict subs" in use at emailprogramma3.txt line 36.
    Execution of emailprogramma3.txt aborted due to compilation errors.

    and now?

      Try

      my $mail_file = $ARGV[0]; open my $mail_fh, "<", $mail_file or die "Couldn't open '$mail_file': +$!";

      and then put $mail_fh where you now have $ARGV[0].

        he will not doing anything with the piece that filters the filename of the attachment. i get: Use of uninitialized value in string ne at emailprogramma3.txt line 71 (the line with if ($file ne ""){ in it) that is the place where I want to print the filename.
        the other piece (mail::internet) works perfectly.