Contextual::Diag - diagnosing perl context
use Contextual::Diag; if (contextual_diag) { } # => warn "evaluated as BOOL in SCALAR context" my $h = { key => contextual_diag 'hello' }; # => warn "wanted LIST context"
Contextual::Diag is a tool for diagnosing perl context. The purpose of this module is to make it easier to learn perl context.
contextual_diag(@_) => @_
By plugging in the context where you want to know, indicate what the context:
# CASE: wanted LIST context my @t = contextual_diag qw/a b/ my @t = ('a','b', contextual_diag()) # CASE: wanted SCALAR context my $t = contextual_diag "hello" scalar contextual_diag qw/a b/
Copyright (C) kfly8.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
kfly8 <kfly@cpan.org>
To install Contextual::Diag, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contextual::Diag
CPAN shell
perl -MCPAN -e shell install Contextual::Diag
For more information on module installation, please visit the detailed CPAN module installation guide.