G'day Thai Heng,

I suspect you may be confusing the main in main::show_call_information (which is a package and documented in package and perlmod: Packages) with main in main() and sub main {...} (which is a subroutine and documented in perlintro: Basic syntax overview and perlintro: Writing subroutines). [Note: many of the pages I've linked to contain links to further, relevant information.]

main::show_call_information indicates the show_call_information subroutine in the main package; it is not providing information that show_call_information() was called from main(). If that still seems confusing, try changing the name of the main subroutine to something unambiguous: the new output should probably prove enlightening.

You may also find these fairly recent threads to be of interest: "creating a perl entry-point" and "Main routines, unit tests, and sugar".

-- Ken


In reply to Re: why main() call automatically? by kcott
in thread why main() call automatically? by Thai Heng

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.