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::Literal(3) User Contributed Perl Documentation Bread::Board::Literal(3)
 

Bread::Board::Literal - service providing a literal value

version 0.36

  my $c = container PrettyBoring => as {
      # These are Bread::Board::Literal services
      service connect_string => 'dbi:mysql:boring_db';
      service service_url => 'http://api.example.com/v0/boring';
      # And some other services depending on them...
      service dbconn => (
          class => 'DBI',
          block => sub {
              my $s = shift;
              DBI->new($s->param('connect_string');
          },
          dependencies => wire_names(qw( connect_string )),
      );
      service service_request => (
          class => 'HTTP::Request',
          block => sub {
              my $s = shift;
              HTTP::Request->new(POST => $s->param('service_url'));
          },
          dependencies => wire_names(qw( service_url ));
      };
  };
  # OR to use directly:
  my $literal = Bread::Board::Literal->new(
      name  => 'the_answer_to_life_the_universe_and_everything',
      value => 42,
  );
  $c->add_service($literal);

A literal service is one that stores a literal scalar or reference for use in your Bread::Board.
Beware of using references in your literals as they may cause your Bread::Board to leak memory. If this is a concern, you may want to weaken your references.
See "weaken" in Scalar::Util.

Required attribute with read/write accessor. This is the value that "get" will return.

Returns the "value", unaltered.

Dies: a literal service is (essentially) a constant, it does not make sense to inherit from it.

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) 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.
2017-09-25 perl v5.28.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.