NAME

Var::Mystic - my scalars tracked in colour

VERSION

This document describes Var::Mystic version 0.000002

SYNOPSIS

use Var::Mystic;

my     $untracked = 'Changes to this variable are not tracked';

mystic $tracked   = 'Changes to this variable are tracked';


$untracked = 'new value';    # Variable updated silently

$tracked   = 'new value';    # Change reported on STDERR

DESCRIPTION

This module allows you to declare lexically scoped scalar variables that track any change made to them, and report those changes to STDERR.

INTERFACE

The module adds a new keyword: mystic. When you use that keyword instead of my to declare a scalar variable, any subsequent change to that variable is reported on STDERR.

If the Term::ANSIColor module is installed, this report is printed in glorious technicolor.

DIAGNOSTICS

Every change to a mystic variable is reported to STDERR in the following format:

#line LINE FILE
$VARNAME = NEW_VALUE

Attempting to declare an array or hash with the mystic keyword produces the error:

Cannot declare %s to be mystic

CONFIGURATION AND ENVIRONMENT

Var::Mystic requires no configuration files or environment variables.

DEPENDENCIES

This module depends on the Keyword::Declare, Data::Dx, and Variable::Magic modules.

The module's test suite depends on the Test::Effects module.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

This module requires Perl 5.14 or later, and does not work under the 5.20 release of Perl (due to issues in the regex engine that were not resolved until Perl 5.22)

At present, only scalars can be declared with mystic tracking.

No bugs have been reported.

Please report any bugs or feature requests to bug-var-mystic@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Damian Conway <DCONWAY@CPAN.org>

LICENCE AND COPYRIGHT

Copyright (c) 2020, Damian Conway <DCONWAY@CPAN.org>. All rights reserved.

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

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.