Reference

OpenBSD::MkTemp(3p)

Perl access to mkstemps() and mkdtemp()

NAME

OpenBSD::MkTemp - Perl access to mkstemps() and mkdtemp()

SYNOPSIS

  use OpenBSD::MkTemp;
  my($fh, $file) = mkstemp("/tmp/fooXXXXXXXXXX");
  use OpenBSD::MkTemp qw(mkdtemp mkstemps);
  my $dir_name = mkdtemp("/tmp/dirXXXXXXXXXX");
  my ($fh, $file) = mkstemps("/tmp/fileXXXXXXXXXX", ".tmp");

DESCRIPTION

This module provides routines for creating files and directories with guaranteed unique names, using the C mkstemps() and mkdtemp() routines.

mkstemp() and mkstemps() must be called with a template argument that is writable, so that they can update it with the path of the generated file. They return normal perl IO handles.

mkdtemp() simply takes the template and returns the path of the newly created directory.

EXPORT

  $fh = mkstemp($template)

Exportable functions

  $fh = mkstemps($template, $suffix_len)
  $dir = mkdtemp($template);

SEE ALSO

mkstemp(3)

AUTHOR

Philip Guenther, <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Philip Guenther

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.2 or, at your option, any later version of Perl 5 you may have available.

History