Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Good monk ChOas showed me that I needed to import "unlink0".   And I replaced $path in DUNWERK2 with $filehandle and renamed function to NOWITWERX.   Also fixed typo by replacing my$filename with my $filename in 2 places.  

That seems to fix everything, except DUNWERK still doesn't appear to create tempfile.   Since I can now create and unlink with NOWITWORKS syntax, this is good enough for now.   Thanks and ++ to ChOas.   8^)

Updated codelet below.

#!/usr/bin/perl -w # filetemptest.pl # 2001-01-19 # 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 unlink0); &WERX(); &WERX2(); &DUNWERK(); &NOWITWERX(); ################################################################## sub NOWITWERX { my $template = 'nowitwerxXXXXXXXXXX'; 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 unlink.\n"; my $continue = (<STDIN>); unlink0 ($fh, $filename) or die " NOWITWERX: Error unlinking file + $filename 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 = (<STDIN>); } ################################################################## 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 = (<STDIN>); } ################################################################## 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 = (<STDIN>); } ##################################################################

In reply to (code) Re: can create with File::Temp but not unlink (close enough 8^) by ybiC
in thread can create with File::Temp but not unlink by ybiC

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (9)
    As of 2014-07-14 11:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (258 votes), past polls