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, orshtmlβ 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:
- 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 theCONTENTattribute get returned as the description. slay. - Otherwise, it strips everything:
- all HTML comments
- text between
<SCRIPT>,<STYLE>, and<TITLE>tags - all other HTML tags
- If
<AREA ... ALT="...">or<IMG ... ALT="...">elements are found, then the words specified as the value of theALTattributes 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 π
π hyperlink( LIST )
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:
ftpgopherhttphttpsmailtonewstelnetwais
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
- debian bookworm: swish++ 6.1.5-6
- debian trixie: swish++ 6.1.5-6
- ubuntu jammy: swish++ 6.1.5-6
- ubuntu noble: swish++ 6.1.5-6build1
- ubuntu questing: swish++ 6.1.5-6build1
- ubuntu resolute: swish++ 6.1.5-6build2
- ubuntu stonking: swish++ 6.1.5-6build2
- Copyright (C) 1998 Paul J. Lucas
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms