You are not logged in.

#1 2012-10-25 12:58:28

belbo
Member
From: Sydney, Australia
Registered: 2011-02-25
Posts: 51

Can't locate object method "new" via package "MythTV"

Good day.

I'm getting this error message when trying to run various MythTV-related scripts -

Can't locate object method "new" via package "MythTV" (perhaps you forgot to load "MythTV"?) 

I understand it may have something to do with ther perl bindings.

After upgrading Arch about 2 or 3 months ago I was advised to delete everything in /usr/share/perl5/site_perl/ to address other perl-related issues I was having. Looking at my backup of that folder I reaised there were MytTV items, so I restored them but that hasn't resolved the problem.

Any help would be appreciated.

The contents of site_perl diretory are now as follows -

[ben@htpc ~]$ ls  -lh /usr/share/perl5/site_perl/
total 8.0K
drwxr-xr-x 2 root root 4.0K Oct  8 19:00 MythTV
-r--r--r-- 1 root root 1.7K Oct  8 08:53 MythTV.pm
[ben@htpc ~]$ ls  -lh /usr/share/perl5/site_perl/MythTV
total 56K
-r--r--r-- 1 root root 4.5K Oct  8 19:00 Channel.pm
-r--r--r-- 1 root root  20K Oct  8 19:00 Program.pm
-r--r--r-- 1 root root  24K Oct  8 19:00 Recording.pm
-r--r--r-- 1 root root 2.4K Oct  8 19:00 StorageGroup.pm 

A fuller version of the error looks like this -

[ben@htpc ~]$ /usr/share/mythtv/contrib/user_jobs/mythlink.pl  --link /media/MythTV/TVrecordings-View1 --format /%T%-%Y-%m-%d-%S
Can't locate object method "new" via package "MythTV" (perhaps you forgot to load "MythTV"?) at /usr/share/mythtv/contrib/user_jobs/mythlink.pl line 293.

Line 293 of mythlink.pl looksl like this -

# Connect to mythbackend
    my $Myth = new MythTV();

Thanks a lot

belbo

Last edited by belbo (2012-10-25 13:05:00)

Offline

#2 2012-11-05 12:12:24

belbo
Member
From: Sydney, Australia
Registered: 2011-02-25
Posts: 51

Re: Can't locate object method "new" via package "MythTV"

Bump. Anybody able to help ? Thanks.

Offline

#3 2013-02-05 05:36:37

belbo
Member
From: Sydney, Australia
Registered: 2011-02-25
Posts: 51

Re: Can't locate object method "new" via package "MythTV"

Bump. It's been a while. I would love to sort this out if anybody is able to help. Thanks.

Offline

#4 2013-02-21 19:06:44

fphillips
Member
From: Austin, TX
Registered: 2009-01-24
Posts: 202

Re: Can't locate object method "new" via package "MythTV"

I think you didn't restore the IO directory under /usr/share/perl5/site_perl/. Also see how much larger my MythTV.pm is, although that may be due to being on 0.26-fixes.

[root@central ~]# ls -lh /usr/share/perl5/site_perl/
total 44K
drwxr-xr-x 3 root root 4.0K Feb  5 18:35 IO
drwxr-xr-x 2 root root 4.0K Feb  5 18:35 MythTV
-r--r--r-- 1 root root  35K Feb  5 18:19 MythTV.pm
[root@central ~]# ls -lh /usr/share/perl5/site_perl/MythTV/
total 56K
-r--r--r-- 1 root root 4.5K Feb  5 18:19 Channel.pm
-r--r--r-- 1 root root  20K Feb  5 18:19 Program.pm
-r--r--r-- 1 root root  24K Feb  5 18:19 Recording.pm
-r--r--r-- 1 root root 2.4K Feb  5 18:19 StorageGroup.pm

I don't know any perl, but did some googling and tried the below.

[root@central ~]# perl -E 'use MythTV; say MythTV->new;'
MythTV=HASH(0x165fba8)
[root@central ~]# perl -E ' say MythTV->new;'
Can't locate object method "new" via package "MythTV" (perhaps you forgot to load "MythTV"?) at -e line 1.

The first one should be what mythlink.pl is doing, but it's acting like the second because it can't find MythTV.pm (my guess anyway). I don't know what the equivalent of $PATH is for perl (@INC?) or where you set it. I couldn't find any configuration for that.

Since the perl bindings are owned by the mythtv package, you can just reinstall it to make sure there isn't an incompatibility with the ones you restored from backup. Maybe they are from a previous version and get ignored, or the missing IO is causing the failure.

[root@central ~]# grep -m1 VERSION /usr/share/perl5/site_perl/MythTV.pm 
    $VERSION = '.26git';
[root@central ~]# grep -m1 "MythTV->new" /usr/share/perl5/site_perl/MythTV.pm 
        my $sock    = IO::Socket::INET::MythTV->new(PeerAddr => $host,

Offline

Board footer

Powered by FluxBB