Umm.. Do you mean:

------------------------------------------------------------
package Foo::Bar;

sub new {
  my $class = shift;
  return bless { jo => 42 }, $class;
}

sub prnJoe {
  my $self = shift;
  print $self->{jo}, "\n";
}

package main;

$f = Foo::Bar->new();
$f->prnJoe();
------------------------------------------------------------


Regards,

-- Gregor

On Sat, 2003-11-22 at 04:36, Sterling Hughes wrote:
> Dan Sugalski wrote:
> > These could use some documenting (and yes, I know the answer to many) for
> > future use for folks generating PIR. (Hint, hint -- documentation is a
> > good thing)
> > 
> > *) How do I declare an externally visible subroutine?
> > 
> > *) How do I store a global variable
> > 
> > *) How do I load a global variable
> > 
> > *) How do I call an external function
> > 
> > *) How do I get the sub pmc for a sub declared later (or earlier) in the
> > file?
> > 
> > *) How do I (or even can I) have a file-scoped variable? (like .local,
> > only for all code in the file)
> > 
> 
> 
> *) How do I do the following in PIR:
> 
> package Foo::Bar;
> 
> my $joe = 42;
> 
> sub new {
>       bless {};
> }
> 
> sub prnJoe {
>       my $self = shift;
>       print $self->jo;
> }
> 
> package main;
> 
> $f = Foo::Bar->new();
> $f->prnJoe();
> 
> 
> Would also be *really* great (I'm trying to implement the IMC codegen in 
> PHP for classes and objects right now :)
> 
> -Sterling
-- 
Gregor Purdy                            [EMAIL PROTECTED]
Focus Research, Inc.               http://www.focusresearch.com/

Reply via email to