Home > Archive > PERL Beginners > January 2006 > Trouble with "Not a subroutine reference"
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Trouble with "Not a subroutine reference"
|
|
| ramblinpeck@gmail.com 2006-01-30, 3:55 am |
| 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.
| |
| ramblinpeck@gmail.com 2006-01-30, 3:55 am |
| Ignore me, I'm an idiot. Should have been {'s instead of ('s. Thanks,
|
|
|
|
|