MsOffice-Word-Template

 view release on metacpan or  search on metacpan

lib/MsOffice/Word/Template.pm  view on Meta::CPAN

#======================================================================
# ATTRIBUTES
#======================================================================

# constructor attributes for interacting with MsWord
# See also BUILDARGS: the constructor can also take a "docx" arg
# that will be automatically translated into a "surgeon" attribute
has 'surgeon'       => (is => 'ro', isa => 'MsOffice::Word::Surgeon', required => 1);
has 'data_color'    => (is => 'ro', isa => 'Str',                     default  => "yellow");
has 'control_color' => (is => 'ro', isa => 'Str',                     default  => "green");
has 'part_names'    => (is => 'ro', isa => 'ArrayRef[Str]',           lazy     => 1,
                        default  => sub {[keys shift->surgeon->parts->%*]});
has 'property_files'=> (is => 'ro', isa => 'ArrayRef[Str]',
                        default => sub {[qw(docProps/core.xml docProps/app.xml docProps/custom.xml)]});

# constructor attributes for building a templating engine
has 'engine_class'  => (is => 'ro', isa => 'Str',                     default  => 'TT2');
has 'engine_args'   => (is => 'ro', isa => 'ArrayRef',                default  => sub {[]});

# attributes lazily constructed by the module -- not received through the constructor
has_inner 'engine'  => (is => 'ro', isa => 'MsOffice::Word::Template::Engine');


#======================================================================
# BUILDING INSTANCES
#======================================================================

# syntactic sugar for supporting ->new($surgeon) instead of ->new(surgeon => $surgeon)

lib/MsOffice/Word/Template/Engine.pm  view on Meta::CPAN

our $VERSION = '2.05';

#======================================================================
# ATTRIBUTES
#======================================================================

# passed through the constructor
has 'word_template'      => (is => 'ro', isa => 'MsOffice::Word::Template', required => 1, weak_ref => 1);

# lazily constructed, not received through the constructor
has 'xml_regexes'        => (is => 'ro', isa => 'ArrayRef[RegexpRef]',
                             lazy => 1, builder => '_xml_regexes',       init_arg => undef);
has 'compiled_template'  => (is => 'ro', isa => 'HashRef', 
                             lazy => 1, builder => '_compiled_template', init_arg => undef);
has '_constructor_args'  => (is => 'bare', isa => 'HashRef',             init_arg => undef);


#======================================================================
# ABSTRACT METHODS -- to be defined in subclasses
#======================================================================

abstract 'start_tag';
abstract 'end_tag';



( run in 0.650 second using v1.01-cache-2.11-cpan-5f2e87ce722 )