ProgressMonitor::Null - a monitor implementation which doesn't render anything.


ProgressMonitor documentation Contained in the ProgressMonitor distribution.

Index


Code Index:

NAME

Top

ProgressMonitor::Null - a monitor implementation which doesn't render anything. Useful if a receiver insists on a monitor impl to talk to.

SYNOPSIS

Top

  ...
  $someObj->someLongRunningMethod(ProgressMonitor::Null->new);
  ...

  ####

  useful pattern inside a method that takes a monitor instance
  but can accept undef for it:

  someMethod
  {
    my $monitor = shift;

    monitor = ProgressMonitor::Null->new unless $monitor;

    ...
    #now the rest of the code is guaranteed a monitor
    ...
  }

DESCRIPTION

Top

This is a 'null' implementation of the ProgressMonitor interface. It will simply ignore to render anything, thus it's a good dropin for a method that requires a monitor instance but you don't wish anything shown.

Inherits from AbstractStatefulMonitor.

AUTHOR

Top

Kenneth Olwing, <knth at cpan.org>

BUGS

Top

I wouldn't be surprised! If you can come up with a minimal test that shows the problem I might be able to take a look. Even better, send me a patch.

Please report any bugs or feature requests to bug-progressmonitor at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ProgressMonitor. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find general documentation for this module with the perldoc command:

    perldoc ProgressMonitor

ACKNOWLEDGEMENTS

Top

Thanks to my family. I'm deeply grateful for you!

COPYRIGHT & LICENSE

Top


ProgressMonitor documentation Contained in the ProgressMonitor distribution.

package ProgressMonitor::Null;

use warnings;
use strict;

require ProgressMonitor if 0;

use classes
  extends => 'ProgressMonitor',
  new     => 'new',
  methods => {
			  begin           => 'EMPTY',
			  end             => 'EMPTY',
			  isCanceled      => 'EMPTY',
			  prepare         => 'EMPTY',
			  setCanceled     => 'EMPTY',
			  setMessage      => 'EMPTY',
			  setErrorMessage => 'EMPTY',
			  tick            => 'EMPTY',
			  subMonitor      => 'subMonitor',
			 },
  class_attrs_pr => [ 'instance' ],
  ;

sub new
{
	my $class = shift;
	my $cfg   = shift;

	no strict 'refs';
	unless ($$CLASS_ATTR_instance)
		{
		# don't pass any cfg; just discard it
		#
		$$CLASS_ATTR_instance = classes::new_only($class);
		}

	return $$CLASS_ATTR_instance;
}

sub subMonitor
{
	no strict 'refs';
	return $$CLASS_ATTR_instance;
}

###

package ProgressMonitor::NullConfiguration;

use strict;
use warnings;

use classes
  extends => 'ProgressMonitor::AbstractConfiguration',
  ;

############################

1;    # End of ProgressMonitor::Null