Fellow Monks,

So, recently, to get around the whole blocking issue with LWP, we’ve switched to using AnyEvent::HTTP instead.

In most cases, this seems to work well, except for one, where seemingly the same call runs into AnyEvent::Socket wanting to mess around with Socket::pack_sockaddr_un, which isn’t implemented under Win32. (Pox on non-POSIX systems)

In particular, I have a module that does the whole HTTP management, and both the broken and the working application call its call() method. Which is nothing spectacular:

sub call { my $self = shift; my ($method, $path, $format, $query, $content, $cb) = @_; $self->{Request} = HTTP::Request->new( $method, "https://$self->{host}/cgi-bin/api/" . join('/', @$path) . (". +$format") . ($query ? "?$query" : "") ); $self->{Request}->content($content) if $content; $self->_head($self->{Request}, $cb); }

(In during a pox on AnyEvent::HTTP for not using HTTP::{Request,Response,Headers} etc.)

_head probes the URI with a HEAD request, gets the nonce, and then does a proper _request with the proper Digest response. And passes over the callback function which was defined during call’s call.

For some reason, one of the apps does this fine (even under Windows), while the other croaks with the above problem. I simply don’t see what could be different between the two.

$api->call(GET => ['foo', $spam], 'json', undef, undef, s +ub { ... }); ## Program M, works $api->call(GET => ['bar', $spam, 'baz', $ham], 'json', undef, undef, s +ub { ... }); ## Program C, doesn't work

So, no idea at this point.


In reply to AnyEvent::HTTP and Socket on Windows by Ralesk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.