Attribute::Attempts - attribute version of Attempt::Sub


Attempt documentation Contained in the Attempt distribution.

Index


Code Index:

NAME

Top

Attribute::Attempts - attribute version of Attempt::Sub

SYNOPSIS

Top

  use Attribute::Attempts;

  # alter db will try three times before failing
  sub alter_db : attempts(tries => 3, delay => 2)
  {
    my $dbh = DBI->connect("DBD::Mysql:foo", "mark", "opensaysme")
      or die "Can't connect to database";
    $dbh->{RaiseException} = 1;
    $dbh->do("alter table items change pie pies int(10)");
  }

DESCRIPTION

Top

It's an attribute version of Sub::Attempts. See Sub::Attempts for information on how the attributes work.

AUTHOR

Top

Written by Mark Fowler <mark@twoshortplanks.com>

Copryright Mark Fowler 2003. All Rights Reserved.

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

BUGS

Top

As far as I know, works on any platform Attribute::Handlers does.

Bugs should be reported to me via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Attribute::Attempts.

SEE ALSO

Top

Sub::Attempts, Attempt


Attempt documentation Contained in the Attempt distribution.

package Attribute::Attempts;

use strict;
use warnings;

use Sub::Attempts ();
use Attribute::Handlers;

our $VERSION = "1.00";

sub UNIVERSAL::attempts :ATTR(CODE)
{
  my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
  Sub::Attempts::_attempts($referent,$symbol,@{$data});
}

1;

__END__

1;