On 2005-12-18, Jeff MacDonald <[EMAIL PROTECTED]> wrote:
>            'img_1_thmb_1' => {
>              if_mimetype => '/^image\/.+/',
>              transform_method => \&gen_thumb,
>              params => [ w => 100, h => 100 ],
>              }

First, let's rewrite this in the new 2.0 syntax:

  'img_1_thmb_1' => {
      if_mimetype => '/^image\/.+/',
      transform_method => gen_thumb({ w => 100, h => 100 }),
 }

Ah, better. 

I can see the value of what you are trying to solve (optionally
generating files). I would take further, allow not just one zero or  
possibility,
but many:

 'img_1_thmb_1' => {
      mime_regexp_map => {
        qr{^image} =>  gen_thumb({ w => 100, h => 100 }),
        # encrypt text files with fictional 'encrypt()' function. 
        qr{^text}  =>  encrypt( key => $sec ),
     }
 }

I realize another interface clean that can be made now that "params" is
no longer necessary. What was:

  gen_files => {   
       'img_1_thmb_1' => {                                                      
                    
               transform_method => \&gen_thumb,                
               params => [{ w => 100, h => 100 }],                              
                               
       }                                                                        
                                 
       'img_1_thmb_2' => {                                                      
                                
               transform_method => \&gen_thumb, 
               params => [{ w => 50, h => 50 }], 
       }                                                                        
                                  
  }        

Becomes: 

  gen_files => {   
        'img_1_thmb_1' => gen_thumb({ w => 100, h => 100 }),
        'img_1_thmb_2' => gen_thumb({ w => 50,  h => 50  }),
  }        

Nice! Go, closures, go! 

(Now someone just has to update the code to make that actually work... )

    Mark

-- 
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to