Puh, test scripts basically done. Still, the test-server seems to refuse to serve PROPFIND requests. I don't know if this is HTTP::Server::Simple or something else, yet. But again - this "we don't like lesser known methods" sucks..

What already can be observed is that CGI.pm strangely parses PUT data into a 'keywords' param(). (??)

Minor update to the code: uncommenting the CGI::Simple part should enable you to see how CGI::Simple beahves, but for me it simply hangs. I'm giving up for today...

test-client.pl
#perl use LWP::UserAgent; use HTTP::Request; my $ua = LWP::UserAgent->new; ## build request print "PROPFIND:\n"; $req = HTTP::Request->new('PROPFIND' => 'http://localhost:4242/'); $req->header( 'Depth' => '1' ); $req->content('<?xml version="1.0" encoding="utf-8" ?> <D:propfind xmlns:D="DAV:"> <D:prop> <D:creationdate/> <D:displayname/> <D:getcontentlength/> <D:getcontenttype/> <D:getetag/> <D:getlastmodified/> <D:resourcetype/> </D:prop> </D:propfind>'); ## fire request through ua and get a response back my $res = $ua->request($req); if ($res->is_success) { print $res->status_line ."\n". $res->headers->as_string . $res-> +content; }else{ print $res->status_line, "\n"; } print "\n\n"; ## build request print "PUT:\n"; $req = HTTP::Request->new('PUT' => 'http://localhost:4242/test.txt'); +## update $req->content('1234567890'); ## Pass request to the user agent and get a response back my $res = $ua->request($req); if ($res->is_success) { print $res->status_line ."\n". $res->headers->as_string . $res-> +content; }else{ print $res->status_line, "\n"; } print "\n\n";
a testapp.pm
package testapp; use base 'CGI::Application'; use Data::Dumper; sub setup { my $self = shift; $self->start_mode('index'); $self->run_modes('index' => 'index'); } ## update # sub cgiapp_get_query { # my $self = shift; # require CGI::Simple; # return CGI::Simple->new(); # } sub index { my $self = shift; return '<pre>'.Dumper($self); } 1;
and the server to run it:
#!/usr/bin/perl use CGI::Application::Server; use testapp; my $server = CGI::Application::Server->new(4242); # $server->document_root('./htdocs'); $server->entry_points({ '/' => 'testapp', '/test.txt' => 'testapp', }); $server->run();

In reply to Re^2: Are all .cgi helper modules unfit for http methods common in REST? by isync
in thread Are all .cgi helper modules unfit for http methods common in REST? by isync

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.