Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Procedural and object oriented interface in Perl/XS

by dave_the_m (Monsignor)
on Oct 23, 2014 at 12:23 UTC ( [id://1104764]=note: print w/replies, xml ) Need Help??


in reply to Procedural and object oriented interface in Perl/XS

Perl doesn't make any distinction between a function call and a method call (except that which function to call is resolved at run-time). $x->foo($y,$z) just calls foo($x,$y,$z),and Class->foo($y,$z) just calls foo('Class',$y,$z).

So if you want your function (be it perl or XS code) to tell the difference, you need to make the function be called in a slightly different way to make a distinction

Dave.

  • Comment on Re: Procedural and object oriented interface in Perl/XS

Replies are listed 'Best First'.
Re^2: Procedural and object oriented interface in Perl/XS
by stewa02 (Novice) on Oct 23, 2014 at 13:14 UTC

    Well the difference is: the method call gives the instance of the object as the only argument, the function call a number (For cos: $instance->cos; or MyModule::Math::cos(42);) and thats what I try to do with sv_isobject(). But this dows not work and I don't see my error.

      But this dows not work
      Can you be much more specific please. In which way does it not work? Under what circumstances does it not work? Have you single-stepped that XS function under a debuggger? At what point does the behaviour deviate from what you expect? Etc.

      Dave.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-20 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found