>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:

  SB> I create %typedefs hash, where each key is a name which has a value of a
  SB> coderef that simply creates and returns a hash. Then:

  SB> my @data_types = $vardb->is_type();
  SB> my @missing_types;

  SB> for (@data_types) {

use named vars instead of $_. it makes the code easier to read and
follow. you use $_ so often in this loop and i can't track what is in it
without a name. this is a general rule you should use, avoid $_ unless
you have to (grep/map) or it really makes things cleaner.

  SB>     push @missing_types, $_ and next
  SB>             if ! exists $typedefs{$_};

  SB>     my %type = &{ $typedefs{$_} };

much cleaner to get the type first and check it. less redundancy too:

        my $type_code = $typedefs{$_} ;
        push @missing_types, $_ and next unless $type_code ;
        my %type = $type_code->() ;

  SB>     eval { $sanity->check_type( '$_', \%type, $error ) } ;

why are you single quoting '$_'? that will be the literal $_ and not
what is in $_.

  SB>     unlike ( $@

unlike?

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to