Hello community,

here is the log from the commit of package perl-Contextual-Return for 
openSUSE:Factory
checked in at Mon Jul 25 17:33:57 CEST 2011.



--------
New Changes file:

--- /dev/null   2010-08-26 16:28:41.000000000 +0200
+++ perl-Contextual-Return/perl-Contextual-Return.changes       2011-07-19 
21:32:49.000000000 +0200
@@ -0,0 +1,15 @@
+-------------------------------------------------------------------
+Tue Jul 19 19:32:12 UTC 2011 - [email protected]
+
+- regenerate with cpanspec
+
+-------------------------------------------------------------------
+Wed Dec  1 09:44:30 UTC 2010 - [email protected]
+
+- switch to perl_requires macro
+
+-------------------------------------------------------------------
+Fri Nov 19 20:09:33 UTC 2010 - [email protected]
+
+- initial package (0.003001)
+

calling whatdependson for head-i586


New:
----
  Contextual-Return-0.003001.tar.gz
  perl-Contextual-Return.changes
  perl-Contextual-Return.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Contextual-Return.spec ++++++
#
# spec file for package perl-Contextual-Return
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           perl-Contextual-Return
Version:        0.003001
Release:        1
License:        GPL+ or Artistic
%define cpan_name Contextual-Return
Summary:        Create context-senstive return values
Url:            http://search.cpan.org/dist/Contextual-Return/
Group:          Development/Libraries/Perl
Source:         
http://www.cpan.org/authors/id/D/DC/DCONWAY/%{cpan_name}-%{version}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(Module::Build)
BuildRequires:  perl(version)
BuildRequires:  perl(Want)
Requires:       perl(version)
Requires:       perl(Want)
%{perl_requires}

%description
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) = @_;

        # Acquire server data somehow...
        my %server_data = _ascertain_server_status($server_ID);

        # Return different components of that data,
        # depending on call context...
        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) = @_;

        # Acquire server data somehow...
        my %server_data = _ascertain_server_status($server_ID);

        # Return different components of that data
        # depending on call context...
        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!}                 }
    }

%prep
%setup -q -n %{cpan_name}-%{version}

%build
%{__perl} Build.PL installdirs=vendor
./Build build flags=%{?_smp_mflags}

%check
./Build test

%install
./Build install destdir=%{buildroot} create_packlist=0
%perl_gen_filelist

%clean
%{__rm} -rf %{buildroot}

%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README

%changelog

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to