POSIX/Error.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 96.1% 25 / 26 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« POSIX/Mem.pm ↑ Summary POSIX/IO/Handle.pm »
1 # Copyright (c) 2014, cPanel, Inc.
2 # All rights reserved.
3 # http://cpanel.net/
4 #
5 # This is free software; you can redistribute it and/or modify it under the same
6 # terms as Perl itself. See the LICENSE file for further details.
7  
8 package Filesys::POSIX::Error;
9  
10 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 30 ▶use Errno;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 30 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 =head1 NAME
18  
19 Filesys::POSIX::Error - Throw Errno values with L<Carp::confess()|Carp/confess>
20  
21 =head1 SYNOPSIS
22  
23 use Filesys::POSIX::Error;
24  
25 throw &Errno::ENOENT;
26  
27 =head1 DESCRIPTION
28  
29 C<Filesys::POSIX::Error> provides C<throw()>, a function which allows one to
30 set L<C<$!>|perlvar/$!> and throw a stack trace containing a stringification
31 thereof in one simple action.
32  
33 =cut
34  
35 30 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
36 30 require Exporter;
37  
38 30 our @EXPORT_OK = qw(throw);
39 }
40  
41 30 our @ISA = ('Exporter');
42  
43 75 ▶sub throw ($) {
Subroutine throw: called CC=1 SCAR=0.0
Pod undocumented
44 75 my ($errno) = @_;
45  
46 75 $! = $errno;
47  
48 75 Carp::confess "$!";
49 }
50  
51 30 1;
52  
53 __END__
« POSIX/Mem.pm ↑ Summary POSIX/IO/Handle.pm »