Proyecto de HP (2003/04)

Primera parte

Tenemos una página web que contiene información sobre proyectos de cooperación internacional realizados en distintos paises de latinoamérica. Sobre cada proyecto tenemos información como el nombre del país donde se llevó a cabo el proyecto, el nombre del proyecto, descripción, área, programas operacionales, tipo de proyecto, estado actual del proyecto, fecha de inicio, fecha de finalización, presupuesto del proyecto, asociación que recibe la ayuda y el tipo de asociación. La página web pfs.htm que contiene la información de los proyectos se encuentra en el directorio /iilabs/HP/proyecto.

Escribir un programa en Perl que extraiga de la página web la información relativa a cada proyecto y guarde dicha información en un fichero de texto. Guardaremos la información referente a cada proyecto por filas y cada uno de los campos de información sobre cada proyecto se deberán separar por un caracter que no se utilice como información en dichos campos, por ejemplo, el caracter #.

La estructura del fichero HTML con el que tenéis que trabajar es la siguiente:

<html><head>

<style type="text/css"> información sobre el estilo

</style>
<title>SGP Project Information</title>
</head>

texto de cabecera ...

y ahora empieza la información de los proyectos

<tr>
<td class="dtTabHeader" valign="TOP">Region</td>
<td class="dtTabHeader" valign="TOP">Regional Bureau for Latin America and the Caribbean</td>
</tr>
<tr>
<td class="dtTabHeader" valign="TOP">Country</td>
<td class="dtTabHeader" valign="TOP">GUATEMALA</td>
</tr>
<tr>
<td class="dtTabHeader" valign="TOP"><font size="+1">Project Name</font></td>
<td class="dtTabHeader" valign="TOP"><font size="+1">Agroecological production and commercialization</font></td>
</tr>
<tr>
<td class="tdData1" valign="TOP">Description</td>
<td class="tdData2" valign="TOP">OBJECTIVES <BR>To promote organic coffee production under natural shade and family organic orchards on the watershed of the Atitlán Lake Multiple Use Protected Area.<BR> This project will give follow-up to ongoing activities to diminish the use of agrochemicals and their environmental impact on the Lake Atitlán protected area and at the same time conserve natural forest used as shade for the coffee plantation.<BR> The inclusion of the family organic orchards will provide options for agrobiodiversity rescue of several species that have local commercial importance and potential.<BR> The organization have mobilized resources from Oxfam-Australia, World Neighbors and governmental solidarity funds to build a coffee factory that will allow a significative improvement on local small coffee producers market access and revenues.<BR></td>
</tr>
<tr>
<td class="tdData1" valign="TOP">Focal Area</td>
<td class="tdData2" valign="TOP">

(IW) International Waters<br>
</td>

</tr>
<tr>
<td class="tdData1" valign="TOP">Operational Programs</td>
<td class="tdData2" valign="TOP">
(9) OP10 - Integrated Land and Water Multiple Focal Area Operational Program<br>

</td>
</tr>

<tr>
<td class="tdData1" valign="TOP">Type of Project</td>
<td class="tdData2" valign="TOP">
(Dem) Demonstration<br>(CB) Capacity-Building<br>(INP) Information Dissemination, Networking and Policy Dialogue<br>

</td>
</tr>
<tr>
<td class="tdData1" valign="TOP">Project State</td>
<td class="tdData2" valign="TOP">
(End) Satisfactorily Completed.<br>

</td>
</tr>

<tr>
<td class="tdData1" valign="TOP">Start Date</td>
<td class="tdData2" valign="TOP">Nov/1999</td>
</tr>
<tr>
<td class="tdData1" valign="TOP">End Date</td>
<td class="tdData2" valign="TOP">Jan/2001</td>
</tr>


<tr>
<td class="tdData1" valign="TOP">Grant Amount $</td>
<td class="tdData2" valign="TOP">$13,552.00</td>
</tr>
<tr>

<td class="tdData1" valign="TOP">Grant Recipient</td>
<td class="tdData2" valign="TOP">(Asociación)<br> Asociación IJA'TZ</td>
</tr>
<tr>

<td class="tdData1" valign="TOP">Grant Recipient Type</td>
<td class="tdData2" valign="TOP">(NGO) Non-government Organization</td>
</tr>

Información sobre el proyecto que no queremos extraer. Y, volvería la información del siguiente proyecto

<tr>
<td class="dtTabHeader" valign="TOP">Region</td>
<td class="dtTabHeader" valign="TOP">Regional Bureau for Latin America and the Caribbean</td>
</tr>
<tr>
<td class="dtTabHeader" valign="TOP">Country</td>
<td class="dtTabHeader" valign="TOP">GUATEMALA</td>
</tr>

El fichero de texto que debéis de generar empezaría de la siguiente manera:

Country#Project Name#Description#Focal area#Operational programas#Type of project#Project state#Start Date#End Date#Grant Amount#Grant Recipient#Grant Recipient Type
GUATEMALA#Agroecological production and commercialization#OBJECTIVES To promote organic coffee production under natural shade and family organic orchards on the watershed of the Atitlán Lake Multiple Use Protected Area. This project will give follow-up to ongoing activities to diminish the use of agrochemicals and their environmental impact on the Lake Atitlán protected area and at the same time conserve natural forest used as shade for the coffee plantation. The inclusion of the family organic orchards will provide options for agrobiodiversity rescue of several species that have local commercial importance and potential. The organization have mobilized resources from Oxfam-Australia, World Neighbors and governmental solidarity funds to build a coffee factory that will allow a significative improvement on local small coffee producers market access and revenues.#(IW) International Waters#(9) OP10 - Integrated Land and Water Multiple Focal Area Operational Program# (Dem) Demonstration(CB) Capacity-Building(INP) Information Dissemination, Networking and Policy Dialogue#(End) Satisfactorily Completed.#Nov/1999#Jan/2001#13552.00#(Asociación) Asociación IJA'TZ#(NGO) Non-government Organization