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-1.16 RPM for noarch

From OpenSuSE Tumbleweed for noarch

Name: perl-Contextual-Return Distribution: openSUSE Tumbleweed
Version: 0.004014 Vendor: openSUSE
Release: 1.16 Build date: Sun Sep 26 01:24:17 2021
Group: Development/Libraries/Perl Build host: lamb11
Size: 163114 Source RPM: perl-Contextual-Return-0.004014-1.16.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.34.0/Contextual
/usr/lib/perl5/vendor_perl/5.34.0/Contextual/Return
/usr/lib/perl5/vendor_perl/5.34.0/Contextual/Return.pm
/usr/lib/perl5/vendor_perl/5.34.0/Contextual/Return/Failure.pm
/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, Thu Oct 21 23:18:09 2021