Weblog 2.0 - Mother of Perl | 3 | WebReference

Weblog 2.0 - Mother of Perl | 3

To page 1To page 2current page

Weblog 2.0

New Modules (Cont.)

Xhoo Module

In addition to the Weblog module, I was able to modularize Xhoo itself to make it easier to read and write to Xhoo from an external program, like Weblog. Below is a sample script that demonstrates how it works:

use strict;
use Xhoo;
# initialize local variables
my $dir = '/home/eisen/work/weblog/weblog-1.8/directory';
my $datafile = 'xhoo.xml';
my $identifier = '986086673:382596210649';
my $category = 'Computers/Perl';
my $url = 'http://www.webdeveloper.com/directory';       
my $xhoo = new Xhoo (rootdir => $dir,
		     baseurl => $url);
my %link = (
	    name        => 'Jonathan Eisenzopf',
	    email       => 'eisen@xif.com',
	    description => 'asdasdas',
	    url         => 'http://www.news.com',
	    title       => 'CNet News'
foreach my $category (@{$xhoo->categories}) {
    print "$category\n";
$xhoo->add_link($category, $datafile, $identifier,%link);

The code

The source code is still licensed under the GNU license and is available as part of the tutorial download, which is linked to on the first page of the article. Enjoy.

To page 1To page 2current page


Produced by Jonathan Eisenzopf
All Rights Reserved. Legal Notices.
Created: April 30, 2001

URL: http://www.webreference.com/perl/tutorial/22/3.html