home / experts / perl / tutorial 22 |
![]() ![]() ![]() [previous] |
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 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 |
![]() ![]() ![]() [previous] |