package Apache::AxKit::Provider::DOM;
use strict;
use vars qw/@ISA/;
@ISA = ('Apache::AxKit::Provider');

use Apache;
use Apache::Log;
use Apache::AxKit::Exception;
use Apache::AxKit::Provider;
use AxKit;

sub new {
    my $class = shift;
    my $apache = shift;
    my $self = bless { apache => $apache }, $class;
    
    eval { $self->init(@_) };
    
    return $self;
}

sub apache_request {
    my $self = shift;
    return $self->{apache};
}

sub init {
    my $self = shift;
    $self->{dom} = $_[0];
    $self->{styles} = $_[1];
    
    
    
 warn "Scalar Provider constructed with: $self->{data}\n";
}

sub process {
    my $self = shift;
    return 1;
}

sub exists {
    my $self = shift;
    return 1;
}

sub mtime {
    my $self = shift;
    return time(); # always fresh
}

sub get_fh {
    throw Apache::AxKit::Exception::IO( -text => "Can't get fh for Scalar" );
}

sub get_dom{
	return shift->{'dom'};
}

sub get_strref {
    my $self = shift;
    my $str = $self->{dom}->toString();
    return \$str;
}

sub key {
    my $self = shift;
    # I think thi should return an MD5 at this point.
    return 'dom_provider';
}

sub get_styles {
    my $self = shift;
    return $self->{styles}, [];
}

1;
