demo.pl untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 use lib "./lib";
6 use Color::Fade qw(color_fade format_color);
7
8 print "Choose output HTML file to write to [./demo.html] ";
9 chomp (my $page = <STDIN>);
10 $page = "./demo.html" unless length $page;
11
12 open (OUT, ">$page");
13 print OUT "<body bgcolor=\"#000000\">\n";
14
15 # Demo 1: Using format_html to generate <font>...</font> output.
16 # String: The quick brown fox jumps over the lazy dog.
17 # Colors: Red, Green, Blue
18 print OUT "<font color=\"#FFFFFF\"><u>Demo 1: Using <b>format_html()</b> to generate &lt;font&gt; tags.</u></font><p>\n";
19 print OUT format_color ('html',
20 color_fade (
21 "The quick brown fox jumps over the lazy dog.",
22 '#FF0000',
23 '#00FF00',
24 '#0000FF',
25 )
26 );
27 print OUT "<p>\n";
28
29 # Demo 2: Using format_css to generate HTML 4 compliant <span>...</span> output.
30 # String: Jackdaws love my big sphynx of quartz.
31 # Colors: Cyan, Yellow, Magenta
32 print OUT "<span style=\"color: #FFFFFF\"><u>Demo 2: Using <b>format_css()</b> to generate HTML 4 compliant &lt;span&gt; tags.</u></span><p>\n";
33 print OUT format_color ('css',
34 color_fade (
35 'Jackdaws love my big sphynx of quartz.',
36 '#00FFFF',
37 '#FFFF00',
38 '#FF00FF',
39 )
40 );
41
42 print OUT "<p>\n\n<span style=\"color: #FFFFFF\"><u>More Demonstrations</u></span><p>\n\n";
43
44 # Demo 3: Just another example.
45 # String: Just another Perl hacker.
46 # Colors: pink, light blue
47 print OUT format_color ('html',
48 color_fade (
49 'Just another Perl hacker.',
50 '#FF99FF',
51 '#0099FF',
52 )
53 );
54
55 print OUT "<p>";
56
57 # Demo 4: Yet another example.
58 # String: something very long
59 # Colors: rainbow
60 print OUT format_color ('html',
61 color_fade (
62 'And as this paragraph shows, the module can support strings of any length you want, and '
63 . 'can fade that string using as many different colors as you want. This one uses all the '
64 . 'colors of the rainbow, and tops it off with white edges. That\'s 9 colors!',
65 '#FFFFFF',
66 '#FF0000',
67 '#FF9900',
68 '#FFFF00',
69 '#00FF00',
70 '#0099FF',
71 '#0000FF',
72 '#FF99FF',
73 '#FFFFFF',
74 )
75 );