Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   Inline::Struct : Error : Cannot Locate Object method via new (http://www.go4expert.com/forums/inlinestruct-error-locate-object-method-t16611/)

Tango Issac Debian 21Mar2009 11:37

Inline::Struct : Error : Cannot Locate Object method via new
 
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.

Code:

#!/usr/bin/perl -w

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




  my $obj = Inline::Struct::Foo->new;
  $obj->num(10);
  $obj->str("Hello");

  myfunc($obj);

  __END__
  __C__
 
  #include<stdio.h>

  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 :

Code:

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

What is the possible solution??

pradeep 24Mar2009 17:29

Re: Inline::Struct : Error : Cannot Locate Object method via new
 
Please refer to this http://search.cpan.org/~sisyphus/Inline-0.45/Inline.pod


All times are GMT +5.5. The time now is 06:36.