Index index by Group index by Distribution index by Vendor index by creation date index by Name Mirrors Help Search

perl-Contextual-Return-0.004014-bp154.1.15 RPM for noarch

From OpenSuSE Leap 15.4 for noarch

Name: perl-Contextual-Return Distribution: SUSE Linux Enterprise 15 SP4
Version: 0.004014 Vendor: openSUSE
Release: bp154.1.15 Build date: Mon May 9 11:27:43 2022
Group: Development/Libraries/Perl Build host: cloud115
Size: 163056 Source RPM: perl-Contextual-Return-0.004014-bp154.1.15.src.rpm
Packager: https://bugs.opensuse.org
Url: http://search.cpan.org/dist/Contextual-Return/
Summary: Create context-sensitive return values
Usually, when you need to create a subroutine that returns different values
in different contexts (list, scalar, or void), you write something like:

    sub get_server_status {
        my ($server_ID) = @_;

        
        my %server_data = _ascertain_server_status($server_ID);

        
        
        if (wantarray()) {
            return @server_data{ qw(name uptime load users) };
        }
        if (defined wantarray()) {
            return $server_data{load};
        }
        if (!defined wantarray()) {
            carp 'Useless use of get_server_status() in void context';
            return;
        }
        else {
            croak q{Bad context! No biscuit!};
        }
    }

That works okay, but the code could certainly be more readable. In its
simplest usage, this module makes that code more readable by providing
three subroutines--'LIST()', 'SCALAR()', 'VOID()'--that are true only when
the current subroutine is called in the corresponding context:

    use Contextual::Return;

    sub get_server_status {
        my ($server_ID) = @_;

        
        my %server_data = _ascertain_server_status($server_ID);

        
        
        if (LIST)   { return @server_data{ qw(name uptime load users) } }
        if (SCALAR) { return $server_data{load}                         }
        if (VOID)   { print "$server_data{load}\n"                      }
        else        { croak q{Bad context! No biscuit!}                 }
    }

Provides

Requires

License

Artistic-1.0 or GPL-1.0+

Changelog

* Wed Apr 19 2017 coolo@suse.com
  - updated to 0.004014
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
* Thu Apr 13 2017 coolo@suse.com
  - updated to 0.004012
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
    0.004012  Thu Apr 13 01:06:09 2017
    - Optimized previous patch for memory leak
      (thanks, Jay and Father C.)
    - Added missing test plan to t/fail.t
* Sun Apr 09 2017 coolo@suse.com
  - updated to 0.004011
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
    0.004011  Sat Apr  8 15:23:14 2017
    - Patched memory leak from use of @DB::args
      (thanks, Jay!)
* Fri Dec 02 2016 coolo@suse.com
  - updated to 0.004010
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
    0.004010  Thu Dec  1 17:41:14 2016
    - Spelling fix in POD (thanks, Salvatore)
    - Improved DUMP behaviour when passed a non-CRV argument
      (thanks, Mathew)
* Wed Nov 23 2016 coolo@suse.com
  - remove Build.PL, it's obsolete
* Fri Nov 18 2016 coolo@suse.com
  - updated to 0.004009
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
    0.004009  Fri Nov 18 08:34:19 2016
    - Improved behaviour of FREEZE (Thanks, Mathew!)
    - Improved output of DUMP
* Mon Sep 14 2015 coolo@suse.com
  - updated to 0.004008
    see /usr/share/doc/packages/perl-Contextual-Return/Changes
    0.004008  Sat Sep 12 13:16:30 2015
    - Promoted $VERSION variable to earlier in source to
      attempt to placate cpanminus (thanks, Karen!)
    - Added prototype to overridden caller()
    - Changed way caller() is overridden, hopefully will no longer
      clash with Sub::Uplevel
* Mon Dec 17 2012 dvaleev@suse.com
  - update to 0.004007
    - Further patch to failures.t
    - Added redefinition of Scalar::Util::blessed() to avoid nasty
      surprises (thanks Andrew!)
    - Added confess() and cluck() overrides
      and fixed caller() override to set @DB::args when appropriate
    - Further patch for t/confess.t
      (Thanks, David!)
    - Circumvented annoying undef-as-key warnings in Perl 5.17+
    - Honour @CARP_NOT's when reporting context
    - Added BLESSED handler for better control over how blessed() lies
    - Upgraded reimplementation of blessed() to make more sense
  - reanable tests for ARM (fixed upstream)
  - fix ppc test failures
  - provide Build.PL to be able to use create_packlist=0
* Wed Aug 08 2012 dmueller@suse.com
  - also fails on native, fix build on ARM
* Thu Jul 26 2012 dmueller@suse.com
  - workaround build failure under qemu user emulation

Files

/usr/lib/perl5/vendor_perl/5.26.1/Contextual
/usr/lib/perl5/vendor_perl/5.26.1/Contextual/Return
/usr/lib/perl5/vendor_perl/5.26.1/Contextual/Return.pm
/usr/lib/perl5/vendor_perl/5.26.1/Contextual/Return/Failure.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Contextual-Return
/usr/share/doc/packages/perl-Contextual-Return/Changes
/usr/share/doc/packages/perl-Contextual-Return/README
/usr/share/man/man3/Contextual::Return.3pm.gz
/usr/share/man/man3/Contextual::Return::Failure.3pm.gz


Generated by rpm2html 1.8.1

Fabrice Bellet, Tue Apr 9 17:06:41 2024