WWW(3)

πŸ’– NAME πŸ’–

okay so, bestie, this is WWW β€” the World Wide Web Package, which is a thing that lives in section 3 of the manual (that's Library Functions Manual, iykyk). ✨


🌸 SYNOPSIS 🌸

extract_description( FILE )
extract_meta( FILE, NAME )
hyperlink( LIST )

πŸ¦‹ DESCRIPTION πŸ¦‹

This package hands you a little bundle of utility functions for the World Wide Web. What do they do? Three iconic things, no cap:

  • pull descriptions out of files
  • pull meta information out of files
  • hyperlink text

that's the whole vibe πŸ’…


✨ SUBROUTINES ✨

These Perl subroutines are defined and available to you, bestie:

πŸŽ€ extract_description( FILE )

Extracts a description from an HTML or plain text file, given by the FILE name. Heads up: FILE should be an absolute path. Only the first $description::chars characters get read (and the default for that is 2048, in case you were wondering).

How does it know what kind of file it's dealing with? Extensions, babe:

  • ends in htm, html, or shtml β†’ presumed to be an HTML file
  • ends in txt β†’ presumed to be a plain text file
  • anything else β†’ not recognized, and no description is returned for it. tragic, but that's the rules πŸ™ˆ

For HTML files, the order of operations is:

  1. First, if a <META NAME="description" CONTENT="..."> or a <META NAME="DC.description" CONTENT="..."> (that's Dublin Core, fancy) element is found, then the words specified as the value of the CONTENT attribute get returned as the description. slay.
  2. Otherwise, it strips everything:
    • all HTML comments
    • text between <SCRIPT>, <STYLE>, and <TITLE> tags
    • all other HTML tags
  3. If <AREA ... ALT="..."> or <IMG ... ALT="..."> elements are found, then the words specified as the value of the ALT attributes are extracted.

And finally, for either HTML or plain text files, at most $description::words are returned β€” default 50. πŸ’–

πŸ’œ extract_meta( FILE, NAME )

Extracts the value of the CONTENT attribute from a META element that has the given NAME attribute, out of an HTML file given by the FILE name. And yes, FILE should be an absolute path again.

For it to even be considered an HTML file, the file must end in one of the extensions htm, html, or shtml. Only the first $description::chars characters are read (default: 2048).

oh and β€” cute detail β€” the characters are cached between consecutive calls using the same filename. efficiency queen πŸ‘‘

Adds hyperlinks to strings. So like, strings that contain substrings which are valid URLs (according to RFC 1630) get the appropriate HTML tags ``wrapped'' around them, so they'll be selectable when displayed in a browser. periodt.

The URL schemes it recognizes are:

  • ftp
  • gopher
  • http
  • https
  • mailto
  • news
  • telnet
  • wais

Example time, bestie ✨ β€” this:

Read all about it at
http://www.usatoday.com/

becomes this:

Read all about it at
<A HREF="http://www.usatoday.com/">http://www.usatoday.com/</A>

literally iconic.


πŸ‘€ SEE ALSO πŸ‘€

  • perl(1)
  • Tim Berners-Lee. ``Universal Resource Identifiers in WWW,'' Request for Comments 1630, Network Working Group of the Internet Engineering Task Force, June 1994.
  • Tim Berners-Lee, Larry Masinter, and Mark McCahill. ``Uniform Resource Locators (URL),'' Request for Comments 1738, Network Working Group, 1994.
  • Dave Raggett, Arnaud Le Hors, and Ian Jacobs. ``Notes on helping search engines index your Web site,'' HTML 4.0 Specification, Appendix B: Performance, Implementation, and Design Notes, World Wide Web Consortium, April 1998.
  • --. ``Objects, Images, and Applets: How to specify alternate text,'' HTML 4.0 Specification, Β§13.8, World Wide Web Consortium, April 1998.
  • Dublin Core Directorate. ``The Dublin Core: A Simple Content Description Model for Electronic Resources.''
  • Larry Wall, et al. Programming Perl, 3rd ed., O'Reilly & Associates, Inc., Sebastopol, CA, 2000.

🫢 AUTHOR 🫢

Paul J. Lucas <pauljlucas@mac.com> β€” ty for your service king πŸ‘‘


okay bestie that's the whole page, we ate and left no crumbs πŸ“

and for the cute sign-off: this whole thing is the WWW page from February 12, 2000, filed under WWW(3). yes she's vintage, yes she still serves πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from