use base qw(TM);
use Class::Trait ('TM::ResourceAble');
my $tm = new MyNiftyMap;
# or at runtime even:
Class::Trait->apply ('TM', qw(TM::ResourceAble));
my $tm = new TM;
DESCRIPTIONThis traits adds methods to provide the role resource to a map. That allows a map to be associated with a resource which is addressed by a URL (actually a URI for that matter).
Predefined URIsThe following resources, actually their URIs are predefined:
- Symbolizes the UNIX STDIN file descriptor. The resource is all text content coming from this file.
- Symbolizes the UNIX STDOUT file descriptor.
- Symbolizes a resource which never delivers any content and which can consume any content silently (like "/dev/null" under UNIX).
Predefined URI Methods
An inlined resource is a resource which contains all content as part of the URI. Currently
the TM content is to be written in AsTMa=.
$url = $tm->url
Once an object of this class is instantiated it keeps the URL of the resource to which it is associated. With this method you can retrieve and set that. No special further action is taken otherwise.
$time = $tm->mtime
This function returns the UNIX time when the resource has been modified last. 0 is returned if the result cannot be determined. All methods from LWP are supported.
Special resources are treated as follows:
- always has mtime 0
- always has an mtime 1 second in the future. The idea is that STDIN always has new content.
- always has mtime 0. The idea is that STDOUT never changes by itself.