in reply to CGI::Uploader: Using closures to improve a declarative interface.

How is your new method different from?:

spec => { img_1 => { gen_files => { img_1_thmb_1 => sub { gen_thumb({w=>100, h=>100}) }, img_1_thmb_2 => sub { gen_thumb({w=>50, h=>50}) }, } } }
I guess I don't quite understand...
<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law
  • Comment on Re: CGI::Uploader: Using closures to improve a declarative interface.
  • Download Code

Replies are listed 'Best First'.
Re^2: CGI::Uploader: Using closures to improve a declarative interface.
by diotalevi (Canon) on Dec 19, 2005 at 15:54 UTC
    It's better syntax and good policy to remove unimportant stuff.
Re^2: CGI::Uploader: Using closures to improve a declarative interface.
by dragonchild (Archbishop) on Dec 19, 2005 at 16:34 UTC
    More importantly, you don't force the user to understand anonymous subs, which are an advanced topic.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re^2: CGI::Uploader: Using closures to improve a declarative interface.
by eric256 (Parson) on Dec 19, 2005 at 17:18 UTC

    That new version still doesn't pass the filename on to gen_thumb...unless I missed something. So its different because its not the same? More simply, gen_thumb is returning a subroutine with the width and heigth already set. That new routine is then passed the filename when its time to actualy generate the thumbnail. /me wonders then if closures are just another way to achieve function currying.


    ___________
    Eric Hodges $_='y==QAe=e?y==QG@>@?iy==QVq?f?=a@iG?=QQ=Q?9'; s/(.)/ord($1)-50/eigs;tr/6123457/- \/|\\\_\n/;print;