<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://community.activestate.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>ActiveState Community Site - plc and forward declaring perl classes - Comments</title>
 <link>http://community.activestate.com/forum-topic/plc-and-forward-declaring</link>
 <description>Comments for &quot;plc and forward declaring perl classes&quot;</description>
 <language>en</language>
<item>
 <title>Looks like splitting the</title>
 <link>http://community.activestate.com/forum-topic/plc-and-forward-declaring#comment-2024</link>
 <description>&lt;p&gt;Looks like splitting the interface definition did the trick!&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;# -------------------------------------------------------------------

package My::Person;

=for interface
[interface: pure]
static Person();
=cut

require My::Person;

# -------------------------------------------------------------------

package My::Group;

=for interface
[interface: pure]
static Group();
wantarray Person[] GetMembers(); # ok, Person is declared here
=cut

require My::Group;

# -------------------------------------------------------------------

package My::Person;

=for interface
bool IsMemberOf(Group theGroup); # now ok
=cut&lt;/pre&gt;&lt;/p&gt;&lt;/blockquote&gt;
</description>
 <pubDate>Wed, 20 Jun 2007 12:29:06 -0700</pubDate>
 <dc:creator>frode</dc:creator>
 <guid isPermaLink="false">comment 2024 at http://community.activestate.com</guid>
</item>
<item>
 <title>plc and forward declaring perl classes</title>
 <link>http://community.activestate.com/forum-topic/plc-and-forward-declaring</link>
 <description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I&#039;m newbie to perl, but experience C programmer, trying to make my perl modules into a .NET DLL library.&lt;/p&gt;
&lt;p&gt;My problem is that while wrapping my existing modules into C# interface, one of my class Person uses another class Group declared after the class Person. This results in an error that Group is not defined:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code class=&quot;geshifilter&quot;&gt;System.ApplicationException: Can&#039;t locate type Group&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Is it possible to forward declare class Group before class Person is declared, so PLC compiler knows about it?&lt;br /&gt;
Or, is there some other way around this?&lt;/p&gt;
&lt;p&gt;Currently, I&#039;m adding all interface definitions in an own file, instead of modifying the original Perl source-code. Like so:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class=&quot;geshifilter&quot;&gt;# -------------------------------------------------------------------

package My::Person;
#use My::Group; # this forwarding does not work

=for interface
  [interface: pure]
  static Person();
  bool IsMemberOf(Group theGroup); # error
=cut

require My::Person;

# -------------------------------------------------------------------

package My::Group;

=for interface
  [interface: pure]
  static Group();
  wantarray Person[] GetMembers(); # ok, Person is declared here
=cut

require My::Group;&lt;/pre&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Here, the class Person need to know Group in advance...&lt;/p&gt;
&lt;p&gt;Hope I&#039;m making myself understandable. :-)&lt;/p&gt;
&lt;p&gt;Thanks in advance for any hints!&lt;br /&gt;
Regards, Frode&lt;/p&gt;
</description>
 <comments>http://community.activestate.com/forum-topic/plc-and-forward-declaring#comments</comments>
 <category domain="http://community.activestate.com/forums/pdk-support-0">PDK Support</category>
 <category domain="http://community.activestate.com/os/windows">Windows</category>
 <pubDate>Tue, 19 Jun 2007 04:43:04 -0700</pubDate>
 <dc:creator>frode</dc:creator>
 <guid isPermaLink="false">1042 at http://community.activestate.com</guid>
</item>
</channel>
</rss>
