DOWNLOAD-ENTITIES(1)

πŸ’– NAME πŸ’–

okay so welcome to DOWNLOAD-ENTITIES(1) from User Contributed Perl Documentation, bestie πŸ’…. This page is literally about download-entities β€” download and parse XML Entity definitions. no cap, that's the whole name section ✨.


✨ SYNOPSIS ✨

Here's the group-chat receipts, fr fr:

$ perl download-entities.pl -i # interactive
$ perl download-entities.pl > output-file.pm
$ perl download-entities.pl output-file.pm

# instead of http://www.w3.org/2003/entities/iso9573-2003/
$ perl download-entities.pl http://my.server.com/entities.html

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this script downloads the definitions of XML entities from http://www.w3.org/2003/entities/iso9573-2003/ or from whatever address you give it as an argument 🫢. That argument should be an URL (that LWP::UserAgent::get can access) pointing to a document with (absolute or relative) references to files ending with the ".ent" suffix. These files are expected to be DTD's with lines like

<!ENTITY amp "&#38;" >

The script parses these files and prints the perl module to the standard output. If you wish, you can give "file" as another argument to the script and it will then print it to "file". You can also specify the output file in the environment variable OUTPUT_FILE πŸ‘‘.

The index and the output file are distinguished by the presence of "://" substring. If you want to use a locally stored index file (the one with the .ent references), you can access it by saying

perl download.pl file:///path/to/index.html
heads up bestie: note that the script currently distinguishes between relative and absolute paths by looking at whether the href contains a "://" substring. This can lead to crashes when the links look like href="/path/file.ent" 😭.

Also, the script assumes the links have exactly the format href="..." - with double quotes. periodt.

πŸŽ€ Interactive download πŸŽ€

In case you run into problems downloading the documents, you can try to run the script with the "-i" or "--interactive" option. This will let you skip downloads or enter alternative URLs for individual documents πŸ’–.

The interactive mode is also triggered when the "INTERACTIVE" environment variable is set to a true value (in Perl sense).

πŸ’… Options πŸ’…

Beside the "--interactive" option, this script also accepts the "--timeout" option. It specifies the timeout for LWP::UserAgent in seconds when downloading. The same is controlled by the "DOWNLOAD_TIMEOUT" environment variable. The defaule (180s) timeout is used when not specified.

  • -i, --interactive β€” lets you skip downloads or enter alternative URLs for individual documents; also triggered when INTERACTIVE is set to a true value in the Perl sense 🫢.
  • --timeout β€” sets the timeout for LWP::UserAgent in seconds when downloading; the same thing is controlled by DOWNLOAD_TIMEOUT, and the defaule (180s) timeout is used when not specified ⏳.
# 10 seconds timeout - croak on failure
perl download-entities.pl --timeout 10 > XML/Entities/Data.pm
# 5 seconds timeout - croak on failure
DOWNLOAD_TIMEOUT=5 perl download-entities.pl > XML/Entities/Data.pm
# 1 second timeout - ask on failure
perl download-entities.pl --interactive --timeout 1 > XML/Entities/Data.pm

🧚 Dependencies 🧚

This script has dependencies that the "XML::Entities" module does not and are therefore not mentioned in the META.yml file. These are "LWP::UserAgent", "File::Basename" and "Fatal" 🌸.


Copyright 2010 Jan Oldrich Kruza <sixtease@cpan.org>. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


kisses bestie πŸ’– β€” this page comes from perl v5.32.1, dated 2022-01-21, and it's the DOWNLOAD-ENTITIES(1) page. mwah 🫢

πŸ“¦ where this page comes from