| 1 | # /=====================================================================\ # | ||
| 2 | # | LaTeXML::Core::Mouth::http | # | ||
| 3 | # | Analog of TeX's Mouth: for reading from http | # | ||
| 4 | # |=====================================================================| # | ||
| 5 | # | Part of LaTeXML: | # | ||
| 6 | # | Public domain software, produced as part of work done by the | # | ||
| 7 | # | United States Government & not subject to copyright in the US. | # | ||
| 8 | # |---------------------------------------------------------------------| # | ||
| 9 | # | Bruce Miller <bruce.miller@nist.gov> #_# | # | ||
| 10 | # | http://dlmf.nist.gov/LaTeXML/ (o o) | # | ||
| 11 | # \=========================================================ooo==U==ooo=/ # | ||
| 12 | package LaTeXML::Core::Mouth::http; | ||
| 13 | use strict; | ||
| 14 | use warnings; | ||
| 15 | use base qw(LaTeXML::Core::Mouth); | ||
| 16 | use LaTeXML::Util::WWW; | ||
| 17 | use LaTeXML::Global; | ||
| 18 | |||
| 19 | sub new { | ||
| 20 | my ($class, $url, %options) = @_; | ||
| 21 | my ($urlbase, $name, $ext) = url_split($url); | ||
| 22 | $STATE->assignValue(URLBASE => $urlbase) if defined $urlbase; | ||
| 23 | my $self = bless { source => $url, shortsource => $name }, $class; | ||
| 24 | $$self{fordefinitions} = 1 if $options{fordefinitions}; | ||
| 25 | $$self{at_letter} = 1 if $options{at_letter}; | ||
| 26 | $$self{notes} = 1 if $options{notes}; | ||
| 27 | my $content = auth_get($url); | ||
| 28 | $self->openString($content); | ||
| 29 | $self->initialize; | ||
| 30 | return $self; } | ||
| 31 | |||
| 32 | #====================================================================== | ||
| 33 | 1; | ||
| 34 | |||
| 35 | __END__ |