Hi all, I'm new to the site (cudo's btw!) and my problem (challenge) could fit in several sections. So I'd thought I'd put it here,

I developed a picview script: http://www.mrmental.com/cgi-bin/picview.pl
(If you look, check the "Beautiful Rotterdam" one)

It show pictures, thumbs and an event list. It's basically divided into three sections:

#### Overall Script Flow if ($parm{'event'} == -1) { # Build an eventlist event_list(); } elsif ($parm{'pic'} == -1) { # Or build a thumbs page thumbs_page(); } else { # Or show a picture picture_page(); } #### Outa here!
Full source: http://www.mrmental.com/picview.txt

To reduce the use of the visitor bandwidth there are three sizes per picture. The thumb, the preview and the full for download.

It runs in a CGI env. and I want to give it different use when ran from the CLI. When run from the CLI I want it to check for new directories and automatically create the different sizes. No problem here.

What I already ran into in the past is when to create sub's or not. Stuff that's needed more then once could go in a sub routine. But twice is also more then once.

There are the "print_head" and "print_tail" subs, which are fairly simple. On the other hand, it runs as a SSI (server side include) and as a page on its own and therefore it show different navigation icons for both situations. And these are not so easy to disect and put in a sub.

(A big thanx if you're still with me on this!)

I can see a delicate difference between ease of use and absolutely reducing al code the small building blocks.

However, I need you guru's to give me a pointer. So the burning question is:"How far should I take this urge to normalize everything?

Thanx a lot.

Kind regards,

Gerard.
~
~
:wq!

In reply to Global program flow by Mr. Mental

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.