lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Nice/Try.pm in javonet-ruby-sdk-2.1.1 vs lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Nice/Try.pm in javonet-ruby-sdk-2.1.2

- old
+ new

@@ -1,12 +1,12 @@ ##---------------------------------------------------------------------------- ## A real Try Catch Block Implementation Using Perl Filter - ~/lib/Nice/Try.pm -## Version v1.3.3 +## Version v1.3.4 ## Copyright(c) 2023 DEGUEST Pte. Ltd. ## Author: Jacques Deguest <jack@deguest.jp> ## Created 2020/05/17 -## Modified 2023/01/13 +## Modified 2023/05/06 ## All rights reserved ## ## This program is free software; you can redistribute it and/or modify it ## under the same terms as Perl itself. ##---------------------------------------------------------------------------- @@ -26,11 +26,11 @@ use PPI; use Filter::Util::Call; use Scalar::Util (); use List::Util (); use Want (); - our $VERSION = 'v1.3.3'; + our $VERSION = 'v1.3.4'; our $ERROR; our( $CATCH, $DIED, $EXCEPTION, $FINALLY, $HAS_CATCH, @RETVAL, $SENTINEL, $TRY, $WANTARRAY ); } use strict; @@ -765,11 +765,11 @@ ? 'OBJECT' : Want::want( 'CODE' ) ? 'CODE' : Want::want( 'REFSCALAR' ) ? 'REFSCALAR' - : Want::want( 'BOOLEAN' ) + : Want::want( 'BOOL' ) ? 'BOOLEAN' : Want::want( 'GLOB' ) ? 'GLOB' : Want::want( 'SCALAR' ) ? 'SCALAR' @@ -820,11 +820,11 @@ \$Nice::Try::RETVAL[0] = &\$Nice::Try::TRY ? 1 : 0; \$Nice::Try::RETVAL[0] = \$Nice::Try::VOID[0] if( scalar( \@Nice::Try::VOID ) ); } elsif( \$Nice::Try::WANT eq 'VOID' ) { - \$Nice::Try::VOID[0] = &\$Nice::Try::TRY; + \@Nice::Try::VOID = &\$Nice::Try::TRY; } elsif( \$Nice::Try::WANT eq 'SCALAR' ) { \$Nice::Try::RETVAL[0] = &\$Nice::Try::TRY; } @@ -1031,11 +1031,11 @@ my \$this = \&\$Nice::Try::CATCH ? 1 : 0; \$Nice::Try::RETVAL[0] = \$Nice::Try::VOID[0] if( scalar( \@Nice::Try::VOID ) ); } elsif( \$Nice::Try::WANT eq 'VOID' ) { - \$Nice::Try::VOID[0] = \&\$Nice::Try::CATCH; + \@Nice::Try::VOID = \&\$Nice::Try::CATCH; } elsif( \$Nice::Try::WANT eq 'SCALAR' ) { \$Nice::Try::RETVAL[0] = \&\$Nice::Try::CATCH; } @@ -1292,10 +1292,14 @@ { CORE::return( \$Nice::Try::WANTARRAY ? \@Nice::Try::RETVAL : \$Nice::Try::RETVAL[0] ); } } } +elsif( scalar( \@Nice::Try::VOID ) && ( !Scalar::Util::blessed( \$Nice::Try::VOID[0] ) || ( Scalar::Util::blessed( \$Nice::Try::VOID[0] ) && !\$Nice::Try::VOID[0]->isa( 'Nice::Try::SENTINEL' ) ) ) ) +{ + CORE::return( scalar( \@Nice::Try::VOID ) > 1 ? \@Nice::Try::VOID : \$Nice::Try::VOID[0] ); +} EOT $last_return_block =~ s/\n/ /gs unless( $self->{debug_code} ); push( @$repl, $last_return_block ); my $try_catch_code = join( '', @$repl ); # my $token = PPI::Token->new( "; \{ $try_catch_code \}" ) || die( "Unable to create token" ); @@ -1851,10 +1855,10 @@ print( "Unknown error: $default\n" ); } =head1 VERSION - v1.3.3 + v1.3.4 =head1 DESCRIPTION L<Nice::Try> is a lightweight implementation of Try-Catch exception trapping block using L<perl filter|perlfilter>. It behaves like you would expect.