Slash Libraries

Slash 1.x consisted of one big library that had to be added to Perl’s include path manually. This was a suboptimal situation, with everything stuck in one huge file. Worse, there was no namespace protection. Slash 2.x split everything from Slash.pm into several separate libraries. (Slash still exists, but is reserved for legacy applications.) The Slash:: namespace is reserved for Slash modules on the CPAN. Note, however, that Slash does not follow a strict object-oriented design, as do many Perl modules. It uses OOP where the need is clear and other techniques where OOP is unnecessary.

Slash::Utility contains most of the common routines used to fetch data. It hosts getCurrentUser, getCurrentForm, and other functions commonly used when writing plugins. The library itself exports functions from several child modules. This is all hidden by Slash::Utility but should be kept in mind if you need to read the source code.

Slash::DB holds the Slash database logic. This governs everything that generates and works with SQL. This class has two important subclasses. Slash::DB::Utility holds all of the common, database-neutral methods. Database-specific functions live in modules named after the appropriate database, such as Slash::DB::MySQL for MySQL. (The PostgreSQL module actually inherits from the MySQL module, overriding a few functions as necessary. This makes it much easier to port Slash functions to a new database.)

The Slash::Install library ...

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.