Jan Dubois wrote:
> 
> On Fri, 05 May 2000 11:58:45 -0400, "Ian D. Stewart" <[EMAIL PROTECTED]>
> wrote:
> 
> >if I add a 'use Java::ClassFile qw(:visibility)' to a regular script, I
> >am able to access accPublic, accProtected and accPrivate without any
> >problems.
> >
> >However, trying the same within another package fails.  If I just use
> >'accPublic', perl treats it as a bare word.  If I force interpretation
> >as a subroutine, by prepending an '&' at the beginning, I get an error
> >message 'Undefined subroutine &Java::Class::accPublic called at ...'
> 
> This should work within a package just the same as within a "regular
> script" (which is in package main::).  Are you sure you have the "use"
> statement *after* the "package" statement?
> 
> You may need to show a little more of your package code to let us spot
> what the problem might be.
> 

Here's the beginning of package Java::Class:

> package Java::Class;
> 
> use Java::ClassFile qw(:visibility);
> 
> $VERSION = '0.01';
> 

and the method that uses the accXXX subroutines:

> sub Dump
> {
>     my $self = shift;
>     my $handle = shift || \*STDOUT;
> 
>     my @keywords = ();
>     $keywords[accPublic] = "public";
>     $keywords[accPrivate] = "private";
>     $keywords[accProtected] = "protected";
>     $keywords[accStatic] = "static";
>     $keywords[accFinal] = "final";
>     $keywords[accSynchronized] = "synchronized";
>     $keywords[accVolatile] = "volatile";
>     $keywords[accTransient] = "transient";
>     $keywords[accNative] = "native";
>     $keywords[accAbstract] = "abstract";
> 
>     print $handle join(' ', $keywords[$self->Visibility], 
>                      $keywords[$self->Scope], 
>                      (($self->IsInterface) ? "Interface" : "Class"), 
>                      $self->Name), "\n";

There's more to the above method, but it's just cycling through the
fields and methods of the class and printing them to '$handle'.


and here's the subroutines themselves:

> sub accPublic       { 0x0001; }
> sub accPrivate      { 0x0002; }
> sub accProtected    { 0x0004; }
> sub accStatic       { 0x0008; }
> sub accFinal        { 0x0010; }
> sub accSuper        { 0x0020; }     # used by ClassFile
> sub accSynchronized { 0x0020; }     # used by MethodInfo
> sub accVolatile     { 0x0040; }
> sub accTransient    { 0x0080; }
> sub accNative       { 0x0100; }
> sub accInterface    { 0x0200; }
> sub accAbstract     { 0x0400; }
> sub accStrict       { 0x0800; }



Thanx Again,
Ian 


-- 
99 little bugs in the code, 99 bugs in the code.
Fix one bug, compile again, 100 little bugs in the code.
100 little bugs in the code, 100 bugs in the code.
Fix one bug, compile again, 101 little bugs in the code...

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to