Trouble with "Not a subroutine reference"
- From: ramblinpeck@xxxxxxxxx
- Date: 29 Jan 2006 21:47:30 -0800
Can't figure this out for the life of me, any help appreciated.
Thanks:
#class Site
package Site;
use strict;
use Page;
use URI;
#constructor
sub new {
my ($class) = @_;
my $self = {
_pages => undef,
_siteName => undef,
};
bless $self, $class;
return $self;
}
sub site {
my ($self, $sitename) = @_;
$self->('_siteName') = $sitename; <-- This is the line the error
appears to be on
return $self->('_siteName');
}
This is being called from another file:
#!/usr/bin/perl
use strict;
use Downloader;
use Page;
use Site;
my $downloader = eval { new Downloader();} or die (@_);
$downloader->parser(HTML::LinkExtor->new());
my $links = $downloader->fetch("http://www.secureworks.com");
my $newSite = eval { new Site();} or die(@_);
my $newpage = eval { new Page();} or die(@_);
foreach (@$links){
my $u1 = URI->new($_);
if($u1->scheme =~ /^[^mailto]/){
$newpage->uri($u1); #this should be done in downloader, with page
passed to scheduler
my @pages;
$newSite->site("test123");
Get error:
Not a subroutine reference at Site.pm line 20.
Thanks for any help.
.
- Follow-Ups:
- Re: Trouble with "Not a subroutine reference"
- From: ramblinpeck
- Re: Trouble with "Not a subroutine reference"
- Prev by Date: Re: Create thumbnail from webpage
- Next by Date: Re: Trouble with "Not a subroutine reference"
- Previous by thread: Create thumbnail from webpage
- Next by thread: Re: Trouble with "Not a subroutine reference"
- Index(es):
Relevant Pages
|
|