root/lang/perl/Data-Storage/tags/Data-Storage-0.03/lib/Data/Storage/Mock.pm @ 10093

Revision 10093, 1.8 kB (checked in by hanekomu, 7 years ago)

lang/perl/Data-Storage: initial import

Line 
1package Data::Storage::Mock;
2
3# $Id: Mock.pm 13653 2007-10-22 09:11:20Z gr $
4
5use strict;
6use warnings;
7
8
9our $VERSION = '0.03';
10
11
12use base qw(Data::Storage Class::Accessor::Complex);
13
14
15__PACKAGE__->mk_scalar_accessors(qw(should_die_on_connect));
16
17
18sub connect {
19    my $self = shift;
20    $self->die_on_connect if $self->should_die_on_connect;
21}
22
23
24sub die_on_connect {
25    my $self = shift;
26    throw Error::Hierarchy::Internal::CustomMessage(custom_message =>
27        "can't connect",
28    );
29}
30
31
32sub disconnect {
33    my $self = shift;
34    return unless $self->is_connected;
35    $self->rollback_mode ? $self->rollback : $self->commit;
36}
37
38
39sub is_connected { 1 }
40
41
42sub rollback {}
43sub commit   {}
44
45
461;
47
48
49__END__
50
51=head1 NAME
52
53Data::Storage - generic abstract storage mechanism
54
55=head1 SYNOPSIS
56
57None yet (see below).
58
59=head1 DESCRIPTION
60
61None yet. This is an early release; fully functional, but undocumented. The
62next release will have more documentation.
63
64=head1 TAGS
65
66If you talk about this module in blogs, on del.icio.us or anywhere else,
67please use the C<datastorage> tag.
68
69=head1 BUGS AND LIMITATIONS
70
71No bugs have been reported.
72
73Please report any bugs or feature requests to
74C<bug-data-storage@rt.cpan.org>, or through the web interface at
75L<http://rt.cpan.org>.
76
77=head1 INSTALLATION
78
79See perlmodinstall for information and options on installing Perl modules.
80
81=head1 AVAILABILITY
82
83The latest version of this module is available from the Comprehensive Perl
84Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN
85site near you. Or see <http://www.perl.com/CPAN/authors/id/M/MA/MARCEL/>.
86
87=head1 AUTHORS
88
89Marcel GrE<uuml>nauer, C<< <marcel@cpan.org> >>
90
91=head1 COPYRIGHT AND LICENSE
92
93Copyright 2007 by Marcel GrE<uuml>nauer
94
95This library is free software; you can redistribute it and/or modify
96it under the same terms as Perl itself.
97
98=cut
99
Note: See TracBrowser for help on using the browser.