Deprecate shellwords.pl with a warning
[p5sagit/p5-mst-13.2.git] / lib / autodie / exception / system.pm
CommitLineData
0b09a93a 1package autodie::exception::system;
2use 5.008;
3use strict;
4use warnings;
5use base 'autodie::exception';
6use Carp qw(croak);
7
7840a289 8our $VERSION = '2.06_01';
0b09a93a 9
10my $PACKAGE = __PACKAGE__;
11
12=head1 NAME
13
14autodie::exception::system - Exceptions from autodying system().
15
16=head1 SYNOPSIS
17
18 eval {
db4e6d09 19 use autodie qw(system);
0b09a93a 20
21 system($cmd, @args);
22
23 };
24
25 if (my $E = $@) {
26 say "Ooops! ",$E->caller," had problems: $@";
27 }
28
29
30=head1 DESCRIPTION
31
32This is a L<autodie::exception> class for failures from the
33C<system> command.
34
35Presently there is no way to interrogate an C<autodie::exception::system>
36object for the command, exit status, and other information you'd expect
37such an object to hold. The interface will be expanded to accommodate
38this in the future.
39
40=cut
41
42sub _init {
43 my ($this, %args) = @_;
44
45 $this->{$PACKAGE}{message} = $args{message}
46 || croak "'message' arg not supplied to autodie::exception::system->new";
47
48 return $this->SUPER::_init(%args);
49
50}
51
52=head2 stringify
53
54When stringified, C<autodie::exception::system> objects currently
55use the message generated by L<IPC::System::Simple>.
56
57=cut
58
59sub stringify {
60
61 my ($this) = @_;
62
63 return $this->{$PACKAGE}{message} . $this->add_file_and_line;
64
65}
66
671;
68
69__END__
70
71=head1 LICENSE
72
73Copyright (C)2008 Paul Fenwick
74
75This is free software. You may modify and/or redistribute this
76code under the same terms as Perl 5.10 itself, or, at your option,
77any later version of Perl 5.
78
79=head1 AUTHOR
80
81Paul Fenwick E<lt>pjf@perltraining.com.auE<gt>