2010/9/27 Jakub Narebski <jnareb@xxxxxxxxx>: >>> + if (ref($content) eq 'CODE') { >>> + $content->(); >>> + } elsif (ref($content) eq 'ARRAY') { >>> + print @$content; > > The 'ARRAY' part is probably unnecessary overengineering. > >>> + } elsif (!ref($content) && defined($content)) { >>> + print $content; >>> + } > > Or even (in the vein of further overengineering) > > + } elsif (ref($content) eq 'SCALAR') { > + print esc_html($$content); > + } elsif (!ref($content) && defined($content)) { > + print $content; > + } > > or vice versa ;-) > >>> >>> Well, $content could be also open filehandle... > > Though I don't know how to check that. ref on filehandles return > 'GLOB'... well, we can use 'openhandle' from Scalar::Util (core). > But that is probably unnecessary overengineering. I have made cases for closures, scalar refs and scalar values. I've also added a case for GLOB or IO::Handle to allow a file handle to be passed as either *handle or *handle{IO}. I've also added a comment block explaining the syntax better. -- Giuseppe "Oblomov" Bilotta -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html