Thanks all for replies,

I combined the examples Luke gave to get a pretty decent list that prints out with a big top banner for the next day. Knowing what day it is right when you wake up is not something I'm equipped for, as I just make too many mistakes. It's a good thing that nothing I take in the morning keeps me alive, because I might forget once a week. I'm convinced that a checklist is the ticket. There are certain things I'm gonna want to have on this list every day. Maybe I should give them their own space.

#!/usr/bin/perl -w use strict; use v5.14; use lib "template_stuff"; use utils1; use Path::Class; use PDF::API2; my $ts = "template_stuff"; my $images = "aimages"; my $captions = "captions"; my $to_windows = '/media/fred/Windows8_OS/Documents and Settings/Fred/ +Documents'; my @months = qw(January February March April May June July August September October November December); my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime() +; print "$mday $months[$mon] $days[$wday]\n"; my $day = $mday + 1; my $yr = $year +1900; my $header = "List for $days[$wday+1], $months[$mon -1] $day, $yr"; my $pdf = PDF::API2->new( width => 595, # A4 dimensions in point height => 842, # 1 point = 1/72 inch ); sub drawline { my ($line, $y) = @_; my $x1 = 50; my $x2 = 550; $line->linewidth(3); $line->move( $x1, $y ); $line->line( $x2, $y ); $line->stroke; } my $page = $pdf->page; my $txt = $page->text; my $font = $pdf->corefont('Times-Roman'); #my $font = $pdf->ttfont('DejaVuSans.ttf'); $txt->font($font, 32); $txt->translate(100, 650); $txt->text($header, -encoding => 'utf8'); my @task = ( 'set alarm for 8:30 --one snooze max', 'take meds', 'stretch', 'get on elliptical/shoot baskets/throw the disc/do yoga', 'eat toast/oatmeal', 'practice Buked', 'choir 10 a.m. --bring music', 'Skype 2:55 p.m.', ); my $line = $page->gfx; $txt->font($font, 20); my $vspace = 70; for my $i (0..$#task) { my $linepos = 500-($i*$vspace); my $msg = '[ ] '.$task[$i]; drawline ($line, $linepos); $txt->translate(70, $linepos+10); $txt->text($msg); } my $new_name = join ('_', $months[$mon -1], $day, $yr); say "new_name is $new_name"; my $save_file = file($to_windows, $new_name); #$pdf->saveas("$save_file.pdf"); $pdf->saveas("$new_name.pdf"); __END__

Q1) How does one load up on the fonts that are out there like the DejaVu one that I had to comment out and use a corefont instead?

If I delete the hash-commenter on the first save to my windows partition, I get this error:

Unable to open /media/fred/Windows8_OS/Documents and Settings/Fred/Doc +uments/October_9_2014.pdf for writing at /usr/local/share/perl/5.18.2 +/PDF/API2/Basic/PDF/File.pm line 393. $

I suspect that "I" as the perl executable don't have the proper permissions to do what I can do by copying and pasting with nautilus after the script is run. I can hardly express in words how fatigued I am in getting documents to windows so that I can print it, and I don't believe there's linux drivers for my hp 4620 printer (I looked today again). Q2) How do I convince my OS that I'm allowed to write in the directory? Or am I cobbling it together wrong with Path::Class?

Finally, can someone talk me through what the map is doing in this script:

$ perl cal1.pl months are January February March April May June July August September + October November December mon is 11 yr is 2014 month are ARRAY(0x1064440) ARRAY(0xff0ee0) ARRAY(0xff1a38) ARRAY(0xff1 +d08) ARRAY(0xf7f2d8) ARRAY(0xf7f380) November 2014 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $ cat cal1.pl #!/usr/bin/perl -w use strict; use Calendar::Simple; use 5.01; my @months = qw(January February March April May June July August September October November December); say "months are @months"; my $mon = shift || (localtime)[4] + 1; my $yr = shift || (localtime)[5] + 1900; say "mon is $mon"; say "yr is $yr"; my @month = calendar($mon, $yr); say "month are @month"; print "\n$months[$mon -1] $yr\n\n"; print "Su Mo Tu We Th Fr Sa\n"; foreach (@month) { print map { $_ ? sprintf "%2d ", $_ : ' ' } @$_; print "\n"; } $

One of the items that happy people do every day is read. A person could read perl and check it off....


In reply to Re^2: using perl to print out tomorrow's list by Aldebaran
in thread using perl to print out tomorrow's list by Aldebaran

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.