Re: Extending Moose with Inline C?

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
Zbigniew,

Well, if you are creating the objects with C, this might be tricky,  
but can be worked around. If you are writing/reading data from C-based  
accessors, this is still a little tricky but easily worked around. If  
you just need to call methods which are not accessors or constructors,  
but are written in C, then this will be no problem at all.

Moose tries to make your life easier, which means getting out of the  
way when you need it too. Maybe if you gave us some more detail on  
what you want to use Moose for vs. what you want to use Inline::C for,  
we could be a bit more helpful.

- Stevan

On Jan 9, 2009, at 3:55 AM, Zbigniew Lukasiak wrote:

> Hi,
>
> Is it feasible to build a Moose object with an Inline C method?
>
> We have here some Inline C based parsers for network packets (mostly
> analogue to Net::Packet).  They build a hash with the parsed values -
> so using standard Perl OO I would just bless that hash and be done,
> but I guess in Moose that would not be that simple.
>
> For some background - the throughput of our communication streams
> (SMS) require that it is done in that low level (this was a decision
> done before I came here but I have done some rudimentary tests and, to
> my surprise, the Inline C based vesions are indeed many times faster
> than the Net::Packet versions that use pack/unpack).  Now my task is
> to write some OO wrappers to our libraries.  Of course I don't know if
> the OO overhead will not spoil the advantage that we get from parsing
> in C - I'll have to verify that, I think this will depend much on the
> usage.
>
> -- 
> Zbigniew Lukasiak
> http://brudnopis.blogspot.com/
> http://perlalchemy.blogspot.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.