Dios

 view release on metacpan or  search on metacpan

lib/Dios.pm  view on Meta::CPAN

        $init = qq{:DEFAULT(___i_n_i_t__${name}___(\$self)) } . ($init_field{DEFAULT_INIT} ? $init : q{});
        $INIT_FUNC = qq{sub ___i_n_i_t__${name}___ { my (\$self) = \@_; $init_val }};
    }
    else {
        $init .= $initializer;
    }

    # Update the attribute setting code...
    $^H{'Dios attrnames'} .= "$name,";
    if ($sigil eq '$') {
        $^H{'Dios attrs'} .= $] < 5.022 ? qq{alias my \$$name =    \$_Dios__attr_${name}[\${\$_[0]}];}
                                        : qq{   \\ my \$$name = \\ \$_Dios__attr_${name}[\${\$_[0]}];};
    }
    else {
        $^H{'Dios attrs'}
            .= $] < 5.022 ? qq{alias my $sigil$name = $sigil}.qq{{\$_Dios__attr_${name}[\${\$_[0]}]};}
                          : qq{   \\ my $sigil$name =             \$_Dios__attr_${name}[\${\$_[0]}]; };
    }
    # Add type-checking code to alias...
    if ($type) {
        $^H{'Dios attrs'} .= qq{ Dios::Types::_set_var_type(q{$type}, \\$sigil$name, 'Value (%s) for $sigil$name attribute', $constraint ); };
    }

    # Return the converted syntax...
    return qq{ $TYPE_VALIDATOR my \@_Dios__attr_$name : Field $access $delegators $init $TYPE_SETUP; $INIT_FUNC; };
}

# Convert a typed lexical variable...
sub _compose_lexical {
    my ($type, $variable, $constraint) = @_;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.462 second using v1.00-cache-2.02-grep-82fe00e-cpan-2ea8abbae53 )