Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: loading files

by poolpi (Hermit)
on Dec 22, 2008 at 10:10 UTC ( [id://732022]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://732022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-20 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found