OK, Attached is the handler I'm trying to write. Everything works fine
except for that last URL it spits out (for the text that says "more!").
The URL on the actual page goes something like <a
href="database.phtml/....">, and the base url of the
page is http://linux.com/tuneup. However, when GetHtml() is fed the
data, for some reason it translates that last URL as
"database.phtml/..." instead of
"http://linux.com/tuneup/database.phtml/...".  As you can see, I
commented out a line I tried to use to add http://linux.com/tuneup to
the URL, but that didn't work either. Please help!

-- 
   ___   ___ 
  / _ | / _ \   Ari Pollak - [EMAIL PROTECTED] - www.compwiz.nu
 / __ |/ ___/  ICQ #749825 - AOL IM: aripollak
/_/ |_/_/     Todays subliminal message is " "
# -*- mode: Perl; -*-

package NewsClipper::Handler::Acquisition::tuneup;

use vars qw( @ISA $VERSION %handlerInfo );

$handlerInfo{'Author_Name'}              = 'Ari Pollak';
$handlerInfo{'Author_Email'}             = '[EMAIL PROTECTED]';
$handlerInfo{'Maintainer_Name'}          = 'Ari Pollak';
$handlerInfo{'Maintainer_Email'}         = '[EMAIL PROTECTED]';
$handlerInfo{'Description'}              = <<'EOF';
Tuneup from Linux.com
EOF
$handlerInfo{'Category'}                 = 'Linux';
$handlerInfo{'URL'}                      = <<'EOF';
http://www.linux.com/tuneup/
EOF
$handlerInfo{'License'}                  = 'Artistic License';
$handlerInfo{'For_News_Clipper_Version'} = '1.18';
$handlerInfo{'Language'}                 = 'English';
$handlerInfo{'Notes'}                    = <<'EOF';
EOF
$handlerInfo{'Syntax'}                   = <<'EOF';
<input name=tuneup>
EOF

use strict;
use NewsClipper::Handler;
@ISA = qw(NewsClipper::Handler);

# - The first number should be incremented when a change is made to the
#   handler that will break people's input files.
# - The second number should be incremented when a change is made that won't
#   break people's input files, but changes the functionality.
# - The third number should be incremented when only a bugfix is applied.

$VERSION = do {my @r=('0.1.0'=~/\d+/g);sprintf "%d."."%02d"x$#r,@r};

# ------------------------------------------------------------------------------

sub ComputeURL
{
  my $self = shift;
  my $attributes = shift;

  my $url = 'http://www.linux.com/tuneup/';

  return $url;
}

# ------------------------------------------------------------------------------

# This subroutine checks the handler's attributes to make sure they are valid,
# and sets any default attributes if necessary.

sub ProcessAttributes
{
  my $self = shift;
  my $attributes = shift;
  my $handlerRole = shift;

  # Set defaults here. You can safely delete this function if your handler has
  # no attributes with default values.

  # $attributes->{'some_attribute'} = 'default_value'
  #   unless defined $attributes->{'some_attribute'};

  # Verify any attributes you need to here. Output an error and return undef
  # if something is wrong.

  # unless ($attributes->{somevalue} > 0)
  # {
  #   error "The \"somevalue\" attribute for handler \"HANDLERNAME\" " .
  #     "should be greater than 0.\n";
  #   return undef;
  # }

  return $attributes;
}

# ------------------------------------------------------------------------------

# This function is used to get the raw data from the URL.
sub Get
{
  my $self = shift;
  my $attributes = shift;

  my $startPattern = '<font color="#999999"><b>Tuneup:</b></font>';
  my $endPattern = '<p></div>';

  my $url = $self->ComputeURL($attributes);

  my $data = GetHtml($url,$startPattern,$endPattern);
#  $data =~ s#(database.phtml)#http://linux.com/tuneup/$1#g;
  return undef unless defined $data;

  return $data;
}

# ------------------------------------------------------------------------------

sub GetDefaultHandlers
{
  my $self = shift;
  my $inputAttributes = shift;

  my $returnVal =<<'  EOF';
    <output name='string'>
  EOF

  return $returnVal;
}

# ------------------------------------------------------------------------------

sub GetUpdateTimes
{
  return ['2,6,10,16,19,21'];
}

1;

Reply via email to