Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Bread-Board CPAN distribution.

Report information
The Basics
Id: 76131
Status: resolved
Priority: 0/
Queue: Bread-Board

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: arrayref terser syntax yet
Date: Wed, 28 Mar 2012 15:46:40 -0500
To: bugs-bread-board [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
dependencies => { email => depends_on('email'), domain => depends_on('domain'), city => depends_on('city'), state => depends_on('state'), organization => depends_on('organization'), organizational_unit => depends_on('organizational_unit'), }, ), this seems quite verbose, could we maybe get an arrayref syntax that makes this more implicit dependencies => [ qw( email domain city state ) ... ], could imply the above -- Caleb Cushing http://xenoterracide.com
Actually, that already works, there is a coercion to do just that. Take a look inside Bread::Board::Types https://www.metacpan.org/source/STEVAN/Bread-Board-0.25/lib/Bread/Board/Types.pm dependencies can either be: - HashRef of name to Bread::Board::Dependency object - HashRef of name to Bread::Board::Service object - HashRef of name to string representing the service path - HashRef of name to Hashref in which the key is the service path and the value is parameters to the service - ArrayRef of Bread::Board::Dependency objects - ArrayRef of Bread::Board::Service objects - ArrayRef of strings representing the service path - ArrayRef of Hashrefs in which the key is the service path and the value is parameters to the service In the ArrayRef versions the name is determined by calling the ->name method (for a Bread::Board::Service object) or by the ->service_name method (for the Bread::Board::Dependency object). Additionally, if you want to avoid the overhead of the coercion you can do: dependencies => wire_names(qw[ email password etc ]) and "wire_names" is exported by default. - Stevan