spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / perl / tutorial 22 To page 1To page 2current page
[previous]

Weblog 2.0

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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);
$xhoo->edit_link($category,$datafile,$identifier,%link);
$xhoo->delete_link($category,$datafile,$identifier);

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.


home / experts / perl / tutorial 22 To page 1To page 2current page
[previous]

http://www.internet.com