| 1 | |||
| 2 | |||
| 3 | package HTTP::DAVServer::MKCOL; | ||
| 4 | |||
| 5 | our $VERSION=0.1; | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | HTTP::DAVServer::MKCOL - Implements the MKCOL method | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | sub handle { | ||
| 17 | |||
| 18 | my ($self, $r, $url, $responder, $request) = @_; | ||
| 19 | |||
| 20 | my $path = $HTTP::DAVServer::ROOT . $url; | ||
| 21 | $url =~ m#^(.*)/([^/]+)$#; | ||
| 22 | my $parent = $HTTP::DAVServer::ROOT . $1; | ||
| 23 | |||
| 24 | if ( -d $path ) { | ||
| 25 | $responder->notAllowed( $r ); | ||
| 26 | } | ||
| 27 | |||
| 28 | unless ( -d $parent ) { | ||
| 29 | $responder->conflict( $r ); | ||
| 30 | } | ||
| 31 | |||
| 32 | unless ( mkdir $path ) { | ||
| 33 | $responder->forbidden( $r ); | ||
| 34 | } | ||
| 35 | |||
| 36 | $responder->created( $r ); | ||
| 37 | |||
| 38 | } | ||
| 39 | |||
| 40 | |||
| 41 | =head1 SUPPORT | ||
| 42 | |||
| 43 | For technical support please email to jlawrenc@cpan.org ... | ||
| 44 | for faster service please include "HTTP::DAVServer" and "help" in your subject line. | ||
| 45 | |||
| 46 | =head1 AUTHOR | ||
| 47 | |||
| 48 | Jay J. Lawrence - jlawrenc@cpan.org | ||
| 49 | Infonium Inc., Canada | ||
| 50 | http://www.infonium.ca/ | ||
| 51 | |||
| 52 | =head1 COPYRIGHT | ||
| 53 | |||
| 54 | Copyright (c) 2003 Jay J. Lawrence, Infonium Inc. All rights reserved. | ||
| 55 | This program is free software; you can redistribute | ||
| 56 | it and/or modify it under the same terms as Perl itself. | ||
| 57 | |||
| 58 | The full text of the license can be found in the | ||
| 59 | LICENSE file included with this module. | ||
| 60 | |||
| 61 | =head1 ACKNOWLEDGEMENTS | ||
| 62 | |||
| 63 | Thank you to the authors of my prequisite modules. With out your help this code | ||
| 64 | would be much more difficult to write! | ||
| 65 | |||
| 66 | XML::Simple - Grant McLean | ||
| 67 | XML::SAX - Matt Sergeant | ||
| 68 | DateTime - Dave Rolsky | ||
| 69 | |||
| 70 | Also the authors of litmus, a very helpful tool indeed! | ||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | HTTP::DAV, HTTP::Webdav, http://www.webdav.org/, RFC 2518 | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 1; | ||
| 79 |