EPIPE Communications > CMS-Joomla-0.04 > CMS::Joomla

Download:
CMS-Joomla-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

CMS::Joomla - Joomla! CMS configuration and database access Perl module

SYNOPSIS ^

Read Joomla! configuration variables:

    use CMS::Joomla;

    my ($joomla) = CMS::Joomla->new("/path/to/joomla/configuration.php");

    print "Site name: " . $joomla->cfg->{'sitename'} . "\n";

Access Joomla! database:

    my ($jdb) = $joomla->dbhandle( { AutoCommit => 1 } );
    my ($sth) = $jdb->prepare("SELECT introtext "
        . "FROM " . $joomla->dbprefix . "content "
        . "WHERE title=?");

    $sth->execute("about");

    while (my ($introtext) = $sth->fetchrow_array) {
      print "$introtext\n";
    }

    ...

DESCRIPTION ^

This module provides an interface for reading Joomla! CMS configuration variables and connecting to the Joomla! database from Perl script.

CONSTRUCTOR ^

new(CFGFILE)

Creates CMS::Joomla object. The CFGFILE parameter should be a file name of a valid readable Joomla! configuration.php file. Returns undef in case of error.

METHODS ^

cfg()

Return a reference to a hash containing all Joomla! configuration variables in this CMS::Joomla object.

dbhandle(ARGS)

Returns a DBI database handle object which is connected to the corresponding Joomla! database. See DBI for more information on how to use the returned database handle. Consecutive calls to this function will return the same DBI handle instead of opening a new connection each time.

ARGS is passed directly to the DBI handle constructor.

Returns undef in case of error.

dbprefix()

Return a reference to the Joomla! database prefix. This is effectively a shortcut for $joomla->cfg->{'dbprefix'}.

EXAMPLES ^

Some functional example scripts are available at:

http://dist.epipe.com/joomla/perl/

SEE ALSO ^

DBI, DBD::mysql, http://www.joomla.org/

COPYRIGHT & LICENSE ^

Copyright (c) 2008, 2011 EPIPE Communications <epipe at cpan.org> http://epipe.com/

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: