Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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 ./ line 13

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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (5)
    As of 2015-11-26 17:46 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (705 votes), past polls