Frage

I am struggling with posting Perl data using LWP.

Here is my code

$req = POST $url, [
    SESSID => $sessid,
    csrf => $csrf,
    domainid => '1234567',
    type => 'A',
    default => '0',
    record-type => 'A',
    a-record%5B%5D => '12.12.12.12',
     aaaa-record => '',
     cname-record => ''
];

The code is obviously failing at a-record%5B%5D. How do I make this Perl compliant?

I already tried 'a-record%5B%5D' ; a-record\%5B\%5D ; a-record[] ; a-record\[\]; a-record\%5B\%5D

From my understanding, the field name of the form is indeed <input id="a0" class="left" type="text" value="11.11.11.11" name="a-record[]">

War es hilfreich?

Lösung

You can't use anything but ordinary letters, underscore and digits on the left hand side, if you aren't quoting:

$req = POST $url, [
    SESSID           => $sessid,
    csrf             => $csrf,
    domainid         => '1234567',
    type             => 'A',
    default          => '0',
    'record-type'    => 'A',
    'a-record%5B%5D' => '12.12.12.12',
    'aaaa-record'    => '',
    'cname-record'   => ''
];

Now that was the syntax issues in the code.

Also, take a look at perlsyn for hints on how to format perl code.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top