File Coverage

blib/lib/ParseUtil/Domain.pm
Criterion Covered Total %
statement 150 158 94.9
branch 37 42 88.1
condition 6 9 66.6
subroutine 20 21 95.2
pod 2 2 100.0
total 215 232 92.6


line stmt bran cond sub pod time code
1             package ParseUtil::Domain;
2              
3             ## no critic
4             our $VERSION = '2.42';
5             $VERSION = eval $VERSION;
6             ## use critic
7              
8 4     4   287475 use Carp;
  4         7  
  4         258  
9              
10 4     4   456 use Modern::Perl;
  4         9267  
  4         26  
11 4     4   983 use utf8::all;
  4         44691  
  4         27  
12 4     4   8788 use autobox;
  4         16899  
  4         19  
13 4     4   4296 use autobox::Core;
  4         26745  
  4         25  
14 4     4   4886 use List::MoreUtils qw/any/;
  4         3376  
  4         269  
15 4     4   1876 use Perl6::Export::Attrs;
  4         16515  
  4         21  
16 4     4   2330 use Net::IDN::Encode ':all';
  4         325904  
  4         616  
17 4     4   29 use Net::IDN::Punycode ':all';
  4         6  
  4         329  
18 4     4   1969 use Net::IDN::Nameprep;
  4         424240  
  4         328  
19             #use Smart::Comments;
20              
21 4     4   2751 use ParseUtil::Domain::ConfigData;
  4         11  
  4         1991  
22              
23             sub parse_domain : Export(:parse) {
24 72     72 1 40046 my $name = shift;
25             ### testing : $name
26 72         527 my @name_segments = $name->split(qr{\Q@\E});
27             ### namesegments : \@name_segments
28              
29 72         670 my @segments = $name_segments[-1]->split(qr/[\.\x{FF0E}\x{3002}\x{FF61}]/);
30             ### executing with : $name
31 72         555 my ( $zone, $zone_ace, $domain_segments ) =
32             _find_zone( \@segments )->slice(qw/zone zone_ace domain/);
33              
34             ### found zone : $zone
35             ### found zone_ace : $zone_ace
36              
37 71         579 my $puny_processed = _punycode_segments( $domain_segments, $zone );
38 64         285 my ( $domain_name, $name_ace ) = $puny_processed->slice(qw/name name_ace/);
39             ### puny processed : $puny_processed
40             ### joining name slices : $domain_name
41 64 100       543 $puny_processed->{name} = [ $domain_name, $zone ]->join('.')
42             if $domain_name;
43 64 100       435 $puny_processed->{name_ace} = [ $name_ace, $zone_ace ]->join('.')
44             if $name_ace;
45 64         238 @{$puny_processed}{qw/zone zone_ace/} = ( $zone, $zone_ace );
  64         127  
46              
47             # process .name "email" domains
48 64 100       135 if ( @name_segments > 1 ) {
49 2         7 my $punycoded_name = _punycode_segments( [ $name_segments[0] ], $zone );
50 2         13 my ( $domain, $domain_ace ) =
51             $punycoded_name->slice(qw/domain domain_ace/);
52              
53 2         20 $puny_processed->{domain} =
54             [ $domain, $puny_processed->{domain} ]->join('@');
55 2 50       14 if ($domain_ace) {
56 2         11 $puny_processed->{domain_ace} =
57             [ $domain_ace, $puny_processed->{domain_ace} ]->join('@');
58              
59             }
60             }
61 64         204 return $puny_processed;
62              
63 4     4   35 }
  4         7  
  4         33  
64              
65             sub puny_convert : Export(:simple) {
66 0     0 1 0 my $domain = shift;
67 0         0 my @keys;
68 0 0       0 if ( $domain =~ /\.?xn--/ ) {
69 0         0 @keys = qw/domain zone/;
70             }
71             else {
72 0         0 @keys = qw/domain_ace zone_ace/;
73             }
74 0         0 my $parsed = parse_domain($domain);
75 0         0 my $parsed_domain = $parsed->slice(@keys)->join(".");
76              
77 0         0 return $parsed_domain;
78 4     4   2102 }
  4         8  
  4         63  
79              
80             sub _find_zone {
81 72     72   76 my $domain_segments = shift;
82              
83 72         327 my $tld_regex = ParseUtil::Domain::ConfigData->config('tld_regex');
84             ### Domain Segments: $domain_segments
85 72         309 my $tld = $domain_segments->pop;
86 72         348 my $sld = $domain_segments->pop;
87 72         252 my $thld = $domain_segments->pop;
88              
89 72         168 my ( $possible_tld, $possible_thld );
90 144         29390 my ( $sld_zone_ace, $tld_zone_ace ) =
91 72         97 map { domain_to_ascii( nameprep $_) } $sld, $tld;
92 72         8603 my $thld_zone_ace;
93 72 100       232 $thld_zone_ace = domain_to_ascii( nameprep $thld) if $thld;
94 72 100       4311 if ( $tld =~ /^de$/ ) {
95             ### is a de domain
96 3         8 $possible_tld = join "." => $tld, _puny_encode($sld);
97             }
98             else {
99 69         132 $possible_tld = join "." => $tld_zone_ace, $sld_zone_ace;
100 69 100       171 $possible_thld = join "." => $possible_tld,
101             $thld_zone_ace
102             if $thld_zone_ace;
103             }
104 72         69 my ( $zone, @zone_params );
105              
106             # first checking for third level domain
107 72 100 100     199914 if ( $possible_thld and $possible_thld =~ /\A$tld_regex\z/ ) {
    100          
    100          
108             ### $possible_thld: $possible_thld
109 10         24 my $zone_ace = join "." => $thld_zone_ace, $sld_zone_ace, $tld_zone_ace;
110 10         20 $zone = join "." => $thld, $sld, $tld;
111 10         18 push @zone_params, zone_ace => $zone_ace;
112             }
113             elsif ( $possible_tld =~ /\A$tld_regex\z/ ) {
114             ### possible_tld: $possible_tld
115 24         34 push @{$domain_segments}, $thld;
  24         64  
116 24         53 my $zone_ace = join "." => $sld_zone_ace, $tld_zone_ace;
117 24         35 $zone = join "." => $sld, $tld;
118 24         46 push @zone_params, zone_ace => $zone_ace;
119             }
120             elsif ( $tld_zone_ace =~ /\A$tld_regex\z/ ) {
121             ### tld_zone_ace: $tld_zone_ace
122 37 100       96 push @{$domain_segments}, $thld if $thld;
  12         38  
123 37         42 push @{$domain_segments}, $sld;
  37         92  
124 37         65 push @zone_params, zone_ace => $tld_zone_ace;
125 37         53 $zone = $tld;
126             }
127 72 100       664 croak "Could not find tld." unless $zone;
128 71         253 my $unicode_zone = domain_to_unicode($zone);
129             return {
130 71         4687 zone => $unicode_zone,
131             domain => $domain_segments,
132             @zone_params
133             };
134             }
135              
136             sub _punycode_segments {
137 73     73   88 my ( $domain_segments, $zone ) = @_;
138              
139 73         76 my @name_prefix;
140 73 100 33     334 if ( not $zone or $zone !~ /^(?:de|fr|pm|re|tf|wf|yt)$/ ) {
141 68         92 my $puny_encoded = [];
142 68         68 foreach my $segment ( @{$domain_segments} ) {
  68         152  
143 91 100 66     1084 croak "Error processing domain."
144             . " Please report to package maintainer."
145             if not defined $segment
146             or $segment eq '';
147 85         257 my $nameprepped = nameprep( lc $segment );
148 85         8425 my $ascii = domain_to_ascii($nameprepped);
149 85         1988 push @{$puny_encoded}, $ascii;
  85         229  
150             }
151 85         478 my $puny_decoded =
152 62         78 [ map { domain_to_unicode($_) } @{$puny_encoded} ];
  62         79  
153             croak "Undefined mapping!"
154 62 100   85   16479 if any { lc $_ ne nameprep( lc $_ ) } @{$puny_decoded};
  85         2497  
  62         222  
155              
156 61         5716 my $domain = $puny_decoded->join(".");
157 61         371 my $domain_ace = $puny_encoded->join(".");
158              
159 61         247 my $processed_name = _process_name_part($puny_decoded);
160 61         90 my $processed_name_ace = _process_name_part($puny_encoded);
161 61         140 @{$processed_name_ace}{qw/name_ace prefix_ace/} =
  61         123  
162 61         63 delete @{$processed_name_ace}{qw/name prefix/};
163              
164             return {
165 61         117 domain => $domain,
166             domain_ace => $domain_ace,
167 61         312 %{$processed_name},
168 61         78 %{$processed_name_ace}
169             };
170             }
171              
172             # Avoid nameprep step for certain tlds
173 5         13 my $puny_encoded =
174 5         5 [ map { _puny_encode( lc $_ ) } @{$domain_segments} ];
  5         8  
175 5         7 my $puny_decoded = [ map { _puny_decode($_) } @{$puny_encoded} ];
  5         10  
  5         8  
176 5         22 my $domain = $puny_decoded->join(".");
177 5         27 my $domain_ace = $puny_encoded->join(".");
178 5         19 my $processed_name = _process_name_part($puny_decoded);
179 5         8 my $processed_name_ace = _process_name_part($puny_encoded);
180 5         10 @{$processed_name_ace}{qw/name_ace prefix_ace/} =
  5         11  
181 5         6 delete @{$processed_name_ace}{qw/name prefix/};
182             return {
183 5         8 domain => $domain,
184             domain_ace => $domain_ace,
185 5         21 %{$processed_name},
186 5         7 %{$processed_name_ace}
187             };
188              
189             }
190              
191             sub _process_name_part {
192 132     132   113 my $processed = shift;
193 132         108 my @name_prefix;
194 132         305 my $name = $processed->pop;
195 132         508 my $prefix = $processed->join(".");
196 132 100       546 push @name_prefix, name => $name if $name;
197 132 100       204 push @name_prefix, prefix => $prefix if $prefix;
198 132         309 return {@name_prefix};
199             }
200              
201             sub _puny_encode {
202 8     8   9 my $unencoded = shift;
203              
204             ### encoding : $unencoded
205             # quick check to make sure that domain should be decoded
206 8         18 my $temp_unencoded = nameprep $unencoded;
207             ### namepreped : $temp_unencoded
208 8         806 my $test_encode = domain_to_ascii($temp_unencoded);
209 8 100       173 return $unencoded if $test_encode eq $unencoded;
210 2         10 return "xn--" . encode_punycode($unencoded);
211             }
212              
213             sub _puny_decode {
214 5     5   6 my $encoded = shift;
215 5 50       15 return $encoded
216             unless $encoded =~ /xn--/;
217 5         16 $encoded =~ s/^xn--//;
218             ### decoding : $encoded
219 5         16 my $test_decode = decode_punycode($encoded);
220             ### test decode : $test_decode
221 5 50       13 return $encoded if $encoded eq $test_decode;
222 5         19 return decode_punycode($encoded);
223              
224             }
225              
226             __END__
227              
228             =encoding utf8
229              
230             =head1 NAME
231              
232             ParseUtil::Domain - Domain parser and puny encoder/decoder.
233              
234              
235             =for HTML <a href="https://travis-ci.org/heytrav/ParseUtil-Domain"><img src="https://travis-ci.org/heytrav/ParseUtil-Domain.svg?branch=master"></a>
236              
237              
238             =head1 SYNOPSIS
239              
240             use ParseUtil::Domain ':parse';
241              
242             my $processed = parse_domain("somedomain.com");
243             #$processed:
244             #{
245             #domain => 'somedomain',
246             #domain_ace => 'somedomain',
247             #zone => 'com',
248             #zone_ace => 'com'
249             #}
250              
251              
252             =head1 DESCRIPTION
253              
254              
255             This purpose of this module is to parse a domain name into its respective name and tld. Note that
256             the I<tld> may actually refer to a second- or third-level domain, e.g. co.uk or
257             plc.co.im. It also provides respective puny encoded and decoded versions of
258             the parsed domain.
259              
260             This module uses TLD data from the L<Public Suffix List|http://publicsuffix.org/list/> which is included with this
261             distribution.
262              
263              
264             =head1 INTERFACE
265              
266              
267             =head2 parse_domain
268              
269              
270             =over 2
271              
272             =item
273             parse_domain(string)
274              
275              
276             =over 3
277              
278             =item
279             Examples:
280              
281              
282             1. parse_domain('somedomain.com');
283              
284             Result:
285             {
286             domain => 'somedomain',
287             zone => 'com',
288             domain_ace => 'somedomain',
289             zone_ace => 'com'
290             }
291              
292             2. parse_domain('test.xn--o3cw4h');
293              
294             Result:
295             {
296             domain => 'test',
297             zone => 'ไทย',
298             domain_ace => 'test',
299             zone_ace => 'xn--o3cw4h'
300             }
301              
302             3. parse_domain('bloß.co.at');
303              
304             Result:
305             {
306             domain => 'bloss',
307             zone => 'co.at',
308             domain_ace => 'bloss',
309             zone_ace => 'co.at'
310             }
311              
312             4. parse_domain('bloß.de');
313              
314             Result:
315             {
316             domain => 'bloß',
317             zone => 'de',
318             domain_ace => 'xn--blo-7ka',
319             zone_ace => 'de'
320             }
321              
322             5. parse_domain('www.whatever.com');
323              
324             Result:
325             {
326             domain => 'www.whatever',
327             zone => 'com',
328             domain_ace => 'www.whatever',
329             zone_ace => 'com',
330             name => 'whatever',
331             name_ace => 'whatever',
332             prefix => 'www',
333             prefix_ace => 'www'
334             }
335              
336             =back
337              
338              
339              
340             =back
341              
342             =head2 puny_convert
343              
344             Toggles a domain between puny encoded and decoded versions.
345              
346              
347             use ParseUtil::Domain ':simple';
348              
349             my $result = puny_convert('bloß.de');
350             # $result: xn--blo-7ka.de
351              
352             my $reverse = puny_convert('xn--blo-7ka.de');
353             # $reverse: bloß.de
354              
355              
356              
357              
358              
359              
360             =head1 DEPENDENCIES
361              
362             =over 3
363              
364              
365             =item
366             L<Net::IDN::Encode>
367              
368              
369             =item
370             L<Net::IDN::Punycode>
371              
372              
373             =item
374             L<Regexp::Assemble::Compressed>
375              
376              
377             =item
378             The L<Public Suffix List|http://publicsuffix.org/list/>.
379              
380              
381             =back
382              
383              
384             =head1 CHANGES
385              
386              
387             =over 3
388              
389              
390             =item *
391             Added extra I<prefix> and I<name> fields to output to separate the actual registered part of the domain from subdomains (or things like I<www>).
392              
393             =item *
394             Updated with latest version of the public suffix list.
395              
396             =item *
397             Added a bunch of new TLDs (nTLDs).
398              
399              
400              
401             =back
402              
403             =head1 LICENSE
404              
405             This software is copyright (c) 2014 by Trav Holton <heytrav@cpan.org>.
406              
407             This is free software; you can redistribute it and/or modify it under
408             the same terms as the Perl 5 programming language system itself.
409              
410             Terms of the Perl programming language system itself
411              
412             a) the GNU General Public License as published by the Free
413             Software Foundation; either version 1, or (at your option) any
414             later version, or
415             b) the "Artistic License"
416              
417             --- The GNU General Public License, Version 1, February 1989 ---
418              
419             This software is Copyright (c) 2014 by Trav Holton <heytrav@cpan.org>.
420              
421             This is free software, licensed under:
422              
423             The GNU General Public License, Version 1, February 1989
424              
425             GNU GENERAL PUBLIC LICENSE
426             Version 1, February 1989
427              
428             Copyright (C) 1989 Free Software Foundation, Inc.
429             51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
430              
431             Everyone is permitted to copy and distribute verbatim copies
432             of this license document, but changing it is not allowed.
433              
434             Preamble
435              
436             The license agreements of most software companies try to keep users
437             at the mercy of those companies. By contrast, our General Public
438             License is intended to guarantee your freedom to share and change free
439             software--to make sure the software is free for all its users. The
440             General Public License applies to the Free Software Foundation's
441             software and to any other program whose authors commit to using it.
442             You can use it for your programs, too.
443              
444             When we speak of free software, we are referring to freedom, not
445             price. Specifically, the General Public License is designed to make
446             sure that you have the freedom to give away or sell copies of free
447             software, that you receive source code or can get it if you want it,
448             that you can change the software or use pieces of it in new free
449             programs; and that you know you can do these things.
450              
451             To protect your rights, we need to make restrictions that forbid
452             anyone to deny you these rights or to ask you to surrender the rights.
453             These restrictions translate to certain responsibilities for you if you
454             distribute copies of the software, or if you modify it.
455              
456             For example, if you distribute copies of a such a program, whether
457             gratis or for a fee, you must give the recipients all the rights that
458             you have. You must make sure that they, too, receive or can get the
459             source code. And you must tell them their rights.
460              
461             We protect your rights with two steps: (1) copyright the software, and
462             (2) offer you this license which gives you legal permission to copy,
463             distribute and/or modify the software.
464              
465             Also, for each author's protection and ours, we want to make certain
466             that everyone understands that there is no warranty for this free
467             software. If the software is modified by someone else and passed on, we
468             want its recipients to know that what they have is not the original, so
469             that any problems introduced by others will not reflect on the original
470             authors' reputations.
471              
472             The precise terms and conditions for copying, distribution and
473             modification follow.
474              
475             GNU GENERAL PUBLIC LICENSE
476             TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
477              
478             0. This License Agreement applies to any program or other work which
479             contains a notice placed by the copyright holder saying it may be
480             distributed under the terms of this General Public License. The
481             "Program", below, refers to any such program or work, and a "work based
482             on the Program" means either the Program or any work containing the
483             Program or a portion of it, either verbatim or with modifications. Each
484             licensee is addressed as "you".
485              
486             1. You may copy and distribute verbatim copies of the Program's source
487             code as you receive it, in any medium, provided that you conspicuously and
488             appropriately publish on each copy an appropriate copyright notice and
489             disclaimer of warranty; keep intact all the notices that refer to this
490             General Public License and to the absence of any warranty; and give any
491             other recipients of the Program a copy of this General Public License
492             along with the Program. You may charge a fee for the physical act of
493             transferring a copy.
494              
495             2. You may modify your copy or copies of the Program or any portion of
496             it, and copy and distribute such modifications under the terms of Paragraph
497             1 above, provided that you also do the following:
498              
499             a) cause the modified files to carry prominent notices stating that
500             you changed the files and the date of any change; and
501              
502             b) cause the whole of any work that you distribute or publish, that
503             in whole or in part contains the Program or any part thereof, either
504             with or without modifications, to be licensed at no charge to all
505             third parties under the terms of this General Public License (except
506             that you may choose to grant warranty protection to some or all
507             third parties, at your option).
508              
509             c) If the modified program normally reads commands interactively when
510             run, you must cause it, when started running for such interactive use
511             in the simplest and most usual way, to print or display an
512             announcement including an appropriate copyright notice and a notice
513             that there is no warranty (or else, saying that you provide a
514             warranty) and that users may redistribute the program under these
515             conditions, and telling the user how to view a copy of this General
516             Public License.
517              
518             d) You may charge a fee for the physical act of transferring a
519             copy, and you may at your option offer warranty protection in
520             exchange for a fee.
521              
522             Mere aggregation of another independent work with the Program (or its
523             derivative) on a volume of a storage or distribution medium does not bring
524             the other work under the scope of these terms.
525              
526             3. You may copy and distribute the Program (or a portion or derivative of
527             it, under Paragraph 2) in object code or executable form under the terms of
528             Paragraphs 1 and 2 above provided that you also do one of the following:
529              
530             a) accompany it with the complete corresponding machine-readable
531             source code, which must be distributed under the terms of
532             Paragraphs 1 and 2 above; or,
533              
534             b) accompany it with a written offer, valid for at least three
535             years, to give any third party free (except for a nominal charge
536             for the cost of distribution) a complete machine-readable copy of the
537             corresponding source code, to be distributed under the terms of
538             Paragraphs 1 and 2 above; or,
539              
540             c) accompany it with the information you received as to where the
541             corresponding source code may be obtained. (This alternative is
542             allowed only for noncommercial distribution and only if you
543             received the program in object code or executable form alone.)
544              
545             Source code for a work means the preferred form of the work for making
546             modifications to it. For an executable file, complete source code means
547             all the source code for all modules it contains; but, as a special
548             exception, it need not include source code for modules which are standard
549             libraries that accompany the operating system on which the executable
550             file runs, or for standard header files or definitions files that
551             accompany that operating system.
552              
553             4. You may not copy, modify, sublicense, distribute or transfer the
554             Program except as expressly provided under this General Public License.
555             Any attempt otherwise to copy, modify, sublicense, distribute or transfer
556             the Program is void, and will automatically terminate your rights to use
557             the Program under this License. However, parties who have received
558             copies, or rights to use copies, from you under this General Public
559             License will not have their licenses terminated so long as such parties
560             remain in full compliance.
561              
562             5. By copying, distributing or modifying the Program (or any work based
563             on the Program) you indicate your acceptance of this license to do so,
564             and all its terms and conditions.
565              
566             6. Each time you redistribute the Program (or any work based on the
567             Program), the recipient automatically receives a license from the original
568             licensor to copy, distribute or modify the Program subject to these
569             terms and conditions. You may not impose any further restrictions on the
570             recipients' exercise of the rights granted herein.
571              
572             7. The Free Software Foundation may publish revised and/or new versions
573             of the General Public License from time to time. Such new versions will
574             be similar in spirit to the present version, but may differ in detail to
575             address new problems or concerns.
576              
577             Each version is given a distinguishing version number. If the Program
578             specifies a version number of the license which applies to it and "any
579             later version", you have the option of following the terms and conditions
580             either of that version or of any later version published by the Free
581             Software Foundation. If the Program does not specify a version number of
582             the license, you may choose any version ever published by the Free Software
583             Foundation.
584              
585             8. If you wish to incorporate parts of the Program into other free
586             programs whose distribution conditions are different, write to the author
587             to ask for permission. For software which is copyrighted by the Free
588             Software Foundation, write to the Free Software Foundation; we sometimes
589             make exceptions for this. Our decision will be guided by the two goals
590             of preserving the free status of all derivatives of our free software and
591             of promoting the sharing and reuse of software generally.
592              
593             NO WARRANTY
594              
595             9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
596             FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
597             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
598             PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
599             OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
600             MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
601             TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
602             PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
603             REPAIR OR CORRECTION.
604              
605             10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
606             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
607             REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
608             INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
609             OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
610             TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
611             YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
612             PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
613             POSSIBILITY OF SUCH DAMAGES.
614              
615             END OF TERMS AND CONDITIONS
616              
617             Appendix: How to Apply These Terms to Your New Programs
618              
619             If you develop a new program, and you want it to be of the greatest
620             possible use to humanity, the best way to achieve this is to make it
621             free software which everyone can redistribute and change under these
622             terms.
623              
624             To do so, attach the following notices to the program. It is safest to
625             attach them to the start of each source file to most effectively convey
626             the exclusion of warranty; and each file should have at least the
627             "copyright" line and a pointer to where the full notice is found.
628              
629             <one line to give the program's name and a brief idea of what it does.>
630             Copyright (C) 19yy <name of author>
631              
632             This program is free software; you can redistribute it and/or modify
633             it under the terms of the GNU General Public License as published by
634             the Free Software Foundation; either version 1, or (at your option)
635             any later version.
636              
637             This program is distributed in the hope that it will be useful,
638             but WITHOUT ANY WARRANTY; without even the implied warranty of
639             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
640             GNU General Public License for more details.
641              
642             You should have received a copy of the GNU General Public License
643             along with this program; if not, write to the Free Software
644             Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
645              
646              
647             Also add information on how to contact you by electronic and paper mail.
648              
649             If the program is interactive, make it output a short notice like this
650             when it starts in an interactive mode:
651              
652             Gnomovision version 69, Copyright (C) 19xx name of author
653             Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
654             This is free software, and you are welcome to redistribute it
655             under certain conditions; type `show c' for details.
656              
657             The hypothetical commands `show w' and `show c' should show the
658             appropriate parts of the General Public License. Of course, the
659             commands you use may be called something other than `show w' and `show
660             c'; they could even be mouse-clicks or menu items--whatever suits your
661             program.
662              
663             You should also get your employer (if you work as a programmer) or your
664             school, if any, to sign a "copyright disclaimer" for the program, if
665             necessary. Here a sample; alter the names:
666              
667             Yoyodyne, Inc., hereby disclaims all copyright interest in the
668             program `Gnomovision' (a program to direct compilers to make passes
669             at assemblers) written by James Hacker.
670              
671             <signature of Ty Coon>, 1 April 1989
672             Ty Coon, President of Vice
673              
674             That's all there is to it!
675              
676              
677             --- The Artistic License 1.0 ---
678              
679             This software is Copyright (c) 2014 by Trav Holton <heytrav@cpan.org>.
680              
681             This is free software, licensed under:
682              
683             The Artistic License 1.0
684              
685             The Artistic License
686              
687             Preamble
688              
689             The intent of this document is to state the conditions under which a Package
690             may be copied, such that the Copyright Holder maintains some semblance of
691             artistic control over the development of the package, while giving the users of
692             the package the right to use and distribute the Package in a more-or-less
693             customary fashion, plus the right to make reasonable modifications.
694              
695             Definitions:
696              
697             - "Package" refers to the collection of files distributed by the Copyright
698             Holder, and derivatives of that collection of files created through
699             textual modification.
700             - "Standard Version" refers to such a Package if it has not been modified,
701             or has been modified in accordance with the wishes of the Copyright
702             Holder.
703             - "Copyright Holder" is whoever is named in the copyright or copyrights for
704             the package.
705             - "You" is you, if you're thinking about copying or distributing this Package.
706             - "Reasonable copying fee" is whatever you can justify on the basis of media
707             cost, duplication charges, time of people involved, and so on. (You will
708             not be required to justify it to the Copyright Holder, but only to the
709             computing community at large as a market that must bear the fee.)
710             - "Freely Available" means that no fee is charged for the item itself, though
711             there may be fees involved in handling the item. It also means that
712             recipients of the item may redistribute it under the same conditions they
713             received it.
714              
715             1. You may make and give away verbatim copies of the source form of the
716             Standard Version of this Package without restriction, provided that you
717             duplicate all of the original copyright notices and associated disclaimers.
718              
719             2. You may apply bug fixes, portability fixes and other modifications derived
720             from the Public Domain or from the Copyright Holder. A Package modified in such
721             a way shall still be considered the Standard Version.
722              
723             3. You may otherwise modify your copy of this Package in any way, provided that
724             you insert a prominent notice in each changed file stating how and when you
725             changed that file, and provided that you do at least ONE of the following:
726              
727             a) place your modifications in the Public Domain or otherwise make them
728             Freely Available, such as by posting said modifications to Usenet or an
729             equivalent medium, or placing the modifications on a major archive site
730             such as ftp.uu.net, or by allowing the Copyright Holder to include your
731             modifications in the Standard Version of the Package.
732              
733             b) use the modified Package only within your corporation or organization.
734              
735             c) rename any non-standard executables so the names do not conflict with
736             standard executables, which must also be provided, and provide a separate
737             manual page for each non-standard executable that clearly documents how it
738             differs from the Standard Version.
739              
740             d) make other distribution arrangements with the Copyright Holder.
741              
742             4. You may distribute the programs of this Package in object code or executable
743             form, provided that you do at least ONE of the following:
744              
745             a) distribute a Standard Version of the executables and library files,
746             together with instructions (in the manual page or equivalent) on where to
747             get the Standard Version.
748              
749             b) accompany the distribution with the machine-readable source of the Package
750             with your modifications.
751              
752             c) accompany any non-standard executables with their corresponding Standard
753             Version executables, giving the non-standard executables non-standard
754             names, and clearly documenting the differences in manual pages (or
755             equivalent), together with instructions on where to get the Standard
756             Version.
757              
758             d) make other distribution arrangements with the Copyright Holder.
759              
760             5. You may charge a reasonable copying fee for any distribution of this
761             Package. You may charge any fee you choose for support of this Package. You
762             may not charge a fee for this Package itself. However, you may distribute this
763             Package in aggregate with other (possibly commercial) programs as part of a
764             larger (possibly commercial) software distribution provided that you do not
765             advertise this Package as a product of your own.
766              
767             6. The scripts and library files supplied as input to or produced as output
768             from the programs of this Package do not automatically fall under the copyright
769             of this Package, but belong to whomever generated them, and may be sold
770             commercially, and may be aggregated with this Package.
771              
772             7. C or perl subroutines supplied by you and linked into this Package shall not
773             be considered part of this Package.
774              
775             8. The name of the Copyright Holder may not be used to endorse or promote
776             products derived from this software without specific prior written permission.
777              
778             9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
779             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
780             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
781              
782             The End
783