403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.138.114.140
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/local/ssl/local/ssl/local/ssl/local/share/man/man3/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/local/ssl/local/ssl/local/ssl/local/share/man/man3/Test::Exception.3pm
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Test::Exception 3"
.TH Test::Exception 3 "2015-12-30" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Test::Exception \- Test exception\-based code
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\&  use Test::More tests => 5;
\&  use Test::Exception;
\&
\&  # or if you don\*(Aqt need Test::More
\&
\&  use Test::Exception tests => 5;
\&
\&  # then...
\&
\&  # Check that the stringified exception matches given regex
\&  throws_ok { $foo\->method } qr/division by zero/, \*(Aqzero caught okay\*(Aq;
\&
\&  # Check an exception of the given class (or subclass) is thrown
\&  throws_ok { $foo\->method } \*(AqError::Simple\*(Aq, \*(Aqsimple error thrown\*(Aq;
\&  
\&  # all Test::Exceptions subroutines are guaranteed to preserve the state 
\&  # of $@ so you can do things like this after throws_ok and dies_ok
\&  like $@, \*(Aqwhat the stringified exception should look like\*(Aq;
\&
\&  # Check that something died \- we do not care why
\&  dies_ok { $foo\->method } \*(Aqexpecting to die\*(Aq;
\&
\&  # Check that something did not die
\&  lives_ok { $foo\->method } \*(Aqexpecting to live\*(Aq;
\&
\&  # Check that a test runs without an exception
\&  lives_and { is $foo\->method, 42 } \*(Aqmethod is 42\*(Aq;
\&  
\&  # or if you don\*(Aqt like prototyped functions
\&  
\&  throws_ok( sub { $foo\->method }, qr/division by zero/,
\&      \*(Aqzero caught okay\*(Aq );
\&  throws_ok( sub { $foo\->method }, \*(AqError::Simple\*(Aq, 
\&      \*(Aqsimple error thrown\*(Aq );
\&  dies_ok( sub { $foo\->method }, \*(Aqexpecting to die\*(Aq );
\&  lives_ok( sub { $foo\->method }, \*(Aqexpecting to live\*(Aq );
\&  lives_and( sub { is $foo\->method, 42 }, \*(Aqmethod is 42\*(Aq );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides a few convenience methods for testing exception based code. It is built with 
Test::Builder and plays happily with Test::More and friends.
.PP
If you are not already familiar with Test::More now would be the time to go take a look.
.PP
You can specify the test plan when you \f(CW\*(C`use Test::Exception\*(C'\fR in the same way as \f(CW\*(C`use Test::More\*(C'\fR.
See Test::More for details.
.PP
\&\s-1NOTE:\s0 Test::Exception only checks for exceptions. It will ignore other methods of stopping 
program execution \- including \fIexit()\fR. If you have an \fIexit()\fR in evalled code Test::Exception
will not catch this with any of its testing functions.
.PP
\&\s-1NOTE:\s0 This module uses Sub::Uplevel and relies on overriding
\&\f(CW\*(C`CORE::GLOBAL::caller\*(C'\fR to hide your test blocks from the call stack.  If this
use of global overrides concerns you, the Test::Fatal module offers a more
minimalist alternative.
.IP "\fBthrows_ok\fR" 4
.IX Item "throws_ok"
Tests to see that a specific exception is thrown. \fIthrows_ok()\fR has two forms:
.Sp
.Vb 2
\&  throws_ok BLOCK REGEX, TEST_DESCRIPTION
\&  throws_ok BLOCK CLASS, TEST_DESCRIPTION
.Ve
.Sp
In the first form the test passes if the stringified exception matches the give regular expression. For example:
.Sp
.Vb 1
\&    throws_ok { read_file( \*(Aqunreadable\*(Aq ) } qr/No file/, \*(Aqno file\*(Aq;
.Ve
.Sp
If your perl does not support \f(CW\*(C`qr//\*(C'\fR you can also pass a regex-like string, for example:
.Sp
.Vb 1
\&    throws_ok { read_file( \*(Aqunreadable\*(Aq ) } \*(Aq/No file/\*(Aq, \*(Aqno file\*(Aq;
.Ve
.Sp
The second form of \fIthrows_ok()\fR test passes if the exception is of the same class as the one supplied, or a subclass of that class. For example:
.Sp
.Vb 1
\&    throws_ok { $foo\->bar } "Error::Simple", \*(Aqsimple error\*(Aq;
.Ve
.Sp
Will only pass if the \f(CW\*(C`bar\*(C'\fR method throws an Error::Simple exception, or a subclass of an Error::Simple exception.
.Sp
You can get the same effect by passing an instance of the exception you want to look for. The following is equivalent to the previous example:
.Sp
.Vb 2
\&    my $SIMPLE = Error::Simple\->new;
\&    throws_ok { $foo\->bar } $SIMPLE, \*(Aqsimple error\*(Aq;
.Ve
.Sp
Should a \fIthrows_ok()\fR test fail it produces appropriate diagnostic messages. For example:
.Sp
.Vb 4
\&    not ok 3 \- simple error
\&    #     Failed test (test.t at line 48)
\&    # expecting: Error::Simple exception
\&    # found: normal exit
.Ve
.Sp
Like all other Test::Exception functions you can avoid prototypes by passing a subroutine explicitly:
.Sp
.Vb 1
\&    throws_ok( sub {$foo\->bar}, "Error::Simple", \*(Aqsimple error\*(Aq );
.Ve
.Sp
A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
.Sp
A description of the exception being checked is used if no optional test description is passed.
.Sp
\&\s-1NOTE:\s0 Remember when you \f(CW\*(C`die $string_without_a_trailing_newline\*(C'\fR perl will 
automatically add the current script line number, input line number and a newline. This will
form part of the string that throws_ok regular expressions match against.
.IP "\fBdies_ok\fR" 4
.IX Item "dies_ok"
Checks that a piece of code dies, rather than returning normally. For example:
.Sp
.Vb 4
\&    sub div {
\&        my ( $a, $b ) = @_;
\&        return $a / $b;
\&    };
\&
\&    dies_ok { div( 1, 0 ) } \*(Aqdivide by zero detected\*(Aq;
\&
\&    # or if you don\*(Aqt like prototypes
\&    dies_ok( sub { div( 1, 0 ) }, \*(Aqdivide by zero detected\*(Aq );
.Ve
.Sp
A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
.Sp
Remember: This test will pass if the code dies for any reason. If you care about the reason it might be more sensible to write a more specific test using \fIthrows_ok()\fR.
.Sp
The test description is optional, but recommended.
.IP "\fBlives_ok\fR" 4
.IX Item "lives_ok"
Checks that a piece of code doesn't die. This allows your test script to continue, rather than aborting if you get an unexpected exception. For example:
.Sp
.Vb 7
\&    sub read_file {
\&        my $file = shift;
\&        local $/;
\&        open my $fh, \*(Aq<\*(Aq, $file or die "open failed ($!)\en";
\&        $file = <FILE>;
\&        return $file;
\&    };
\&
\&    my $file;
\&    lives_ok { $file = read_file(\*(Aqtest.txt\*(Aq) } \*(Aqfile read\*(Aq;
\&
\&    # or if you don\*(Aqt like prototypes
\&    lives_ok( sub { $file = read_file(\*(Aqtest.txt\*(Aq) }, \*(Aqfile read\*(Aq );
.Ve
.Sp
Should a \fIlives_ok()\fR test fail it produces appropriate diagnostic messages. For example:
.Sp
.Vb 3
\&    not ok 1 \- file read
\&    #     Failed test (test.t at line 15)
\&    # died: open failed (No such file or directory)
.Ve
.Sp
A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
.Sp
The test description is optional, but recommended.
.IP "\fBlives_and\fR" 4
.IX Item "lives_and"
Run a test that may throw an exception. For example, instead of doing:
.Sp
.Vb 3
\&  my $file;
\&  lives_ok { $file = read_file(\*(Aqanswer.txt\*(Aq) } \*(Aqread_file worked\*(Aq;
\&  is $file, "42", \*(Aqanswer was 42\*(Aq;
.Ve
.Sp
You can use \fIlives_and()\fR like this:
.Sp
.Vb 3
\&  lives_and { is read_file(\*(Aqanswer.txt\*(Aq), "42" } \*(Aqanswer is 42\*(Aq;
\&  # or if you don\*(Aqt like prototypes
\&  lives_and(sub {is read_file(\*(Aqanswer.txt\*(Aq), "42"}, \*(Aqanswer is 42\*(Aq);
.Ve
.Sp
Which is the same as doing
.Sp
.Vb 1
\&  is read_file(\*(Aqanswer.txt\*(Aq), "42\en", \*(Aqanswer is 42\*(Aq;
.Ve
.Sp
unless \f(CW\*(C`read_file(\*(Aqanswer.txt\*(Aq)\*(C'\fR dies, in which case you get the same kind of error as \fIlives_ok()\fR
.Sp
.Vb 3
\&  not ok 1 \- answer is 42
\&  #     Failed test (test.t at line 15)
\&  # died: open failed (No such file or directory)
.Ve
.Sp
A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
.Sp
The test description is optional, but recommended.
.SH "SKIPPING TEST::EXCEPTION TESTS"
.IX Header "SKIPPING TEST::EXCEPTION TESTS"
Sometimes we want to use Test::Exception tests in a test suite, but don't want to force the user to have Test::Exception installed. One way to do this is to skip the tests if Test::Exception is absent. You can do this with code something like this:
.PP
.Vb 3
\&  use strict;
\&  use warnings;
\&  use Test::More;
\&  
\&  BEGIN {
\&      eval "use Test::Exception";
\&      plan skip_all => "Test::Exception needed" if $@;
\&  }
\&  
\&  plan tests => 2;
\&  # ... tests that need Test::Exception ...
.Ve
.PP
Note that we load Test::Exception in a \f(CW\*(C`BEGIN\*(C'\fR block ensuring that the subroutine prototypes are in place before the rest of the test script is compiled.
.SH "BUGS"
.IX Header "BUGS"
There are some edge cases in Perl's exception handling where Test::Exception will miss exceptions
thrown in \s-1DESTROY\s0 blocks. See the \s-1RT\s0 bug <http://rt.cpan.org/Ticket/Display.html?id=24678> for
details, along with the t/edge\-cases.t in the distribution test suite. These will be addressed in
a future Test::Exception release.
.PP
If you find any more bugs please let me know by e\-mail, or report the problem with 
<http://rt.cpan.org/>.
.SH "COMMUNITY"
.IX Header "COMMUNITY"
.IP "perl-qa" 4
.IX Item "perl-qa"
If you are interested in testing using Perl I recommend you visit <http://qa.perl.org/> and join the excellent perl-qa mailing list. See <http://lists.perl.org/showlist.cgi?name=perl\-qa> for details on how to subscribe.
.IP "perlmonks" 4
.IX Item "perlmonks"
You can find users of Test::Exception, including the module author, on  <http://www.perlmonks.org/>. Feel free to ask questions on Test::Exception there.
.IP "CPAN::Forum" 4
.IX Item "CPAN::Forum"
The \s-1CPAN\s0 Forum is a web forum for discussing Perl's \s-1CPAN\s0 modules.   The Test::Exception forum can be found at <http://www.cpanforum.com/dist/Test\-Exception>.
.IP "AnnoCPAN" 4
.IX Item "AnnoCPAN"
AnnoCPAN is a web site that allows community annotations of Perl module documentation. The Test::Exception annotations can be found at <http://annocpan.org/~ADIE/Test\-Exception/>.
.SH "TO DO"
.IX Header "TO DO"
If you think this module should do something that it doesn't (or does something that it shouldn't) please let me know.
.PP
You can see my current to do list at <http://adrianh.tadalist.com/lists/public/15421>, with an \s-1RSS\s0 feed of changes at <http://adrianh.tadalist.com/lists/feed_public/15421>.
.SH "ACKNOWLEDGMENTS"
.IX Header "ACKNOWLEDGMENTS"
Thanks to chromatic and Michael G Schwern for the excellent Test::Builder, without which this module wouldn't be possible.
.PP
Thanks to 
Adam Kennedy,
Andy Lester, 
Aristotle Pagaltzis, 
Ben Prew, 
Cees Hek,
Chris Dolan,
chromatic, 
Curt Sampson,
David Cantrell,
David Golden, 
David Tulloh,
David Wheeler, 
J. K. O'Brien,
Janek Schleicher,
Jim Keenan, 
Jos I. Boumans, 
Joshua ben Jore,
Jost Krieger,
Mark Fowler, 
Michael G Schwern, 
Nadim Khemir,
Paul McCann,
Perrin Harkins, 
Peter Rabbitson,
Peter Scott, 
Ricardo Signes,
Rob Muhlestein,
Scott R. Godin,
Steve Purkis,
Steve, 
Tim Bunce,
and various anonymous folk for comments, suggestions, bug reports and patches.
.SH "AUTHOR"
.IX Header "AUTHOR"
Adrian Howard <adrianh@quietstars.com>
.PP
If you can spare the time, please drop me a line if you find this module useful.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.IP "<http://del.icio.us/tag/Test::Exception>" 4
.IX Item "<http://del.icio.us/tag/Test::Exception>"
Delicious links on Test::Exception.
.IP "Test::Fatal" 4
.IX Item "Test::Fatal"
A slightly different interface to testing exceptions, without overriding \f(CW\*(C`CORE::caller\*(C'\fR.
.IP "Test::Warnings & Test::Warn & Test::NoWarnings" 4
.IX Item "Test::Warnings & Test::Warn & Test::NoWarnings"
Modules to help test warnings.
.IP "Test::Builder" 4
.IX Item "Test::Builder"
Support module for building test libraries.
.IP "Test::Simple & Test::More" 4
.IX Item "Test::Simple & Test::More"
Basic utilities for writing tests.
.IP "<http://qa.perl.org/test\-modules.html>" 4
.IX Item "<http://qa.perl.org/test-modules.html>"
Overview of some of the many testing modules available on \s-1CPAN.\s0
.IP "<http://del.icio.us/tag/perl+testing>" 4
.IX Item "<http://del.icio.us/tag/perl+testing>"
Delicious links on perl testing.
.SH "LICENCE"
.IX Header "LICENCE"
Copyright 2002\-2007 Adrian Howard, All Rights Reserved.
.PP
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Youez - 2016 - github.com/yon3zu
LinuXploit