in reply to Re^2: Creating wrapper over a wrapper
in thread Creating wrapper over a wrapper

Well, if the ABC::new_time_var function is declared with a prototype of (), meaning no arguments, you cannot call it with arguments in your wrapper, like ABC::new_time_var(@_).  Similarly for the other two functions.

See also other threads on using prototypes here, to better understand how prototypes work in Perl (hint: they don't act like in C).

Replies are listed 'Best First'.
Re^4: Creating wrapper over a wrapper
by sunnyagarwal008 (Initiate) on May 06, 2010 at 09:16 UTC
    But how come then passing @_regardless the number of arguments function expects, works fine in case we write a wrapper over a pure perl module?

      This has nothing to do with with XS or not.  It's solely a matter of whether there's a prototype declared for the function.  The exact same problem exists for pure-Perl modules:

      #!/usr/bin/perl package ABC; sub new_time_var () { # ^^prototype print "ABC::new_time_var() called.\n"; } package PQR; sub new_time_var { ABC::new_time_var(); # prototype-compatible call --> works ABC::new_time_var(@_); # incompatible --> "Too many arguments for + ABC::new_time_var ..." } new_time_var();
      Please express your question in code.

      Maybe you want to read perlsub again (esp section on prototypes)?

      $ perl -le" sub mysplice (\@$$@){ warn@_} sub QQQ(\@$$@) { goto &mysp +lice } QQQ @a, 1,1" ARRAY(0x97a064)11 at -e line 1.