Re: IO::ALL (Was: check for errors on close())

2005-04-27 Thread Smylers
Sam Vilain writes:

 Smylers wrote:
 
  Sam (or any other IO::All users reading this), what's your
  experience of IO::All?  How much effort has it saved you?  Does it
  make your code look

Hi Sam -- thanks for taking the time to answer.

 I've only just begun to reap the benefits of it.

After how long of using it?  Does that mean that initially you found it
more hassle?

 Now, it seems that the built-in ways of doing these things are just
 too awkward.

That strengthens my feeling that Ingy is on to something with his
shorter syntax, and that Perl 6 should benefit from many of his ideas.

 Just this morning I cursed as I had to change;

While that strengthens my feeling that in Perl 5 the benefits of IO::All
typically aren't enough to make it worth having the module as a
dependency -- it isn't yet ubiquitous, and there are situations where
it's easier not to bother installing it and make do without instead.

   my @mp3s = grep { -f } @ARGV, ($m3u?io($m3u):());

The behaviour of that line wasn't immediately apparent to me.  Obviously
it does the same as the line below that you replaced it with, but even
after looking at the IO::All docs (well, the synopsis anyway -- they're
too long for me to be bothered to read all of them!) I can't work it
out.  I'd've expected you to need to write something like:

  my @mp3s = grep { -f } @ARGV, ($m3u?io($m3u)-chomp-slurp:());

 to:
 
   my @mp3s = grep { -f } @ARGV, ($m3u?(map{chomp;$_}`cat $m3u`):());

Hmmm, that does look rather messy (as well as having the platform-
dependent cat and the potentially insecure backticks).  I'm not sure how
I'd've written it; perhaps like this:

  use Path::Class qwfile;
  # ...
  push @ARGV, (file $m3u)-slurp if $m3u;
  chomp @ARGV;
  my @mp3s = grep { -f } @ARGV;

But the fact that Perl's built-in way of slurping isn't convenient shows
that there is a desire to use a module (whether IO::All, Path::Class, or
File::Slurp), and IO::All's chomp method looks nice -- that the built-in
chomp function doesn't return the chomped list makes my version above
more awkward than I'd like.

Perhaps Path::Class::File should steal IO::All's chomp method?  (Or
perhaps that would start to bloat what is currently a very clean and
elegant suite of modules -- and if we keep doing things like that we'd
just end up turning Path::Class into IO::All, thereby proving that Ingy
was right in the first place.)

 Clearly, there are two fairly opposite morals to read from that story.

Indeed!

 And I think I've just about listed all that Spiffy does, so don't
 worry about it!  :)

Fair enough -- I wasn't really worrying about it, just a little curious.
Also, I'm open to being persuaded to start using it myself (but haven't
yet 'got it' sufficient to see what it'd do for me).

Smylers
-- 
May God bless us with enough foolishness to believe that we can make a
difference in this world, so that we can do what others claim cannot be done.



Re: Bootstrapping a module community

2005-04-27 Thread Adrian Howard
On 24 Apr 2005, at 15:48, John Siracusa wrote:
What's the best way to spread the word about a new module?  I've got a 
few
modules that I think a lot of people would find useful.  They're still 
in
active development (pre-1.0) but I'd like as many people as possible 
to try
them so I can get feedback from the community.  How do I spread the 
word
about these modules?
[snip]
For me the best to get me to try something would be to demonstrate how 
excellently it does X better than any of the alternatives - whatever X 
may be.

Write a blog entry, a perlmonks meditation, an article. Don't tell me 
why it's better - show me why it's better. Examples trump verbiage.

Cheers,
Adrian


Re: IO::ALL (Was: check for errors on close())

2005-04-27 Thread Sam Vilain
Smylers wrote:
I've only just begun to reap the benefits of it.
After how long of using it?  Does that mean that initially you found it
more hassle?
No, not at all.  I've just only found myself using it twice so far.
However, when I did I found it deliciously DWIMmy and extremely handy.
eg, in http://svn.kwiki.org/ingy/Perldoc/lib/Perldoc/MugReader.pm I use
it to accept a filehandle, string, filename, etc - whilst still being
able to treat them all as if they were files, as well as knowing that
now my module can accept URIs too!
Now, it seems that the built-in ways of doing these things are just
too awkward.
That strengthens my feeling that Ingy is on to something with his
shorter syntax, and that Perl 6 should benefit from many of his ideas.
So come on over to p6l!  :)
Or, actually it's probably better to join in the pugs crowd and
contribute an update to S29 based on IO::All and Path::Class.  Perhaps
there is even enough in Pugs to be able to start a basic implementation?
At least the non-OO interface, anyway.
Sam.