Appendix D. The Slash API

To add features to Slash in a plugin or a theme, it’s helpful to know which functions exist. Most of the hard work of getting and setting information in the database and passing information to templates is already done. While some of the internals are still being rearranged, the core functions are very stable. Most plugins use only a handful of functions.

Browsing the Slash Documentation

Most of the Slash modules have inline documentation in POD format. Most of the documentation in docs/ beneath the Slash source directory is also in this format. As discussed in Section 2.1.1.2 in Chapter 2, this is the standard means of documenting Perl code. The perldoc utility can be used to find and display documentation for any installed Slash module. For example, to see which functions are available from the Slash module, use the command perldoc Slash. This will produce something like:

Slash(3)       User Contributed Perl Documentation       Slash(3)
NAME
	Slash - the BEAST

SYNOPSIS
		use Slash;  # figure the rest out ;-)

DESCRIPTION
	Slash is the code that runs Slashdot.

FUNCTIONS

	printComments(SID [, PID, CID])

	Prints all that comment stuff.

	...

All modules follow the same format. The tricky part is knowing which module contains the appropriate function. Only experience and knowledge of the Slash architecture will help (see Appendix A). Another good tool to use is grep, as described in Section 10.4.1.1 in Chapter 10. It’s worth keeping the unpacked Slash sources around for ...

Get Running Weblogs with Slash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.