The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Contextual::Diag - diagnosing perl context

SYNOPSIS

    use Contextual::Diag;

    if (contexual_diag) { }
    # => warn "evaluated as BOOL in SCALAR context"

    my $h = { key => contexual_diag 'hello' };
    # => warn "wanted LIST context"

DESCRIPTION

Contextual::Diag is a tool for diagnosing perl context. The purpose of this module is to make it easier to learn perl context.

contexual_diag()

    contexual_diag(@_) => @_

By plugging in the context where you want to know, indicate what the context:

    # CASE: wanted LIST context
    my @t = contexual_diag qw/a b/
    my @t = ('a','b', contexual_diag())

    # CASE: wanted SCALAR context
    my $t = contexual_diag "hello"
    scalar contexual_diag qw/a b/

LICENSE

Copyright (C) kfly8.

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

AUTHOR

kfly8 <kfly@cpan.org>