Skip to content

suggest PREFIX option [rt.cpan.org #49726] #12

@xdg

Description

@xdg

https://rt.cpan.org/Ticket/Display.html?id=49726

It'd be good if File::Temp had a PREFIX option like

    $fh = File::Temp->new (PREFIX => 'myprog');

which would generate a file "/tmp/myprogXXXXXX".

Emacs make-temp-file has this and it's a good way to work a program name
or module name into the filename, as a hint at who's to blame for
filling up /tmp. :-)

I got the effect I wanted with a TEMPLATE, but that then needs TMPDIR
turned on explicitly, and in any case I'd rather let File::Temp decide
how many "XXXXXX"s are prudent etc.

    $fh = File::Temp->new (TEMPLATE => 'myprog-XXXXXX',
                           TMPDIR => 1);

-- 
Advertising jargon elucidated for the layman:
"Gadget" - any product which by definition you'll buy then never use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions