The Perl language gains popularity daily among programmers from all over the world because of its flexibility, vast sphere of application, and easy source-code availability. The Comprehensive Perl Archive Network (CPAN) distributes Perl modules as open-source software. You can download the packages from CPAN using the ppm tool that comes with the ActivePerl distribution. ActiveState's latest release of PerlNET, included in the Perl Dev Kit, brings Perl programming into the realm of .NET compliant languages, which may increase Perl usage substantially.
PerlNET allows you to create .NET-compliant applications and components using the Perl language. One key feature is that you can use existing Perl packages (modules) from CPAN within the .NET environment and in your favorite .NET compliant language without rewriting the Perl code. Instead, you create a simple wrapper class in PerlNET for the package, and enumerate all the module methods or properties you want to expose to .NET. In other words, you need to provide an interface definition through which NET programs will interact with the Perl module. PerlNET introduces new Plain Old Documentation (POD) blocks for this purpose, using the syntax:
=for interface
. . .
=cut
Inside these blocks, you define the prototypes of methods and declare properties. You can separate the definitions into several blocks or unify them under a single block. When providing an interface definition for Core Perl modules, include the [interface: pure] attribute inside one of the POD blocks (usually the first). This instructs PerlNET to create a .NET component in the Core Perl manner:
=for interface
[interface: pure]
. . .
=cut
Because .NET is a strongly typed environment, you must provide the types for methods arguments, for methods return values, and for properties when defining the interface. For example, if some subroutine Foo accepts a string and returns an integer, it should have the following prototype in the =for interface block:
=for interface
int Foo(str text);
=cut
Table 1 shows .NET types from the System namespace and the corresponding PerlNET types.