Changes between Version 1 and Version 2 of Development/Code/TemplateToolkit


Ignore:
Timestamp:
Apr 17, 2012, 8:58:08 PM (13 years ago)
Author:
munoz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Development/Code/TemplateToolkit

    v1 v2  
    33In some cases, most of the code deals with printing correctly to a file, and it could be simplified a lot by using a basic template instead of zillions of print statements.
    44
    5 For instance, the accounts component could do.
     5For instance, the accounts component could do the following to fully generate /etc/passwd:
    66
    77{{{
     
    1818my $tpl = Template->new();
    1919$tpl->process(\*DATA, $tree, $fh);
     20$fh->close();
    2021
    2122__DATA__
     
    2627}}}
    2728
    28 The advantage in some sitiations is that the representation is completely isolated from the logic that will generate it. And it may allow for a closer correspondency with the schema, if wanted.
     29The code would thus only choose what accounts are valid or invalid in the system.
     30
     31The advantage in '''some''' sitiations is that the representation is completely isolated from the logic that will generate it. And it may allow for a closer correspondency with the schema, if wanted.
    2932
    3033Sometimes one template won't be enough: there will be several files of several types to print (f.i, nagios-related configuration). We still have to see how to ship different templates.