Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Copyright Writer

by kayos (Sexton)
on Apr 25, 2000 at 19:59 UTC ( #8993=sourcecode: print w/ replies, xml ) Need Help??

Category: data formatting
Author/Contact Info T.R. Fullhart, kayos@kayos.org
Description:

This writes COPYRIGHT files for me. Sometimes we give clients code with a very specific license. This lets me set the policies. It spits out the license statement on standard out.

Call it like this

mkcopyright "licensee"

I'll probably make changes to this code based on your comments, so check back later if you want a more flexible version

#!/usr/bin/perl
# $Id: mkcopyright,v 1.2 2000/05/11 16:34:02 kayos Exp $

my $cols = 70;
my $writer = "Virtual Focus, Inc.";
my $licensee = $ARGV[0] || "the licensee";
my $date = (localtime)[5] + 1900;
my $c = "#";
my $body;

# policies
my $allow_modification  = 1;            # implemented
my $warranty            = 0;            # implemented
my $responsible_for_damage = 0;         # implemented
my $client_can_resell   = 0;            # implemented

my $indefinite_licensing        = 1;
my $limited_time_licensing      = 0;


#--------------------------------------------------------------

my $tmpbody = '<' x ($cols - 5);
eval(qq{
format STDOUT =
\@ ^$tmpbody \@
\$c,\$body,\$c
.
});

sub print_divider {
        print $c x $cols,"\n";
}

sub print_body {
        $body = join(' ',@_);
        $body =~ s/\s+/ /gs;
        $body =~ s/^\s+//g;
        $body =~ s/\.+/./g;
        $body ||= " ";
        while($body) {
        write;
        }
}

#--------------------------------------------------------------

print_divider();
print_body("This program Copyright $date $writer");

print_body(qq{
        Program originally Copyrighted by $writer, 
        now licensed for use to $licensee
});

print_divider();
print_body("  COPYRIGHT NOTICE:");
print_body("Copyright $date $writer. All Rights Reserved.");

print_body();
print_body();

# do we warranty that the program does a particular function?
if(! $warranty) {
        print_body(qq{
                The program is provided "as is" without warranty of an
+y
                kind, either express or implied, including, but not li
+mited
                to warranties of merchantability or fitness for a
                particular purpose.
        });
        print_body();
}


# do we accept responsibility if "bad things" happen?
if(! $responsible_for_damage) {
        print_body(qq{
                In no event will $writer be liable to $licensee for an
+y
                damages, including incidental or consequential damages
+, 
                arising out of the use of the program, even if advised
+ of 
                the possibility of such damages. By licensing this cod
+e, 
                $licensee is now legally responsible for this copy of 
+the 
                program, and further agrees to indemnify $writer from 
+any 
                liability that might arise from its use. 
        });
        print_body();
}


if( $allow_modification ) {
        print_body(qq{
                This script may modified free of charge by $licensee.
                Any changes made to this program by $licensee will not
+ 
                be the responsibility of $writer.
        });
        print_body();
}

if(! $client_can_resell) {
        print_body(qq{
                Selling the code for this program without prior writte
+n
                consent is expressly forbidden.
        });
        print_body();
}

print_body(qq{
        $temp1
        $writer is still the owner of this program but grants 
        indefinite licensing use permission to $licensee.
});

print_body();

print_body(qq{
        You acknowledge that you have read the license, understand it
        and agree to be bound by its terms as the complete and exclusi
+ve
        statement of the agreement between us, superseding any proposa
+l
        or prior agreement, oral or written, and any other communicati
+ons
        between us relating to the subject matter of this license.
});

print_body();
print_divider();

Comment on Copyright Writer
Download Code
RE: Copyright Writer
by turnstep (Parson) on Apr 25, 2000 at 21:18 UTC

    If you are going to declare everythign else with "my", you might as well declare the block of "policies" starting with

    my $allow_modifications = 1; etc..
    (also need to declare $temp1)

    A special gotcha for anyone copying and pasting this code...make sure the period at the end of the 'format' section is the first character in the line! I overlooked that the first time. :)

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://8993]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-08-23 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls