in reply to what is the purpose of Tie::File

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: what is the purpose of Tie::File
by Lotus1 (Vicar) on Nov 11, 2012 at 23:02 UTC
    • Using perl -l gives you autochomp which Tie::File has built in. From your other nodes I see you use this frequently to add a newline when you print.
    • $^W = 1; and then use Warnings; a few lines later?
    • Using autodie means the script stops after the unlink line even if there is a file to delete. Why not just die if -e $file; ?
    • Does $| = 1; have any effect on Tie::File? With the option memory => 0 it is already not cacheing anything.

    I don't understand the point of this code. Tying to a file that doesn't exist, adding a line, then deleting the newly created file doesn't seem useful.

        What doesn't make sense to me is how a node that has so many obvious code problems can muster up a positive node reputation.


        Dave

Re^2: what is the purpose of Tie::File
by Anonymous Monk on Nov 11, 2012 at 09:11 UTC

    Having a glitch of some kind---code is coming:). Here:

    How delightfully refreshing, here's mine

    P.S.

    I fixed this for you
    $ perl delight.pl Bareword found where operator expected at delight.pl line 21, near "#l +ine 3 is now "something" (Might be a runaway multi-line "" string starting on line 19) (Missing operator before something?) String found where operator expected at delight.pl line 21, at end of +line (Missing semicolon on previous line?) syntax error at delight.pl line 21, near "#line 3 is now "something " Can't find string terminator '"' anywhere before EOF at delight.pl lin +e 21.

    It now is fixed

    $ perl delight.pl Can't unlink('file.txt'): No such file or directory at delight.pl line + 13 Can't unlink('file.txt'): No such file or directory at delight.pl line + 27 END failed--call queue aborted at delight.pl line 33.

    But I took the following next logical extra forward step in improvement

    It now runs great!

    The output is twice as much