Re: Problem with cmods
Bill Welliver <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
One other tip: a cmod (or any pike module, really) is a singleton of the
class defined in the module (be it pmod or cmod). So, your cmod file
itself is a class, and you can define functions directly within it,
without a surrounding PIKECLASS construct. Note that you may need to deal
with the init/exit stuff, as I _think_ the defaults get turned off in this
situation.
You can see an example of a cmod (actually, a cmod split across multiple
cmods) with top level functions here:
http://hg.welliver.org/pike_modules-public_parser_xml2/src/804f0398f38a622f97dec7b07ce3652317b5d84f/XML2.cmod?at=default
I've written a number of CMODs, and the repos should all be visible. Feel
free to steal any code in any of my repositories; I'm not the proprietary
type :)
Best,
Bill
On Tue, 25 Mar 2014, Christian Toepp wrote:
> Hi, i have a little problem with cmods. i write
> --SNIP--
...
>
> write(PikeTest.func("foo"));
>
> i get the message "Index 'func' not present in module 'PikeTest'"
>
> whats wrong with my code?
>
> Best regards & thx for help
> -Chris
>