Inline::Struct : Error : Cannot Locate Object method via new

Tango Issac Debian's Avatar, Join Date: May 2006
Go4Expert Member
This is a very simple code I trying to run after installing the Inline::C pacakges by the APT in the ubuntu system. The Hello World level programm is running successfully. To use the Inline::Struct for this simple code, I facing a problem.

#!/usr/bin/perl -w

#use Inline C;
use Inline C => Config => Structs => ['Foo'];
use strict;

  my $obj = Inline::Struct::Foo->new;



  struct Foo {
    int num;
    char *str;

  void myfunc(Foo *f) {
    printf("myfunc: num=%i, str='%s'\n", f->num, f->str);

This Code showing this specific error during runtime :

"Can't locate object method "new" via package "Inline::Struct::Foo" (perhaps you forgot to load "Inline::Struct::Foo"?) at /home/tango/workspace/PerlLerning/ line 10."

What is the possible solution??
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Please refer to this