in reply to How would you simplify this code?

Untested:
$args($_) ? $self->$_($args{$_}) : $self->$_ or die "Missing variable + $_" for qw|resource username|;
Just use "$self-><Varname>" instead of the lexically defined var names for the rest of the sub.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

Replies are listed 'Best First'.
Re^2: How would you simplify this code?
by elTriberium (Friar) on Apr 07, 2011 at 05:48 UTC
    Cool, didn't know that this would work. I like the idea but it looks very "line noise"-ish.