The only real legal answer to that if you are concerned is talk to a lawyer (which I am not). As far as I understand these questions are still very much in the defining stage for the programming world, and the law varies quite considerably from country to country. There are far older forms of expression to which copyright law also applies which still suffer from the same definability problem. For example, the fact whether a certain piece of music is a derivative work from another can be governed by the length of a melody they share (in bars or seconds) as well as the length of the music in it's entirety. As far as I understand that is considered to be a pretty well nailed-down definition :-). I don't know if similar definitions will become commonplace for code (or what definitions are used in courts at the moment), but the problem seems to me to be much harder.

The bit about commercial organisations using CPAN modules in their entirety is relatively clear though. The modules license itself states under what terms and how you can and cannot use the module, abide by those rules and there should not be a problem (as long as no-one challenges the license in court in future and it is found to be invalid in itself). If a module does not come with a license, a paranoid company lawyer might want to contact the author and make sure that the license your company is presuming to use the module under (e.g. the Artistic License) is granted by the author.

My sarcasm filter seems to be slightly faulty atm, I can't really tell which part of your question was facetious and which wasn't. Once you "derive" from a piece of code you are copying from it and changing the variable names doesn't alter that fact more than playing "Johnny B.Goode" on a harp makes it your original work. If you look at an algorithm in a piece of code and then go away and reimplement it yourself you should be allright. I think. It depends. Ask a lawyer.

Oh, and if you were asking for my opinion on what's ethical as opposed to what's legal, it's quite simple, I try to respect an authors wishes to the best of my abilities.

Update: Trying to actually answer the questions:

  • And again, I am not a lawyer, any opinion I give here is my interpretation of laws and based solely on others (often non-lawyers themselves) interpretation of the law.

    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan

    In reply to Re^11: Why non-core CPAN modules can't be used in large corporate environments. by tirwhan
    in thread Why non-core CPAN modules can't be used in large corporate environments. by Moron

    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.