App-SimpleScan-Plugin-Forget

 view release on metacpan or  search on metacpan

lib/App/SimpleScan/Plugin/Forget.pm  view on Meta::CPAN

package App::SimpleScan::Plugin::Forget;

our $VERSION = '1.02';

use warnings;
use strict;
use Carp;

sub pragmas {
  no strict 'refs';
  *{ caller() . '::_forget' } = \&_do_forget;
  return [ 'forget', \&_do_forget ];
}

sub _do_forget {
  my ( $self, $rest ) = @_;
  my @names = split( /\s+/, $rest );
  local $_;
  $self->_delete_substitution($_) for @names;
}

1;    # Magic true value required at end of module
__END__

=head1 NAME

App::SimpleScan::Plugin::Forget - forget a variable's value


=head1 VERSION

This document describes App::SimpleScan::Plugin::Forget version 1.00


=head1 SYNOPSIS

   # In a simple_scan input file, after installing this module:

   # Define the variable foo:
   %%var foo baz bar quux

   # Later in the file:
   %%forget foo

   # 'foo' is now undefined, and '<foo>' will not be replaced 

=head1 DESCRIPTION

C<App::SimpleScan::Plugin::Forget> looks through the currently-defined
variables and removes any variables specified as its arguments. If you
try to forget variables that are currently undefined, nothing happens.

=head1 INTERFACE 

=head2 pragmas

Defines the C<%%forget> pragma in C<App::SimpleScan>.

=head2 do_forget

Actually removes the variable from the current definitions.

=head1 DIAGNOSTICS

None.

=head1 CONFIGURATION AND ENVIRONMENT

App::SimpleScan::Plugin::Forget requires no configuration files or environment variables.

=head1 DEPENDENCIES



( run in 0.565 second using v1.01-cache-2.11-cpan-39bf76dae61 )