Code Monkey home page Code Monkey logo

http-tiny-ua's Introduction

HOW TO CONTRIBUTE

Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code.

The distribution is managed with Dist::Zilla. This means that many of the usual files you might expect are not in the repository, but are generated at release time, as is much of the documentation. Some generated files are kept in the repository as a convenience (e.g. Makefile.PL or cpanfile).

Generally, you do not need Dist::Zilla to contribute patches. You do need Dist::Zilla to create a tarball. See below for guidance.

Getting dependencies

If you have App::cpanminus 1.6 or later installed, you can use cpanm to satisfy dependencies like this:

$ cpanm --installdeps .

Otherwise, look for either a Makefile.PL or cpanfile file for a list of dependencies to satisfy.

Running tests

You can run tests directly using the prove tool:

$ prove -l
$ prove -lv t/some_test_file.t

For most of my distributions, prove is entirely sufficient for you to test any patches you have. I use prove for 99% of my testing during development.

Code style and tidying

Please try to match any existing coding style. If there is a .perltidyrc file, please install Perl::Tidy and use perltidy before submitting patches.

If there is a tidyall.ini file, you can also install Code::TidyAll and run tidyall on a file or tidyall -a to tidy all files.

Patching documentation

Much of the documentation Pod is generated at release time. Some is generated boilerplate; other documentation is built from pseudo-POD directives in the source like C<=method> or C<=func>.

If you would like to submit a documentation edit, please limit yourself to the documentation you see.

If you see typos or documentation issues in the generated docs, please email or open a bug ticket instead of patching.

Where to send patches and pull requests

If you found this distribution on Github, sending a pull-request is the best way to contribute.

If a pull-request isn't possible, a bug ticket with a patch file is the next best option.

As a last resort, an email to the author(s) is acceptable.

Installing and using Dist::Zilla

Dist::Zilla is not required for contributing, but if you'd like to learn more, this section will get you up to speed.

Dist::Zilla is a very powerful authoring tool, optimized for maintaining a large number of distributions with a high degree of automation, but it has a large dependency chain, a bit of a learning curve and requires a number of author-specific plugins.

To install it from CPAN, I recommend one of the following approaches for the quickest installation:

# using CPAN.pm, but bypassing non-functional pod tests
$ cpan TAP::Harness::Restricted
$ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla

# using cpanm, bypassing *all* tests
$ cpanm -n Dist::Zilla

In either case, it's probably going to take about 10 minutes. Go for a walk, go get a cup of your favorite beverage, take a bathroom break, or whatever. When you get back, Dist::Zilla should be ready for you.

Then you need to install any plugins specific to this distribution:

$ cpan `dzil authordeps`
$ dzil authordeps | cpanm

Once installed, here are some dzil commands you might try:

$ dzil build
$ dzil test
$ dzil xtest

You can learn more about Dist::Zilla at http://dzil.org/

http-tiny-ua's People

Contributors

xdg avatar fgasper avatar plicease avatar schwern avatar

Stargazers

Christopher Layne avatar Keith Broughton avatar Keedi Kim avatar Christian Hansen avatar

Watchers

Christian Hansen avatar James Cloos avatar  avatar

http-tiny-ua's Issues

Add log/debug/trace support

Per chansen/p5-http-tiny#58 there's a request for the ability to get
log output of request and response details.

My inclination is to use Log::Any for this, which is low overhead
and allows people to hook up various log collectors. (And
Log::Any is going to get even better once I finally document my revision
and ship it!)

Then I'd have no problem with an HTTP_TINY_UA_TRACE environment variable
automatically hooking up Log::Any to STDERR for messages from HTTP::Tiny.

Exception-throwing mode

It would be useful for this module to throw exceptions on various failures: network failure, 400/500 return code, etc.

Has this kind of operation mode been discussed previously?

Perhaps a simple, overridable _throw() method?

SPDY support

This is a placeholder issue to discuss @odyniec's SPDY variant to HTTP::Tiny and how best to merge it in.

My inclination is to put HTTP::TIny::Handle::SPDY into it's own .pm file. (The original was bundled to make fatpacking HTTP::TIny easier).

I'd put the modified _request method into the main HTTP::Tiny::UA module rather than having it as a subclass.. My goal is to avoid fragmented subclasses that can't work together or require people to compose new classes. If it starts getting unwieldy, maybe a plugin/mixin system will work.

Actually, as I think about it, maybe it would be better to have a _request_spdy method that does all the hard work, and then just make an overloaded _request method that either calls _request_spdy or calls SUPER::_request. That would avoid duplicating a lot of the code, I think.

If there's a way to cleanly refactor the _request call in HTTP::Tiny itself so make swapping in SPDY require less duplicate code, I might be open to that as well.

Anyway, those are my thoughts so far. :-)

HTTP::Tiny::UA::Response `header` returning an arrayref or str is annoying

It would be nice to have a method which consistently returned a string. In the case of a header which was repeated in the response, join them with a comma. The HTTP spec says that the following two are equivalent:

X-Foo: 1
X-Foo: 2
X-Foo: 1, 2

I'm not suggesting changing the current header method, but adding a new one.

Drop superclass dep.

I know it may seem like a good idea, but superclass is adding another dep and bringing in Module::Load to do little more than what Perl currently handles with a Makefile. It would be my preference to use parent. If you want to version the modules, just eq against $HTTP::Tiny::VERSION.

I know you created it, cool idea, perhaps you could get it into core instead.

Tests fail with HTTP::Tiny 0.42

Looks like Persistent Connections messed up the expected headers.

t/200_live.t ........... skipped: Only run for $ENV{AUTOMATED_TESTING}

#   Failed test 'get-01.txt request data'
#   at t/100_get.t line 65.
#          got: 'GET /index.html HTTP/1.1
# Host: example.com
# User-Agent: HTTP-Tiny-UA/0.001
# '
#     expected: 'GET /index.html HTTP/1.1
# Connection: close
# Host: example.com
# User-Agent: HTTP-Tiny-UA/0.001
# '
# Looks like you failed 1 test of 8.
t/100_get.t ............ 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/8 subtests 
t/00-compile.t ......... ok

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.