Coder Social home page Coder Social logo

http-status-constants's Introduction

NAME

HTTP::Status::Const - interpolable HTTP status constants

VERSION

v0.3.0

SYNOPSIS

use HTTP::Status::Const;

...

$response->status( $HTTP_NOT_FOUND );

...

my %handlers = (
  $HTTP_OK      => sub { ... },
  $HTTP_CREATED => sub { ... },
  ...
);

DESCRIPTION

This module is basically a wrapper around HTTP::Status that allows you to use the constants as read-only scalar variables instead of function names.

This means the constants can be used in contexts where you need interpolated variables, such as hash keys or in strings.

Do I really need this?

No. You can get interpolated constants already, with some ugly syntax:

my %handlers = (
  HTTP_OK() => sub { ... },
);

or

"Status code ${ \HTTP_OK }"

So all this module gives you is some stylistic convenience, at the expense of additional dependencies (although ones that may be used by other modules).

INSTALLATION

See How to install CPAN modules.

Required Modules

This distribution requires Perl v5.10.1.

This distribution requires the following modules:

This distribution recommends the following modules:

RECENT CHANGES

Incompatabilities

  • Increased minimum version to Perl v5.10.1.

Other Changes

  • Updated copyright year.

  • Use Perl::Critic tests are part of build process.

  • Clean up prereqs in build.

  • Added author and release tests.

  • Use Dist::Zilla TravisYML plugin.

See the Changes file for a longer revision history.

EXPORTS

By default, only the HTTP constants are exported.

For convenience, the tags from HTTP::Status are supported so that the :is and status_message functions are exported.

SEE ALSO

HTTP::Status

AUTHOR

Robert Rothenberg, <rrwo at cpan.org>

Acknowledgements

Several people who pointed out that this module is unnecessary. (Yes, it's written to scratch an itch.)

LICENSE AND COPYRIGHT

Copyright 2014-2015 Robert Rothenberg.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

http-status-constants's People

Contributors

robrwo avatar

Watchers

 avatar James Cloos avatar

http-status-constants's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.