Depending upon the directions which you take with development, this could be a bigger project than anticipated. If I were tackling this project my first task would be to develop a schema of installation steps, both prior to and following the copying of files, allowing for the searching for dependencies and execution of external script or configuration components - This schema to my mind would need to be modular in fashion so that installation behaviour can be defined by a series of definition or configuration files such that your installer script would offer you the greatest flexibility without having to go back and constantly modify/update it.

On to your specific questions however ...

  1. What's the fastest/most efficient (without wasting memory) way to check if a module is installed?

    To my mind, the quickest would be to actually try and use the module - For example:

    eval { require $module; } if ($@) { # handling for when module fails to load }

    This approach to module and library handling is discussed in the perlfunc:require man page.

     

  2. What happens when a program tries to use 'CPAN' but noone has configured it?

    The init method from the module CPAN::FirstTime is invoked which attempts to configure the CPAN module by prompting the user for information and writing a CPAN::Config configuration file.

     

  3. Is there any way to determine the path to sendmail? Or is there a common default path?

    While the majority of sendmail installations use the target location of /usr/sbin/sendmail, this is not absolute and should not be relied upon. A better way would be to search for the sendmail binary within your script, making use of the File::Find module. However, for better cross-platform compatibility, it may be better still to prompt the user for the local network mail server and communicate directly via SMTP - The advantage which this has is that your script installation is not dependent upon a local sendmail installation for execution and offers greater flexibility to administrators who may wish to impose local mail security policies.

     

Good luck! :-)

 


In reply to Re: Installer Program by rob_au
in thread Installer Program by Flame

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.