diff options
Diffstat (limited to 'Master/tlpkg/tlperl/site/lib/HTTP/Status.pm')
-rw-r--r-- | Master/tlpkg/tlperl/site/lib/HTTP/Status.pm | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/Master/tlpkg/tlperl/site/lib/HTTP/Status.pm b/Master/tlpkg/tlperl/site/lib/HTTP/Status.pm index 744cec10690..ac181b138c3 100644 --- a/Master/tlpkg/tlperl/site/lib/HTTP/Status.pm +++ b/Master/tlpkg/tlperl/site/lib/HTTP/Status.pm @@ -3,14 +3,14 @@ package HTTP::Status; use strict; use warnings; +our $VERSION = '6.14'; + require 5.002; # because we use prototypes use base 'Exporter'; our @EXPORT = qw(is_info is_success is_redirect is_error status_message); our @EXPORT_OK = qw(is_client_error is_server_error); -our $VERSION = "6.11"; - # Note also addition of mnemonics to @EXPORT below # Unmarked codes are from RFC 2616 @@ -20,6 +20,7 @@ my %StatusCode = ( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', # RFC 2518 (WebDAV) + 103 => 'Early Hints', # RFC 8297 200 => 'OK', 201 => 'Created', 202 => 'Accepted', @@ -104,22 +105,27 @@ our %EXPORT_TAGS = ( sub status_message ($) { $StatusCode{$_[0]}; } -sub is_info ($) { $_[0] >= 100 && $_[0] < 200; } -sub is_success ($) { $_[0] >= 200 && $_[0] < 300; } -sub is_redirect ($) { $_[0] >= 300 && $_[0] < 400; } -sub is_error ($) { $_[0] >= 400 && $_[0] < 600; } -sub is_client_error ($) { $_[0] >= 400 && $_[0] < 500; } -sub is_server_error ($) { $_[0] >= 500 && $_[0] < 600; } +sub is_info ($) { $_[0] && $_[0] >= 100 && $_[0] < 200; } +sub is_success ($) { $_[0] && $_[0] >= 200 && $_[0] < 300; } +sub is_redirect ($) { $_[0] && $_[0] >= 300 && $_[0] < 400; } +sub is_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 600; } +sub is_client_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 500; } +sub is_server_error ($) { $_[0] && $_[0] >= 500 && $_[0] < 600; } 1; +=pod -__END__ +=encoding UTF-8 =head1 NAME HTTP::Status - HTTP Status code processing +=head1 VERSION + +version 6.14 + =head1 SYNOPSIS use HTTP::Status qw(:constants :is status_message); @@ -148,6 +154,7 @@ tag to import them all. HTTP_CONTINUE (100) HTTP_SWITCHING_PROTOCOLS (101) HTTP_PROCESSING (102) + HTTP_EARLY_HINTS (103) HTTP_OK (200) HTTP_CREATED (201) @@ -267,3 +274,21 @@ This function is B<not> exported by default. For legacy reasons all the C<HTTP_> constants are exported by default with the prefix C<RC_>. It's recommended to use explicit imports and the C<:constants> tag instead of relying on this. + +=head1 AUTHOR + +Gisle Aas <gisle@activestate.com> + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 1994-2017 by Gisle Aas. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + +__END__ + + +#ABSTRACT: HTTP Status code processing |