Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Yet another config file editing programme : Tell me how to make it better !

by tybalt89 (Monsignor)
on Sep 08, 2021 at 04:33 UTC ( [id://11136551]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Yet another config file editing programme : Tell me how to make it better !
in thread Yet another config file editing programme : Tell me how to make it better !

domain_name_servers does not exist in your input file. There is domain_name_server_2 and domain_name_server_1 instead.
Just a name mismatch.

Replies are listed 'Best First'.
Re^4: Yet another config file editing programme : Tell me how to make it better !
by dazz (Beadle) on Sep 08, 2021 at 20:52 UTC
    Hi

    Thanks for reviewing the code.
    The input file includes 2 lines for DNS that are converted to one line for the dhcpcd.conf output file.
    This happens in the code under the comment  # Convert 2 lines DNS to 1 line DNS


    The error message reports that hash value $1 isn't initialised. This is confirmed by the test print statement immediately prior.
    I think the code should be stepping through the hash but I don't know how that should be done in the context of this code. Is it implied, or should it be explicitly stated?



    Dazz

      You print out all that nice debug from Data::Dump and yet you don't show it here :)

        Hi
        Here is the printout after running the program.
        I have added some hand typed comments out towards the right of the print out.
        $ perl ip3.pl ( "ip_params", # This is confirming the input +file has been correctly read. { domain_name_server_1 => "8.8.8.9", domain_name_server_2 => "8.8.4.9", interface => "eth0", ip_address => "192.168.10.9/24", routers => "192.168.9.91", }, ) ( "ip_params", # This is confirming that the f +ormat is correct for the output file. { domain_name_servers => "8.8.8.9 8.8.4.9", interface => "eth0", ip_address => "192.168.10.9/24", routers => "192.168.9.91", }, ) found section for eth0 at line 8 Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 73, <> line 9. ip param key : # a print of the hash key $0 is + blank Use of uninitialized value $1 in hash element at ip3.pl line 74, <> li +ne 9. Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 74, <> line 9. ip param val : # printing the hash value $1 is + blank. set ip_address to 192.168.10.9/24 Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 73, <> line 10. ip param key : Use of uninitialized value $1 in hash element at ip3.pl line 74, <> li +ne 10. Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 74, <> line 10. ip param val : set routers to 192.168.9.91 Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 73, <> line 11. ip param key : Use of uninitialized value $1 in hash element at ip3.pl line 74, <> li +ne 11. Use of uninitialized value within %ip_params in concatenation (.) or s +tring at ip3.pl line 74, <> line 11. ip param val : set domain_name_servers to 8.8.8.9 8.8.4.9 ending changes at line 12

        So I can't figure out where or how $1 should be initiated.

        Dazz

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136551]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found