Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Creating temporary files without File::Temp

by Sinister (Friar)
on Feb 28, 2002 at 15:03 UTC ( [id://148231]=note: print w/replies, xml ) Need Help??


in reply to Creating temporary files without File::Temp

I usualy use POSIX::tmpnam for this. It returns a still available file name for the /tmp dir. (eg: /tmp/fileErjARC). example code:
use POSIX qw(tmpnam); use strict; # || loose XP. use Sender; # ? my $tmpfile = tmpnam(); open(OUT, ">$tmpfile") || die("Can't write tmp-file"); print OUT "data ... data ... data\n"; close(OUT); my $sender = Sender new; ## create message with attachment $sender->MailFile({ to => "$username\@mycompany.inc", subject => "$subject", msg => "Attached is the info you need!", file => "$tmpfile", }); unlink $tmpfile;

I guess this is what you meant?

Sinister greetings.
"With tying hashes you can do everything God and Larry have forbidden" -- Johan Vromans - YAPC::Europe 2001
perldoc -q $_

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found