ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hal Hildebrand \(web\)" <Hal.Hildebr...@hellblazer.com>
Subject Re: perl and the script task
Date Thu, 30 May 2002 23:03:00 GMT
Do it with javascript.  Forget Perl.

<project name="test_project" default="test" basedir=".">
    <property name="test-prop" value="server1-db1"/>

    <target name="test">
        <script language="javascript"> <![CDATA[

            temp = test_project.getProperty("test-prop");
            index = temp.indexOf("-");
            test_project.setProperty("extractedFromTest",
temp.substring(index + 1, temp.length()));

            ]]>
        </script>
        <echo message="${extractedFromTest}" />
    </target>

</project>


----- Original Message -----
From: "Anthony Rodriguez" <Anthony@WeddingChannel.com>

> This is for anyone out there who has run the <script> task using Perl.
I am
> running ant1.4 release and I need to do the following.
>
> Let's say I have the following property:
>
> <property name="test" value="server1-db1"/>
>
> Now I want to extract everything after the "-" in the ${test} property
and
> make that value a new property.  In this case the new property would
be:
>
> <property name="extractedFromTest" value="db1"/>
>
> I am fairly good with Perl but I don't know how to use the <script>
task
> properly with it.  I understand that ant1.5 may have tasks to suit my
need
> here but I am looking for a way to do it using ant1.4.
>
> Anthony Rodriguez
> WeddingChannel.com
> 213 599-4419
> arodriguez@weddingchannel.com
>
> Need to buy a wedding gift?
> Visit http://www.weddingchannel.com
>
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message