GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Bread::Board::Service::WithParameters(3) User Contributed Perl Documentation Bread::Board::Service::WithParameters(3)

Bread::Board::Service::WithParameters - Services with parameters

version 0.37

This is a sub-role of Bread::Board::Service, for parameterized services. These are services that will instantiate different values depending on parameters that are passed to the "get" method. You can pass those parameters via the "service_params" attribute of "Bread::Board::Dependency", or via the "inflate" method of "Bread::Board::Service::Deferred::Thunk".

Read-only hashref, will be passed as-is to "MooseX::Params::Validate"'s "validated_hash", so you can use things like "optional" and "default" in addition to type constraints:

  service something => (
    class => 'Thing',
    parameters => {
       type => { isa => 'Str', default => 'text' },
    },
  );

This attribute uses coercions on "Bread::Board::Service::Parameters" so that you can also say:

  service something => (
    class => 'Thing',
    parameters => ['type'],
  );

and it will be equivalent to:

  service something => (
    class => 'Thing',
    parameters => {
       type => { optional => 0 },
    },
  );

Predicate for the "parameters" attribute.

Returns true if any of the "parameters" have a "default" value.

Returns true if any of the "parameters" does not have "optional" set to true.

  my %parameters = $service->check_parameters(name1=>$value1,name2=>$value2);
  my %parameters = $service->check_parameters({name1=>$value1,name2=>$value2});

If any "parameters" are defined, this function validates its arguments against the parameters' definitions (using MooseX::Params::Validate). It will die if the validation fails, or return the validated parameters (including default value) if it succeeds.

Before the "get" method, arguments to "get" are passed through "check_parameters" and added to the "params" hashref. After the "get" method, those keys/values will be removed. In practice, this makes all parameters available to the actual "get" method body.

Stevan Little <stevan@iinteractive.com>

Please report any bugs or feature requests on the bugtracker website https://github.com/stevan/BreadBoard/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

This software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011, 2009 by Infinity Interactive.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2019-06-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.