Hello Monks,
I made this version of a daily list for my lazy hippie roommate who complains that he can't find a list. I'm sure he wouldn't miss it if his smokes or his glasses were on it: Initial Output Q1) This validates as html5, but when I view it on windows with chrome, it looks like it's always loading. Is that because of the generated html or is that a browser/OS issue?
Outline for morning preparation indicates where I want go with this. I want to be specific in what I'm going to do to achieve these things before I head out the door. I tried the whole racket today, and it worked as far as me doing all the goodie-two-shoes stuff *and* getting out the door with everything I needed, even though that's always a bit of a guess.
The script I have is bulky. It's set up to do a lot of other things, like having russian captions, so a lot of this won't survive the first edit. Q2) One specific reason I'm making an html page of this is that I want to be able to find it on windows and print it, so as to have a physical copy of it in the morning. What would be a way of using this same data to create a file that could be printed without having to travel to the internet?
#!/usr/bin/perl -w use strict; use 5.010; use lib "template_stuff"; use html2; use nibley1; use utils1; use Cwd; use File::Basename; use Net::FTP; use Path::Class; use File::Slurp; use File::Spec; # initializations that must precede main data structure my $fspecfile = File::Spec->rel2abs(__FILE__); my $ts = "template_stuff"; my $images = "aimages"; my $captions = "captions"; my $ruscaptions = "ruscaptions"; my $bom = "bom"; my $current = cwd; my $rd1 = dir($current); my @a = $rd1->dir_list(); my $srd1 = $rd1->stringify; my $title = $rd1->basename; say "title is $title"; my $rd2 = dir(@a,$ts,$images); my $to_images = $rd2->stringify; my $rd3 = dir(@a,$ts,$captions); my $to_captions = $rd3->stringify; my $rd4 = dir(@a,$ts,$ruscaptions); my $rus_captions = $rd4->stringify; my $rd5 = dir(@a,$ts,$bom); my $bom_dir = $rd5->stringify; # page params my %vars = ( title => $title, headline => undef, place => 'Oakland', css_file => "${title}1.css", header => file($ts,"hc_input2.txt"), footer => file($ts,"footer_center3.txt"), css_local => file($ts,"${title}1.css"), body => file($ts,"rebus4.tmpl"), print_script => "0", code_tmpl=> file(@a,$ts,"code2.tmpl"), oitop=> file($ts,"oitop.txt"), oibottom=> file($ts,"oibottom.txt"), to_images => $to_images, eng_captions => $to_captions, rus_captions => $rus_captions, bottom => file($ts,"bottom2.txt"), words => file($bom_dir, "words1.txt"), subs => file($bom_dir, "substitutions1.txt"), source => file($bom_dir, "jacob1.txt"), book => 'List for Today', chapter => '', path => $to_captions, print_module => 0, script_file => $fspecfile, module_tmpl=> file(@a,$ts,"code3.tmpl"), ); #create html page my $rvars = \%vars; my $rftp = get_ftp_object(); my $html_file = get_html_filename($rftp); my $fh = create_html_file ($html_file); my $remote_dir = $html_file; $remote_dir =~ s/\.html$//; say "remote_dir is $remote_dir"; $vars{remote_dir}= $remote_dir; # create header my $rhdr = write_header($rvars); print $fh $$rhdr; # text_to_captions($rvars); my $refc = get_content($rvars); my @AoA = @$refc; print_aoa($refc); my $body = write_body($rvars, $refc); print $fh $$body; #my $rftr = write_footer($rvars); #print $fh $$rftr; if ($vars{"print_script"}) { my $script = write_script($rvars); print $fh $$script; } if ($vars{"print_module"}) { my $module = write_module($rvars); print $fh $$module; } my $rhbt = write_bottom($rvars); print $fh $$rhbt; close $fh; #load html file to server $rftp->cwd("/pages") or warn "cwd failed $!\n"; $rftp->put($html_file) or die "put failed $!\n"; #load css file to server $rftp->cwd("/css") or warn "cwd failed $@\n"; my $path3 = file(@a, $vars{"css_local"}); my $remote_css = $vars{"css_file"}; $rftp->put("$path3", $remote_css) or warn "put failed $@\n"; # load images $rftp->binary or warn "binary failed$!\n"; $rftp->cwd("/images") or warn "cwd failed $!\n"; $rftp->mkdir($remote_dir) or warn "mkdir failed $!\n"; $rftp->cwd($remote_dir) or warn "Cannot change working directory ", $rftp->message; for my $i ( 0 .. $#AoA ) { my $a = file(@a,$ts,$images,$AoA[$i][0]); my $sa = $a->stringify; my $b = file($AoA[$i][0]); my $sb = $b->stringify; $rftp->put($sa, $sb) or warn "put failed $@\n"; } $rftp->quit(); say "new file is $html_file"; __END__
Q3) What calender tools exist in perl for such a thing? Thanks for your comment.
In reply to using perl to print out tomorrow's list by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |