Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: get the files inside War
by marto (Cardinal) on Jun 14, 2007 at 08:28 UTC
    Hi Anonymous Monk,

    Your post seems to have caused some confusion, (war could be a typo of tar) perhaps if you explained what a WAR file is then it would have made more sense to people. File::Find will not know how to unpack the WAR file, so you will need to work out how to do this before searching the resulting files. Using google I found this post which details unpacking jar files. Perhaps you could adapt/learn from it. Failing that use Super Search and see if you can find anything here that will help you.

    Hope this helps

    Martin
      If a WAR file is a JAR file, then it actually is a ZIP file and you can open those with Archive::Zip — which is built on top of Compress::Zlib.

      So yes, it can be done, but you'll have to write your own callback for File::Find to check the file extension, open the ZIP file, and list the files in them, or extract the files you want.

Re: get the files inside War
by andreas1234567 (Vicar) on Jun 14, 2007 at 08:11 UTC
Re: get the files inside War
by johngg (Canon) on Jun 14, 2007 at 10:32 UTC
    I think a WAR is some kind of container file used in the Java world and I believe that it is, in effect, a ZIP archive. You may be able to look at individual files inside the WAR using the Archive::Zip module.

    Cheers,

    JohnGG

Re: get the files inside War
by sago (Scribe) on Jun 14, 2007 at 10:47 UTC

    tar, jar, war, ear, sar files
    Many file have extensions ending in "a r".
    It's because the "ar" stands for archive, and it's such
    a reasonable way of naming file that the original tar
    which stands for tape archive was picked up by Sun and
    the Java community and transmuted into other file
    formats.
    tar - tape archive
    jar - java archive
    war - web application archive
    ear - enterprise archive
    sar - service archive
    war and ear are jar files, created with the jar
    utility. In fact, they're a subtype of jar files with
    the data they contain being in a specific file and
    directory stucture. In other words, the arrangment of
    files within a war is such that the file and its
    contents are suitable for deployment as a webapp under
    a container such as Apache Tomcat, and the arrangement
    of files within a ear is such that it's an Enterprise
    Archive such as you would use under JBoss, etc.


    Can you tell us what is the exact thing which you want
    to be done?
      Hi sago and greatmonks
      i want list Class files inside the ear (ear/war/*.class). using File::Find
      <Joke>War, hunh, what is it good for? <\Joke>

      (That was a flashback to the '60s; sorry...)
Re: get the files inside War
by cdarke (Prior) on Jun 14, 2007 at 08:27 UTC
    Could you please explain what you mean by "war"?