package component;
require Exporter;

our @ISA = qw( Exporter );
our @EXPORT = qw( get_component );

use lib ".";


# START HERE
# If we want the index page, then just call to the index mod
# If we want something else, then open call and close
sub get_component{
  
    my $self = shift;
    my $chpt = shift;
    my $page = shift;
    
    if($chpt ne "index"){
        component_opens( $self );
    }

    component_calls( $self, $chpt, $page );

    if($chpt ne "index"){
        component_closes( $self );
    }
}




#
#
# SETS OPENING PAGE TAGS ETC
sub component_opens{

    my $self = shift;

# INSERT TITLE HERE
    my $title = "Component ";

# INSERT HEADER HTML BETWEEN EOF1'S
my $head =<<EOF1;
EOF1

# INSERT SCRIPT HTML BETWEEN EOF2'S
my $script =<<EOF2;
EOF2
   
# INSERT BODY HTML FROM BETWEEN EOF3'S
my $body=<<EOF3;
EOF3
# TO HERE

$self->setTitle( $title );
$self->setHead( $head );
$self->setBody( $body );
}



#
#
# CALLS INNER-PAGE MODULES
sub component_calls{

    my $self = shift;
    my $chpt = shift;
    my $page = shift;

    if( $page eq 'index' ){
	use lib ".";
	use component_index;
	print "Index mod\n";
	component_index::get_index( $self );
    }

  
    else{
	print "\n\n Not a valid section \n";
	break;
    }

}


#
#
# LOAD CLOSING TAGS
sub component_closes{

    my $self = shift;

my $body =<<EOFCLOSE;
EOFCLOSE

    $self->setBody( $body );

}
