Clair::ALE

URL


SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods

SummaryTop
Clair::ALE::URL - A URL created by the Automatic Link Extrapolator

Package variablesTop
No package variables defined.

Included modulesTop
Carp
Clair::Utils::ALE

SynopsisTop
This object simply contains a URL and an ID for a single URL.

DescriptionTop

    new(url => 'url', id => 'id')

    Create a new URL with the given URL and ID. Both of these options are
required, and no others are currently recognized.

    $url->print([indent_spaces])

    Print a brief, human-readable description of a URL. If the
indent_spaces parameter is provided, everything will be indented by
indent_spaces characters of $Clair::Utils::ALE::INDENTCHAR; this is useful for printing easy-to-read nested structures. No other guarantees about the format of the output are provided; if you need a specific format, you should just print things out yourself, or else talk to me about adding a specialized printing method.

    $url->{url}

    The absolute URL of this URL.

    $url->{id}

    A short unique identifier for this URL.

MethodsTop
newNo descriptionCode
printNo descriptionCode

Methods description


None available.

Methods code


newdescriptionprevnextTop
sub new {
  my $class = shift;
  my $self = {@_};

  unless ($self->{url} and $self->{id})
  {
    croak "Need a url and an id to create an Clair::ALE::URL!\n";
  }
  bless $self,$class;
}

printdescriptionprevnextTop
sub print {
  my $self = shift;
  my($indent_spaces) = @_;
  my $indent;
  if ($indent_spaces)
  {
    $indent = " " x $indent_spaces;
  }
  else
  {
    $indent = "";
    $indent_spaces=0;
  }

  print $indent,"(URL)\n";
  print $indent,"url: $self->{url}\n";
  print $indent," id: $self->{id}\n";
}

General documentation


EXAMPLESTop
Mostly, these are created from Clair::ALE::Search and other modules; there really isn't a good reason to create one yourself, but if you want to, you can do:
	my $url = Clair::ALE::URL->new(url => 'http://www.test.com/',
id => 100);
or get one back from a search:
	my $search = Clair::ALE::Search->new(word => 'penguin');
my $conn = $search->queryresult;
my $link = $conn->{link}->[0];
my $url = $link->{to};
After that, you can get the information from its instance variables:
	print "url=",$url->{url},"; id=",$url->{id},"\n";
or just print out the whole thing:
	$url->print;

SEE ALSOTop
Clair::Utils::ALE, Clair::ALE::Search, Clair::ALE::Link, Clair::ALE::Conn.