Hi Gabor,

On Sun, 11 Dec 2011 10:47:41 +0200
Gabor Szabo <[email protected]> wrote:

> Hi,
> 
> In my Perl Tutorial http://szabgab.com/perl_tutorial.html
> I am teaching regular, 3 -parameter open and using
> 
>    while (my $row = <$fh>) { }
> 
> for reading a file. Similar way writing a file.
> 
> I got some comments that I should use and teach
> https://metacpan.org/module/IO::All instead.
> 

I like IO::All, but I sometimes find its API a little hard-to-memorise and one
that often requires referring to the documentation. This is a bit amusing.

> I discussed that and some related issues in
> http://szabgab.com/how-to-teach-modern-perl.html
> 
> I was also told to use https://metacpan.org/module/File::Slurp
> Others told me to avoid it because it does not deal with layers.
> Specifically utf8.

You can pass arguments to binmode for it.

> 
> Since then, I found https://metacpan.org/module/File::Open and I think
> it's nice.
> It improves the open() command in a way that I think more natural than
> the built-in
> open but it does not change the way you read the content.
> 
> I suggested to Lukas Mai, the author of File::Open an additional API to
> have a function called oopen that would work like the fopen of File::Open
> but would return an object on which I could call  ->slurp  or
> ->readline or ->readall.
> 
> No reply so far. I might implement it in a separate module
> and integrate later if he agrees.
> 
> So how do you read and write files?
> How would you like to read and write files?
> What do you think about my oopen idea?
> 

I usually write code using perl's built-in file I/O primitives, because I often
would rather not depend on IO-All. Sometimes I use IO-All or File-Slurp.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"Star Trek: We, the Living Dead" - http://shlom.in/st-wtld

Skill without imagination is craftsmanship and gives us many useful objects
such as wickerwork picnic baskets.  Imagination without skill gives us modern
art.            — Tom Stoppard

Please reply to list if it's a mailing list post - http://shlom.in/reply .
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to