]> git.vpit.fr Git - perl/modules/rgit.git/blob - lib/App/Rgit/Utils.pm
Import rgit-0.01
[perl/modules/rgit.git] / lib / App / Rgit / Utils.pm
1 package App::Rgit::Utils;
2
3 use strict;
4 use warnings;
5
6 use Carp qw/croak/;
7
8 =head1 NAME
9
10 App::Rgit::Utils - Miscellanous utilities for App::Rgit classes.
11
12 =head1 VERSION
13
14 Version 0.01
15
16 =cut
17
18 our $VERSION = '0.01';
19
20 =head1 DESCRIPTION
21
22 Miscellanous utilities for L<App::Rgit> classes.
23
24 This is an internal module to L<rgit>.
25
26 =head1 FUNCTIONS
27
28 =head2 C<validate @method_args>
29
30 Sanitize arguments passed to methods.
31
32 =cut
33
34 sub validate {
35  my $class = shift;
36  croak 'Optional arguments must be passed as key/value pairs' if @_ % 2;
37  $class = ref($class) || $class;
38  $class = caller unless $class;
39  return $class, @_;
40 }
41
42 =head1 EXPORT
43
44 C<validate> is only exported on request.
45
46 =cut
47
48 use base qw/Exporter/;
49
50 our @EXPORT         = ();
51 our %EXPORT_TAGS    = (
52  funcs => [ qw/validate/ ]
53 );
54 our @EXPORT_OK      = map { @$_ } values %EXPORT_TAGS;
55 $EXPORT_TAGS{'all'} = [ @EXPORT_OK ];
56
57 =head1 SEE ALSO
58
59 L<rgit>.
60
61 =head1 AUTHOR
62
63 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
64    
65 You can contact me by mail or on C<irc.perl.org> (vincent).
66
67 =head1 BUGS
68
69 Please report any bugs or feature requests to C<bug-rgit at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=rgit>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
70
71 =head1 SUPPORT
72
73 You can find documentation for this module with the perldoc command.
74
75     perldoc App::Rgit::Utils
76
77 =head1 COPYRIGHT & LICENSE
78
79 Copyright 2008 Vincent Pit, all rights reserved.
80
81 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
82
83 =cut
84
85 1; # End of App::Rgit::Utils