On Wed, 19 Sep 2001, Stas Bekman wrote:
 
> my %warn_style =
>     (
>      html    => sub { "<!-- @_ -->"               },
>      c       => sub { "/* @_ */"                  },
>      default => sub { join '', map {s/^/\#/g} @_; },
>     );

one thing i've been meaning to point out style wise, these should be in
the form of:

my %hash = (
    one => 1,
    two => 2,
);

no need to align the closing } for those subs.
 
> sub warn_style_sub {
>     my ($self, $filename) = @_;
>     my $ext = (File::Basename::fileparse($filename, '\..*'))[3] || '';
>     $ext =~ s/^\.(.*)/"\L$1"/e;

maybe put those two lines into a filename_ext function that returns the
$ext, could be useful elsewhere.

>     return $warn_style{ $file_ext{$ext} || 'default' } || sub {};

no need for the '|| sub {}', since we always have a default.

otherwise, looks good!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to