good chemistry is complicated,
and a little bit messy -LW
Temporary file management in Perl -- is it possible?by taint (Chaplain)
|on Apr 24, 2013 at 20:12 UTC||Need Help??|
taint has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings, I'm trying to discover if I can give a temporary file a "Life Span"
in Perl. Is such a thing even possible? My sutuation:
I'm generating a symlink (perlfunc=>symlink) that prefaces a semi-random
number to the $filehandle, thusly:
This much returns the anticipated/expected results. However,
I want the newly created symlink to "vanish" (perlfunc=>unlink)
after --say, a 10 minute period. Is there ANY way to tell Perl to unlink
the symlink -- like creating a timer, or something? I'm not sure where to go with
this. I could create a cronjob. But I would really rather keep
this "self-contained" if it's even remotely possible.
Thank you for all your time, and consideration.
UPDATE It also occurred to me that a session || sessions, might also be a solution.
In the "big picture" these "temporary" symlink(s), are largish files of complete systems for
embedded systems. I only want them to become available for those that actually want to use them --
not to embellish other ppl's web pages, and for "bots" to suck down ~50 times/day. So
it occurs to me that the "Life Span" of the file could be tied to a session.
Is that possible, or a better approach?
#!/usr/bin/perl -Tw use perl::always; my $perl_version = "5.12.4"; print $perl_version;