Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
In Linux:
PolettiX:~# dd if=/dev/zero of=testfile bs=1024 count=1024 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.019164 seconds (54715967 bytes/sec) PolettiX:~# PolettiX:~# PolettiX:~# mkfs.ext2 testfile mke2fs 1.37 (21-Mar-2005) testfile is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 128 inodes, 1024 blocks 51 blocks (4.98%) reserved for the super user First data block=1 1 block group 8192 blocks per group, 8192 fragments per group 128 inodes per group Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. PolettiX:~# PolettiX:~# PolettiX:~# mount testfile -o loop /mnt

Now you have a filesystem that will be easy to fill up:

#!/usr/bin/perl use strict; use warnings; use Fatal qw( open close ); chdir '/mnt'; { open my $fh, '>', 'prova.dat'; print {$fh} "ciao\n" for 1 .. 1000000; # close $fh; } print {*STDERR} "should be closed here!\n";

In my system, the final string on STDERR gets printed when the close above is commented; uncommenting the close triggers the fatal error:

Can't close(GLOB(0x814cd4c)): No space left on device at (eval 2) line + 3 main::__ANON__('GLOB(0x814cd4c)') called at ./prova.pl line 13

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

In reply to Re: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle? by polettix
in thread How do I make the garbage collector throw an exception when it fails to auto-close a filehandle? by Aristotle

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 musing on the Monastery: (11)
    As of 2014-11-28 08:46 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (194 votes), past polls