| Summary | Package variables | Synopsis | Description | General documentation | Methods |
| Summary | Top |
| Clair::ALE::Link - A link between two URLs created by the Automatic Link Extrapolator. |
| Package variables | Top |
| No package variables defined. |
| Included modules | Top |
| Carp |
| Clair::ALE::URL |
| Clair::ALE::_SQL |
| Clair::Utils::ALE |
| Synopsis | Top |
| This object contains two URLs comprising a link between two pages, the source page ("from") and the destination page ("to"). |
| Description | Top |
|
new (to => Clair::ALE::URL, from => Clair::ALE::URL, text => 'words which create link', id => 'link_id')Creates a new Clair::ALE::Link object with an Clair::ALE::URL for the 'to' and 'from' of the link, the words that create the link (in an HTML Web page, the part between the <a> and </a> tags as 'text', and a short unique identifier in 'id'. All of these parameters are required, and no others are recognized. $url->print ([indent_spaces]) Print a brief, human-readable description of a Link. If theindent_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. $link->{from} An Clair::ALE::URL object containing the address the link is"from" (the "source" page). $link->{to} An Clair::ALE::URL object containing the address the link is "to"(the "destination" page). $link->{text} A string containing the words which link the two pages. For an HTMLWeb page, this would be the part between the <a> and </a> tags. $link->{id} A short, unique identifier for this link. |
| Methods | Top |
| new | No description | Code |
| No description | Code |
| new | description | prev | next | Top |
sub new
{
my $class = shift;
my $self = {@_};
unless ($self->{to} && $self->{from} && $self->{text} && $self->{id})
{
croak "Need to, from, text, id to create Clair::ALE::Link!";
}
bless $self,$class;} |
| description | prev | next | Top |
sub print
{
my $self = shift;
my($indent_spaces) = @_;
my $indent;
if ($indent_spaces)
{
$indent = $Clair::Utils::ALE::INDENTCHAR x $indent_spaces;
}
else
{
$indent = "";
$indent_spaces = 0;
}
print $indent,"(Link)\n";
print $indent,"From:\n";
$self->{from}->print($indent_spaces+$Clair::Utils::ALE::INDENTS_PER_LEVEL);
print $indent,"To:\n";
$self->{to}->print($indent_spaces+$Clair::Utils::ALE::INDENTS_PER_LEVEL);
print $indent,"Link ID: ",$self->{id},"\n";
print $indent,"Link Text: ",$self->{text},"\n";} |
| EXAMPLES | Top |
| Mostly, links will come back 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 $link = Clair::ALE::Link->new(to => Clair::ALE::URL->new(url=>'http://www.test.com/',id=>1), |
| SEE ALSO | Top |
| Clair::Utils::ALE, Clair::ALE::Search, Clair::ALE::URL, Clair::ALE::Conn. |