Hello, I’d like to add a module to CPAN that wraps a given value as either a success or a failure, such that:
my $good = create_success('yay'); my $bad = create_failure('nono'); $good->get(); # returns 'yay'; $good->error() # returns undef; $bad->get(); # throws 'nono'; $bad->error(); # returns 'nono'; This pattern is inspired by Rust’s “Result”, but the name “Data::Result” is taken. Could someone make a suggestion, please? I could do “Data::Outcome”, but that seems wonky. Thank you! -Felipe Gasper (FELIPE)