[jifty-devel] need help with command-line scripting

Shawn M Moore sartak at bestpractical.com
Mon Jan 7 03:01:50 EST 2008


On Sat, Jan 05, 2008 at 05:21:50AM -0800, Stanislav Sinyagin wrote:
> hi all,
> 
> a long-time RT user, I tried to utilize SearchBuilder 
> for my new project, and finally I found Jifty - which looks very promising.

Yeah, Jifty takes everything RT's framework did and cranks the notch
from six to ten. :)

> use warnings;
> use strict;
> use File::Basename qw(dirname); 
> use UNIVERSAL::require;
> 
> use Jifty;
> 
> my $devclass = Jifty->app_class('Model', 'Device');
> 
> my $device = $devclass->new();
> 
> $device->create(hostname => 'aaa',
>                 ipv4addr => '10.0.0.1');
> 
> 
> $device->set_property('snmp-community', 'aaabbb');
> ================
> 
> This code results in 
> Can't locate object method "new" via package "Toponet::Model::Device" 
> (perhaps you forgot to load "Toponet::Model::Device"?) at bin/test.pl line 12.

If you replace:

    use Jifty;
    
with: 

    use Jifty::Everything;
    BEGIN { Jifty->new }

it should work. I'm not sure if Jifty->new is required to be in a BEGIN
block, but it's how I use it.

> thanks,
> stan

Shawn



More information about the jifty-devel mailing list