#!/usr/bin/perl -w # filetemptest.pl # 2001-01-18 # File::Temp 0.11 Perl 5.00503 # File::Spec 0.82 Debian 2.2 "Espy" use strict; use File::Temp qw(tempfile ); #tempdir ); &WERX(); &WERX2(); &DUNWERK(); &DUNWERK2(); ################################################################## sub DUNWERK2 { my $template = 'dunwerk2XXXXXXXXXX'; my $dir = '/tmp/'; my $path = '/tmp/'; (my $fh, my$filename) = tempfile($template, DIR => $dir); print "\nCreated filehandle $fh with filename $filename.\n\n"; print "Press (almost) any key to unlink.\n"; my $continue = (); unlink0 ($fh, $path) or die " num4: Error unlinking file $path safely.\n"; } ################################################################## sub DUNWERK { my $template = 'dunwerkXXXXXXXXXX'; my $dir = '/tmp/'; my $fh = tempfile($template, DIR => $dir); print "\nCreated filehandle $fh.\n"; print "Press (almost) any key to continue\n"; my $continue = (); } ################################################################## sub WERX2 { my $template = 'werx2XXXXXXXXXX'; my $dir = '/tmp/'; (my $fh, my$filename) = tempfile($template, DIR => $dir); print "\nCreated filehandle $fh with filename $filename.\n\n"; print "Press (almost) any key to continue\n"; my $continue = (); } ################################################################## sub WERX { (my $fh, my $filename) = tempfile(); print "\nCreated filehandle $fh with filename $filename.\n"; print "Press (almost) any key to continue\n"; my $continue = (); } ##################################################################