03 Jun 2010 15:12:25 UTC
- Distribution: Scalar-Andand
- Module version: 0.05
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (469 / 1 / 0)
- KwaliteeBus factor: 1
- 96.36% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity24 month
- Download (12.56KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionLEONT Leon Timmermans
Take me over?The maintainer of this distribution is looking for someone to take over! If you're interested then please contact them via email.
Scalar::Andand - Guarded method invocation.
Scalar::Andand lets us write:
$phone = Location->find('first', name => 'Johnson' )->andand->phone
And get a guarded method invocation or safe navigation method. This snippet performs a
findon the Location class, then calls
phoneto the result if the result is defined. If the result is not defined, then the expression returns false without throwing an exception.
This module doesn't export anything to your namespace, but it does add a universal method andand, which is a far graver sin.
<leont at cpan.org>
You have to include the module in every package where you use the magic
andandmethod, or else it doesn't work on undefined values.
This module contains more magic than what is responsible, don't be surprised by weird bugs.
Note that this module was intended as a proof of concept. The author has never used it in production code, nor is he planning to do so. YMMV.
Please report any bugs or feature requests to
bug-scalar-andand at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Scalar-Andand. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
Copyright 2009 Leon Timmermans, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Scalar::Andand, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Scalar::Andand
For more information on module installation, please visit the detailed CPAN module installation guide.