X-Git-Url: http://git.tpope.net/?p=tpope-extra.git;a=blobdiff_plain;f=perl%2Fsctweb;h=5d82c6c786de6e11a746ae3bd9292137e049a287;hp=018077c0793336d20a7304fce624c2927df8da1d;hb=HEAD;hpb=74b4e7b3ee855c17c8bff7ef19578d665c4bde54 diff --git a/perl/sctweb b/perl/sctweb index 018077c..5d82c6c 100755 --- a/perl/sctweb +++ b/perl/sctweb @@ -6,13 +6,17 @@ # Create a ~/.sctwebrc that has SID=yourssn and PIN=yourpin # You'll need to change the url below if you go anywhere but Northwest Vista. +# Update: This tool now only outputs in XML. For other formats, convert +# with schedproc + use strict; -use LWP::UserAgent; -use HTML::TableExtract; #use Time::Local; use Date::Calc::Object qw(Day_of_Week Decode_Day_of_Week Week_of_Year Monday_of_Week Day_of_Week_Abbreviation Delta_Days Add_Delta_Days Nth_Weekday_of_Month_Year Gmtime Mktime); use Date::Calendar::Profiles qw($Profiles); use Date::Calendar::Year; +use HTML::TableExtract; +use LWP::UserAgent; +use XML::Simple; use vars qw($ua %opts %faculty); my ($response); @@ -60,8 +64,17 @@ sub US_Labor # First Monday after the first Sunday in September Nth_Weekday_of_Month_Year($year,9,7,1), +1) ); } -if (-r $ENV{HOME} . "/.sctwebrc") { - open CONFIG, $ENV{HOME} . "/.sctwebrc"; +my $config = $ENV{HOME} . "/.sctwebrc"; +if ($ARGV[0] eq '-F') { + shift; + $config = shift; +} + +my $arg = ""; +$arg = shift if (defined($ARGV[0]) && $ARGV[0] =~ /^-\w$/); + +if (-r $config) { + open CONFIG, $config; while() { s/\#.*//; next unless m/^([^=]*)=(.*)/; @@ -82,42 +95,16 @@ $response = $ua->post("$url&tserve_trans_config=astulog.cfg", { tserve_tip_write $response = $ua->get("$url&tserve_tip_write=||WID|SID|PIN|Term&tserve_trans_config=" . ("regterm.cfg"||"rgrdterm.cfg")); # Valid terms die $response->status_line unless $response->is_success; -my @terms = grep {s/^