• Publicidad

Descifrar código

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

Descifrar código

Notapor paopao » 2008-04-16 15:04 @669

Hola nuevamente.

¿Alguien podría ayudarme a entender este pedazo de código?

En especial yo necesito imprimir los valores de los atributos por separado... y no logro entender dónde él hace la operación para que se llene el valor.

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
## additional attribute handling ##

        my @additional_attr = ();
        my @additionalAttributes = getRequiredList('ADDITIONAL_REQUEST_ATTRIBUTES');
        my @additionalAttributesStringType = getRequiredList('ADDITIONAL_REQUEST_ATTRIBUTES_STRING_TYPE');
        my @additionalAttributesDisplayValue = getRequiredList('ADDITIONAL_ATTRIBUTES_DISPLAY_VALUE');

        my $counter = 0;
        foreach my $attribute (@additionalAttributes)
        {
            ## determine the attribute
            my $attVar;
            if($additionalAttributesDisplayValue[$counter])
            {
                $attVar =  gettext ($additionalAttributesDisplayValue[$counter]) ;
            } else {
                generalError(gettext ("The number of ADDITIONAL_REQUEST_ATTRIBUTES must equal the number of ADDITIONAL_ATTRIBUTES_DISPLAY_VALUE in the configuration."));
            }
            my $tempAttribute = uc $attribute;

            ## determine the content type
            my $stringType = "LATIN1_LETTERS";
            if ( $additionalAttributesStringType[$counter])
            {
                $stringType = $additionalAttributesStringType[$counter];
            }

            ## build the attribute list
            push @additional_attr , [
                $attVar, $query->newInput ( -regx     => $stringType,
                                            -intype   => 'textfield',
                                            -size     => 30,
                                            -name     => 'ADDITIONAL_ATTRIBUTE_'.$tempAttribute,
                                            -optional => 1,
                                            -check    => 'fill',
                                            -default  => $query->param ('ADDITIONAL_ATTRIBUTE_'.$tempAttribute)
                                            )
                                    ];
            $counter ++;
        }
Coloreado en 0.005 segundos, usando GeSHi 1.0.8.4



Será en la parte que dice ## build the attribute list... nosotros hemos probado colocando la opción -values => $query->param ('parametro') pero no sale nada en la impresión...

Ese mismo método lo utilicé para las otras variables y sí me funciona...

Bueno, espero sus comentarios.
paopao
Perlero nuevo
Perlero nuevo
 
Mensajes: 18
Registrado: 2008-02-08 13:44 @614

Publicidad

Notapor Jenda » 2008-04-19 18:24 @808

¿Qué tipo de objeto es $query? No parece ser CGI.pm. Ejecuta print "\n\nquery is $query\n\n"; si no lo sabes.

Tienes que ver la documentación de ese módulo.
-------------------------------------------------------
- Estoy aquí para practicar español. Si te ayudó mi respuesta ayudame con un mensaje privado sobre mis faltas por favor. Seguramente habrá muchas :-)
Jenda
Perlero nuevo
Perlero nuevo
 
Mensajes: 132
Registrado: 2007-10-29 06:31 @313
Ubicación: Praga, Republica Checa


Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 17 invitados

cron