Author Topic: Documentation for .mas stub files?  (Read 1614 times)

sr105

  • Zen Apprentice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Documentation for .mas stub files?
« on: February 27, 2010, 08:05:38 pm »
Is there any documentation for the stub file formats? I'd like to make changes to my setup and I'd like to make my changes fit within ebox's design as much as possible.
Answer: apparently the format is http://www.masonbook.com/.

Short term question:Is there a way that I could read a file into a variable and have that variable appended at the end of the stub? Like the following:

<%init>
...
my $user_include_file;
{
  local $/=undef;
  open FILE,  "/etc/postfix/custom/user-main.cf" or die "Couldn't open file: $!";
  binmode FILE;
  $user_include_file = <FILE>;
  close FILE;
}

except I don't want the die part.
</%init>
...

<%$user_include_file%>



sr105

  • Zen Apprentice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Documentation for .mas stub files?
« Reply #1 on: February 28, 2010, 07:43:25 am »
Got it to work using the following code in /usr/share/ebox/stubs/mail/main.cf.mas just before the "</%init>" tag.
Code: [Select]
my $userMainCF;
if (open(FH, "/etc/postfix/user-main.cf")) {
    $userMainCF = join('', <FH>);
    close FH;
}
</%init>
and then at the end of the file:
Code: [Select]
<% $userMainCF %>