URI::crid - URI scheme as defined in RFC 4078


URI-crid documentation Contained in the URI-crid distribution.

Index


Code Index:

NAME

Top

URI::crid - URI scheme as defined in RFC 4078

VERSION

Top

Version 0.01

SYNOPSIS

Top

Allows you to break down and/or build up URIs of the scheme CRID (as used by the TV-Anytime standard to uniquely identify television and radio programmes.

    use URI;

    my $doctor_who = URI->new("crid://bbc.co.uk/b0074fly");
	print "authority: " . $doctor_who->authority . $/;
	print "data: " . $doctor_who->data . $/;
    ...

METHODS

Top

authority [AUTHORITY]

Returns (or sets) the organisation which owns this crid. This usually corresponds to the organisation's domain name.

data [DATA]

Returns (or sets) the unique identifier that this crid applies to. The author of a crid may decide for themselves what form this data takes, to best suit the application.

AUTHOR

Top

Ali Craigmile, <ali at hodgers.com>

BUGS

Top

Please report any bugs or feature requests to bug-uri-crid at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=URI-crid. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc URI::crid




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=URI-crid

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/URI-crid

* CPAN Ratings

http://cpanratings.perl.org/d/URI-crid

* Search CPAN

http://search.cpan.org/dist/URI-crid

ACKNOWLEDGEMENTS

Top

Gisle Aas gaas@cpan.org for writing the base class URI.

COPYRIGHT & LICENSE

Top


URI-crid documentation Contained in the URI-crid distribution.
package URI::crid;

require URI;
our @ISA=qw(URI);

use warnings;
use strict;
use URI::Escape qw(uri_unescape);

our $VERSION = '0.01';

sub authority
{
    my $self = shift;
    my $old = $self->opaque;
    if (@_) {
		my $data = ($old =~ m|//[^/]+/(.*)$|)[0];
		my $new = shift;
		$new = "" unless defined $new;
		$self->opaque("//$new/$data");
		return $new;
    }
	$old = ($old =~ m|^//([^/]+)/?|)[0] || '';
    return undef unless defined $old;
    return uri_unescape($old);
}

sub data
{
	my $self = shift;
	my $old = $self->opaque;
    if (@_) {
    	my $tmp = $old;
    	$tmp = "/" unless defined $tmp;
		my $authority = ($old =~ m|^//([^/]+)/?|)[0] || '';
    	my $new = shift;
    	$new = "" unless defined $new;
    	$self->opaque("//$authority/$new");
		return $new;
    }
	$old = ($old =~ m|//[^/]+/(.*)$|)[0];
    return uri_unescape($old);
}

1;

1; # End of URI::crid