Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I ran the code before posting - you should be fine. There is some more or less "standard boiler plate" for these things. You should read the tut's if you plan to make a lot of these things. This was just an example to get you started. You can go a long way with just a little hacking based upon this example, for first testing, you don't need to worry about ISA or Exporter actually means... just follow the example.

There really isn't any such thing as a "private subroutine" in Perl - if you know the fully qualified name, you can call the function even if the sub's name is not exported. DNAlibrary::DNAappend(...); Exporting the symbol allows you to call it without having the package name prefix. If you use EXPORT_OK(...), then you need to specifiy the routines to import in the "use DNAlibrary" statement in the caller's program.

There are various testing harnesses to do automated tests during installation, etc. Sometimes I don't fiddle with that and just put a sub called test() in the module which I don't export. Then I have a $DEBUG variable that I set to 1 when I am working the the .pm file => then some statement like: test() if $DEBUG; That way the .pm file will produce a result when you run it by itself. Sophistication varies, but you should have some sort of testing strategy so that you can validate the module's functions without some extra driver program. This will save a LOT of grief later on.

You may not have seen an "our" variable before. A "my" variable does not go in the symbol table and is not eligible for export. An "our" variable does (it has "package scope", not "lexical scope". Since all of my modules have a $VERSION, exporting it makes no sense (name would conflict with other modules). But you can print it with print DNAlibrary::$VERSION; That wouldn't work if $VERSION was a "my" variable.

Glad to help you get started. Let me know if there are troubles. For right now, put the .pm file in the same directory as the .pl file. After awhile, this will no longer be adequate but there are a number of ways to solve that problem - but that's a different subject!

The goal here was go get you started and I think the Monks have done that. I would recommend buying the "Perl Cookbook" - it has lots of useful "recipes" for common problems. Of course there are lots and lots of details about this stuff.

In reply to Re^3: How can I define the subroutine to get the result of the appended string i.e. ATGCTTTT? by Marshall
in thread How can I define the subroutine to get the result of the appended string i.e. ATGCTTTT? by supriyoch_2008

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (3)
    As of 2018-05-22 03:16 GMT
    Find Nodes?
      Voting Booth?