GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTTP::DAV::RESOURCE (3)

.ds Aq ’

NAME

HTTP::DAV::Resource - Represents and interfaces with WebDAV Resources

CONTENTS

SYNOPSIS

Sample

DESCRIPTION

Description here

CONSTRUCTORS

<B>newB> Returns a new resource represented by the URI.

$r = HTTP::DAV::Resource->new(
-uri => $uri,
-LockedResourceList => $locks,
-Comms => $comms
-Client => $dav_client
);

On creation a Resource object needs 2 other objects passed in:

1. a ResourceList Object. This list will be added to if you lock this Resource.

2. a Comms Object. This object will be used for HTTP communication.

2. a HTTP::DAV Object. This object is where all locks are stored

METHODS

<B>get/GETB> Performs an HTTP GET and returns a DAV::Response object.



 $response = $resource->get;
 print $resource->get_content if ($response->is_success);



<B>put/PUTB> Performs an HTTP PUT and returns a DAV::Response object.

$response = $resource->put( $string );

$string is be passed as the body.



 e.g.
 $response = $resource->put($string);
 print $resource->get_content if ($response->is_success);



Will use a Lock header if this resource was previously locked.

<B>copyB> Not implemented
<B>moveB> Not implemented
<B>deleteB> Performs an HTTP DELETE and returns a DAV::Response object.



 $response = $resource->delete;
 print "Delete successful" if ($response->is_success);



Will use a Lock header if this resource was previously locked.

<B>optionsB> Performs an HTTP OPTIONS and returns a DAV::Response object.



 $response = $resource->options;
 print "Yay for PUT!" if $resource->is_option("PUT");



<B>mkcolB> Performs a WebDAV MKCOL request and returns a DAV::Response object.



 $response = $resource->mkcol;
 print "MKCOL successful" if ($response->is_success);



Will use a Lock header if this resource was previously locked.

<B>proppatchB> xxx
<B>propfindB> Performs a WebDAV PROPFIND request and returns a DAV::Response object.



 $response = $resource->propfind;
 if ($response->is_success) {
    print "PROPFIND successful\n";
    print $resource->get_property("displayname") . "\n";
 }



A successful PROPFIND fills the object with much data about the Resource. Including:
displayname
...
TODO

<B>lockB> Performs a WebDAV LOCK request and returns a DAV::Response object.



 $resource->lock(
        -owner   => "Patrick Collins",
        -depth   => "infinity"
        -scope   => "exclusive",
        -type    => "write"
        -timeout => TIMEOUT,
     )



lock takes the following arguments.

<B>ownerB> - Indicates who locked this resource

The default value is:
DAV.pm/v$DAV::VERSION ($$)



 e.g. DAV.pm/v0.1 (123)



If you use a URL as the owner, the module will automatically indicate to the server that is is a URL (<D:href>http://...</D:href>)

<B>depthB> - Indicates the depth of the lock.

Legal values are 0 or infinity. (1 is not allowed).

The default value is infinity.

A lock value of 0 on a collection will lock just the collection but not it’s members, whereas a lock value of infinity will lock the collection and all of it’s members.

<B>scopeB> - Indicates the scope of the lock.

Legal DAV values are exclusive or shared.

The default value is exclusive.

See section 6.1 of RFC2518 for a description of shared vs. exclusive locks.

<B>typeB> - Indicates the type of lock (read, write, etc)

The only legal DAV value currently is write.

The default value is write.

<B>timeoutB> - Indicates when the lock will timeout

The timeout value may be one of, an Absolute Date, a Time Offset from now, or the word infinity.

The default value is infinity.

The following are all valid timeout values:

Time Offset:
30s 30 seconds from now
10m ten minutes from now
1h one hour from now
1d tomorrow
3M in three months
10y in ten years time

Absolute Date:



    timeout at the indicated time & date (UTC/GMT)
       2000-02-31 00:40:33  

    timeout at the indicated date (UTC/GMT)
       2000-02-31



You can use any of the Absolute Date formats specified in HTTP::Date (see perldoc HTTP::Date)

Note: the DAV server may choose to ignore your specified timeout.

<B>unlockB> Performs a WebDAV UNLOCK request and returns a DAV::Response object.



 $response = $resource->unlock()
 $response = $resource->unlock( -force => 1 )
 $response = $resource->unlock(
    -token => "opaquelocktoken:1342-21423-2323" )



This method will automatically use the correct locktoken If: header if this resource was previously locked.

<B>forceB> - Synonymous to calling $resource->forcefully_unlock_all.

<B>forcefully_unlock_allB> Remove all locks from a resource and return the last DAV::Response object. This method take no arguments.

$response = $resource->forcefully_unlock_all;

This method will perform a lockdiscovery against the resource to determine all of the current locks. Then it will UNLOCK them one by one. unlock( -token => locktoken ).

This unlock process is achievable because DAV does not enforce any security over locks.

Note: this method returns the LAST unlock response (this is sufficient to indicate the success of the sequence of unlocks). If an unlock fails, it will bail and return that response. For instance, In the event that there are 3 shared locks and the second unlock method fails, then you will get returned the unsuccessful second response. The 3rd unlock will not be attempted.

Don’t run with this knife, you could hurt someone (or yourself).

<B>steal_lockB> Removes all locks from a resource, relocks it in your name and returns the DAV::Response object for the lock command. This method takes no arguments.

$response = $resource->steal_lock;

Synonymous to forcefully_unlock_all() and then lock().

<B>lockdiscoveryB> Discover the locks held against this resource and return a DAV::Response object. This method take no arguments.



 $response = $resource->lockdiscovery;
 @locks = $resource->get_locks if $response->is_success;



This method is in fact a simplified version of propfind().

<B>as_stringB> Returns a string representation of the object. Mainly useful for debugging purposes. It takes no arguments.

print $resource->as_string

ACCESSOR METHODS (get, set and is)

<B>is_optionB> Returns a boolean indicating whether this resource supports the option passed in as a string. The option match is case insensitive so, PUT and Put are should both work.



 if ($resource->is_option( "PUT" ) ) {
    $resource->put( ... )
 }



Note: this routine automatically calls the options() routine which makes the request to the server. Subsequent calls to is_option will use the cached option list. To force a rerequest to the server call options()

<B>is_lockedB> Returns a boolean indicating whether this resource is locked.



  @lock = $resource->is_locked( -owned=>[1|0] );



<B>ownedB> - this parameter is used to ask, is this resource locked by me?

Note: You must have already called propfind() or lockdiscovery()

e.g. Is the resource locked at all?
print yes if $resource->is_locked();

Is the resource locked by me?
print yes if $resource->is_locked( -owned=>1 );

Is the resource locked by someone other than me?
print yes if $resource->is_locked( -owned=>0 );

<B>is_collectionB> Returns a boolean indicating whether this resource is a collection.



 print "Directory" if ( $resource->is_collection );



You must first have performed a propfind.

<B>get_uriB> Returns the URI object for this resource.



 print "URL is: " . $resource->get_uri()->as_string . "\n";



See the URI manpage from the LWP libraries (perldoc URI)

<B>get_propertyB> Returns a property value. Takes a string as an argument.



 print $resource->get_property( "displayname" );



You must first have performed a propfind.

<B>get_optionsB> Returns an array of options allowed on this resource. Note: If $resource->options has not been called then it will return an empty array.

@options = $resource->get_options

<B>get_contentB> Returns the resource’s content/body as a string. The content is typically the result of a GET.

$content = $resource->get_content

<B>get_content_refB> Returns the resource’s content/body as a reference to a string. This is useful and more efficient if the content is large.

${$resource->get_content_ref} =~ s/\bfoo\b/bar/g;

Note: You must have already called get()

<B>get_lockB> Returns the DAV::Lock object if it exists. Requires opaquelocktoken passed as a parameter.



 $lock = $resource->get_lock( "opaquelocktoken:234214--342-3444" );



<B>get_locksB> Returns a list of any DAV::Lock objects held against the resource.



  @lock = $resource->get_locks( -owned=>[1|0] );



<B>ownedB> - this parameter indicates which locks you want.
- ’1’, requests any of my locks. (Locked by this DAV instance).
- ’0’ ,requests any locks not owned by us.
- any other value or no value, requests ALL locks.

Note: You must have already called propfind() or lockdiscovery()

e.g.
Give me my locks
@lock = $resource->get_locks( -owned=>1 );



 Give me all locks
  @lock = $resource->get_locks();



<B>get_lockedresourcelistB>
<B>get_parentresourcelistB>
<B>get_commsB>
<B>set_parent_resourcelistB> $resource->set_parent_resourcelist( $resourcelist )

Sets the parent resource list (ask the question, which collection am I a member of?). See HTTP::DAV::ResourceList.

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 1811: =over without closing =back
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTTP::DAV::RESOURCE (3) 2012-04-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.