Re: Analize Java source file with perl?
- From: a.r.ferreira@xxxxxxxxx (Adriano Rodrigues)
- Date: Thu, 26 Oct 2006 10:33:58 -0300
On 10/26/06, bou, hou (GE Money, consultant) <hou.bou@xxxxxx> wrote:
hello, all
I want to get the Class name of .java file with perl ,
I want to get like this
>perl ClassChecker.pl AAA.java
>ClassA
>ClassB
Quick and dirty:
$ perl -n -e 'print "$1\n" if /class\s+(\w+)/' AAA.java
ClassA
ClassB
This does not know anything about Java syntax and just looks for a
word after 'class' and some space. If it is in comments or you have
something like
public class
Foo {
}
it won't understand it.
More robust solutions are feasible. For example, after improving the
recent CPAN module Parse::Java, you can do a lot better. To quote
Randal, "Learn or hire".
.
- References:
- Analize Java source file with perl?
- From: Hou Bou
- Analize Java source file with perl?
- Prev by Date: Re: Analize Java source file with perl?
- Next by Date: Re: Analize Java source file with perl?
- Previous by thread: Re: Analize Java source file with perl?
- Next by thread: Re: Analize Java source file with perl?
- Index(es):
Relevant Pages
|
|