我正在使用带有树的 Jenkins xml api。这是我用于本地托管 Jenkins 服务器的 url。
http://localhost:8080/api/xml?
tree=jobs[name,description,color,healthReport[score,description]]
上面的 url 将 xml 输出显示为:
<hudson>
<job>
<description/>
<name>build1</name>
<color>disabled</color>
<healthReport>
<description>Build stability: 2 out of the last 5 builds failed.</description>
<score>60</score>
</healthReport>
</job>
<job>
<description>test job description check.</description>
<name>Build2</name>
<color>blue</color>
<healthReport>
<description>Build stability: No recent builds failed.</description>
<score>100</score>
</healthReport>
</job>
<job>
<description/>
<name>Build3</name>
<color>blue</color>
<healthReport>
<description>Build stability: 3 out of the last 4 builds failed.</description>
<score>25</score>
</healthReport>
</job>
</hudson>
现在我想以一种可以进一步处理标签值的方式解析 xml 输出。
前任:
foreach job
if color=blue
print jobname : color
if score = 100
etc
我怎么能在 perl 中做到这一点,我应该使用哪个 perl 模块?