# ODP::Editors::SemiPublicCategory - An ODP public page parsing class that uses editors.dmoz.org (Version 0.01) # Copyright (C) 2002 - 2004 Richard P. Fuller # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package ODP::Editors::SemiPublicCategory; our @ISA="ODP::Category"; use strict; use ODP::Editors::Category; # For ODP::Editors::ServerURL (amongst others) # new - Initialises a new ODP::Editors::SemiPublicCategory object # Parameters: category # Returns: ODP::Category object sub new ($) { my $object = {}; if (!defined $_[2]) { die 'No category supplied.'; } $object->{'category'} = ODP::Category::normalise($_[3]); $object->{'e_name'} = $_[1]; $object->{'e_pass'} = $_[2]; return bless $object; } # fetch - Fetches the public page and stores the source in the object # Parameters: # Returns: sub fetch { my $self = shift; if (!$self->{'category'}) { # Make a fake page for Top/ foreach my $cat ('Adult','Arts','Bookmarks','Business','Computers','Games','Health','Home','Kids_and_Teens','Netscape','News','Recreation','Reference','Regional','Science','Shopping','Society','Sports','Test','World') { $self->{'content'} .= "
  • $cat\n  (0)"; } return; } my $ua = new ODP::Editors::HTTP('GET', "$ODP::Editors::ServerURL/$self->{'category'}/", $self->{'e_name'}, $self->{'e_pass'}); my $response = $ua->execute(); $self->{'content'} = $response; }