I tried to decypher your code but I give up. It is simply unreadable mess. I doubt you will understand it yourself after a week. Some hints:
  1. Use strict and warnings
  2. Use human readable variable names. When I see $n, $m, etc it say me nothing.
  3. Split large code chunks on subroutines with human readable names.
  4. Don't use exotic Perl features just because you can (i.e. code refs in @INC to convert templating language in Perl code on fly). There are much simplier ways to do the same thing (compile template in Perl code). Take a look on existing templaiting modules to see how. BTW probably they already do what you want or can be easily extended to do it.
  5. If you need to restrict power of Perl expressions you need to use Safe. Parsing Perl code is tricky.

--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org


In reply to Re: ref in @INC and debugging by IlyaM
in thread ref in @INC and debugging by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.