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

Stanislav Sinyagin ssinyagin at yahoo.com
Sat Jan 5 08:21:50 EST 2008


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.

My project will involve some command-line commands that would be 
executed by Cron or manually by the users.

Now I'm desperately trying to find the hints how to create Jifty objects 
from non-web scripts. Can someone throw me a piece of code that would load 
a Model object?

Here's what I'm trying to do, and it doesn't work. I created a model called "Device", 
and it also implements some methods to call another model "DeviceProperty".
Now I need to know where to start in order to be able to work with the obejcts in 
Jifty fashion:

================
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.




thanks,
stan





More information about the jifty-devel mailing list