The function name with it's argument list should be on a line by itself - and the types of the argumetsn should be omitted. The rest of the xsub consists of named sections. These sections are documented in the perlxs manpage. This defines how the xsub should be called from Perl. If a call to the xsub doesn't match the given prototype, Perl treats it as a run-time error and dies.
Prototypes follow the same behavior as documented in the perlsub manpage.
This section is used to define the types for the arguments to the xsub. In all of our functions, our first argument in the object's 'self'. My own personal opinion on the code blocks is to keep them as short and as simple as possible. If they can not be set up to call the C function directly, having them call a wrapper implemented in C is often a good choice. The output section lists the return value, as well as any input parameters that are also to be used as output parameters.