# -------------------------------------------------------------------------------------
# lib::Template::Link
# -------------------------------------------------------------------------------------
#
#    Author   : Jean-Michel Hiver                               (c) MKDoc Holdings Ltd.
#
# -------------------------------------------------------------------------------------
package flo::Template::Link;
use lib::Template::AbstractTag;
use lib::Exception;
use lib::Template;
use flo::Standard;
use strict;
use vars qw /@ISA/;
@ISA = qw /lib::Template::AbstractTag/;


##
# $obj->main;
# -----------
##
sub main
{
    my $self   = shift;
    my $result = $self->result;
    my $tokens = $self->tokens;
    my ($token_name, $token_hash) = $self->parse_tag (shift @{$tokens});
    
    my $cgix = cgi->new;
    foreach ($cgix->param) { $cgix->delete ($_) }
    $cgix->path_info ($token_hash->{href});
    $token_hash->{href} = $cgix->self_url;
    
    my $attr = join ' ', map { "$_=\"". $token_hash->{$_} . "\"" } sort (keys %{$token_hash});
    push @{$result}, "<link $attr />";
}


1;







