Chapter 2. Basic Usage

The rest of this book is divided into chapters organized primarily by depth of knowledge. This chapter covers basic usage of paperboy while later chapters cover intermediate usage like joining feeds and using paperboyd, advanced usage like proxies and authentication, and developers' usage as a component in other applications. There is also a chapter on XSLT just following this one. This chapter is necessary to be able to use paperboy. Subsequent chapters build on the knowledge of previous ones and teach you how to unlock the more powerful features Paperboy has to offer. Don't worry, it's not as hard as all that, so let's dive in.

2.1. Command line options

This is a table of the command line options for paperboy. They may not make sense right now, or even by the end of the chapter, but they will by the end of the guide.

-c

This flag enables clean mode, removing old files rather than using them for calls to paperboy:is_new(). This is helpful to pass if paperboy was interrrupted or otherwise ended up with mangled files on a previous run.

-f

This flag specifies the raw XML file that should be parsed. If a URL is specified, this is where paperboy will write the file. Otherwise, it just reads the file from the disk. This flag can be passed more than once (see "-j").

-G

("Don't Get") If specified, no files will be downloaded, thus ignoring any -u flags. Other than that, behavior is normal so all the files specified with -f will be parsed, as read from disk. This is mostly useful for paperboyd.

-g

("Get Only") If specified, files will only be downloaded as normal. But they will not be parsed nor transformed, thus ignoring most flags other than -u and -f. This is mostly useful for paperboyd.

-h

Print help information and exit.

-j

Enable join mode. This joins multiple -f files together before processing.

-o

This flag specifies the file where the transformed XML is saved. If the -o option is not passed, the program will dump the parsed XML to the screen letting you pipe it to another program or print a webpage directly with CGIs.

-t

The path to an XSLT template to be used for transforming the XML.

-u

The URL of a file you want to download into the file specified by -f. This flag can be passed more than once. In this case the files and URLs are paired in a first-in/first-out manner regardless of intervening flags. So the first -u matches the first -f, the second -u the second -f, and so on. There can be more -f files than URLs, in which case they are read from the disk; there cannot, however, be more URLs than files to save them in. If join mode is turned on, the files are joined into a single file before applying the XSLT. If it is not then only the first pairing is "seen"; paperboy does not iterate across the entire list.

-V

Print version information and exit.

-v

Print verbose informational messages.

-x

Run with the specified XSLT module loaded. The file will either define the XPath functions itself, or be a bridgework that can process another language that does so. For more information see the paperboy-modules manpage. This flag can be passed more than once.

-y

If the XSLT module passed with -x is a bridgework, then this file defines the XPath functions and is written in the language -x bridges to. If more than one bridgework is available, it's up to the bridgework to discern if this file is relevant. For more information see the paperboy-modules manpage. This flag can be passed more than once.