Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I just read through this post on Tilly's advice on using File::Temp and it looks like just the recommendation I need. Unfortunately, my company doesnt stock File::Temp as a module, and the systems group is somewhat reluctant to field module requests from one of the network guys.
I read through IO::File's description on CPAN and found the new_tmpfile however it left me somewhat confused. My goal is to write to a completely random file and then attach it to an outbound email using Mail::Sender. For example...

## create message with attachment $sender->MailFile({ to => "$username\@mycompany.inc", subject => "$subject", msg => "Attached is the info you need!", file => "$tmpfile", });

Try as I might using IO::File, attaching the tmp file is just not happening. Maybe I am trying to use the temporary file for purposes that it's really not meant for?

Perhaps its easier to state the reason I need the tmpfile. My script will parse several configuration files and return the information to user as a CSV file attached to an email. I'd like to write to a completely randomly named file so that a devious individual won't try any of the tricks of symlinking a known output file's name to some other file/area on the machine in the hopes of causing trouble. Make sense?

Any help is appreciated. Humbly -c

ps. thanks again ybiC for that original post. i find most of my answers simply by perusing your writeups...


In reply to Creating temporary files without File::Temp by c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2024-04-25 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found