in reply to using perl to print out tomorrow's list
It's great that you are using Perl to improve the everyday experience of others. Still, it's hard to provide some specific suggestions for your script - as you stated, it contains a lot. A concise example is usually much better. I'll try to provide as much help as I can.
The easiest question to answer would be Q3 - try looking at Calendar::Simple. The documentation contains a great complete example here.
When it comes to Q2 - HTML is not great when you want to produce documents suitable for printing. If your goal is to create a nice looking document that you can print and carry around with you - try creating a PDF file. It's a bit more complicated, but the documentation for the PDF::API2::Simple provides all you need for a simple list with a header and an image. Russian captions should not pose a problem.
As to Q1 - it might be a problem on your side - the page does not appear to be loading in my browsers.
I wish you good luck with your Perl project, and I'll try to update my response with an example using both modules I have suggested.
UPDATE:
So, here's the promised update. There is no calendar, and no image, but this should already be enough for you to start. As you will notice, I've changed my initial recommendation - although I have used PDF::API2::Simple for simple tasks before, there were problems with printing utf8 characters, and I had to use the underlying PDF::API2 object. So I switched to PDF::API2 entirely. There is a tutorial in Russian, too, but my limited knowledge of this language does not allow me to check if it's up to date. Seems good.
Again, best luck with your efforts.
#!/usr/bin/perl use v5.14; use utf8; use PDF::API2; my $header = 'placeholder header'; 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->ttfont('DejaVuSans.ttf'); $txt->font($font, 32); $txt->translate(100, 650); $txt->text($header, -encoding => 'utf8'); my @task = ( 'wash the dishes', 'buy some meat', 'run a mile', 'buy more meat', 'plan a barbecue', ); 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); } $pdf->saveas("output.pdf");
You can replace the placeholder header with the string I used to test the script: my $header = 'мой маленький список';. I could not figure out a way to include unicode in the code example.
- Luke
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using perl to print out tomorrow's list
by Aldebaran (Curate) on Nov 08, 2014 at 23:54 UTC | |
by blindluke (Hermit) on Nov 09, 2014 at 09:45 UTC | |
by soonix (Chancellor) on Nov 09, 2014 at 08:10 UTC |