netreg-devel: Question about a subtle bug.

Sean Spillane sean.russell.spillane at gmail.com
Wed Nov 15 17:32:40 EST 2006


Hi! I'm trying to make an API call to CMU::Netdb::modify_machine() and I am
running into trouble. I pass in the following as arguments to the function:

   - A DB hash from CMU::Netdb::lw_db_connect()
   - 'netreg', which I think is the UID that the DB wants
   - The ID number for the machine. (40637 in this case)
   - The last version string for the machine.
   - A hashref containing
      - id => '40637'
      - expires => '2006-10-15'

I think that this is the correct calling style, but I run into trouble from
a weird place. Inside the CMU::Netdb::add_mod_machine_static() function
(Yes, the machine is static), I get an error:
/home/netreg/lib/CMU/Netdb/machines_subnets.pm:1422 :>Couldn't find
machine.ip_address_ttl!
$VAR1 = {
          'ip_address_ttl' => '0',
          'mode' => 'static',
          'comment_lvl9' => '',
          'mac_address' => '000D56988A3C',
          'host_name_ttl' => '0',
          'ip_address_subnet' => 278,
          'id' => '40637',
          'ip_address' => '169.226.142.86',
          'comment_lvl5' => '',
          'flags' => '',
          'version' => '2004-09-24 10:05:42',
          'account' => '',
          'host_name_zone' => '143',
          'ip_address_zone' => '144',
          'created' => '2004-09-24 10:05:42',
          'comment_lvl1' => '',
          'host_name' => 'MSUTHERLANDOFF.BA.ALBANY.EDU',
          'fuckall.ip_address_ttl' => 42,
          'expires' => '2006-10-15'
        };
$VAR2 = [
          'id',
          'mac_address',
          'host_name',
          'ip_address',
          'mode',
          'flags',
          'comment_lvl1',
          'comment_lvl5',
          'comment_lvl9',
          'account',
          'host_name_ttl',
          'ip_address_ttl',
          'host_name_zone',
          'ip_address_zone',
          'ip_address_subnet',
          'version',
          'created',
          'expires'
        ];

Notice how the @machine_fields array that is referenced by the function
($VAR2 above) seems to have lost the "machine." prefixes on each of its
fields. I cannot figure out why. When I explicitly redeclare the variable as
a my variable and set it to @CMU::Netdb::structure::machine_fields, the
problem goes away. I therefore suggest that, since no mention was made that
no one can modify @CMU::Netdb::structure::machine_fields and there is at
least one place in CMU::Netdb::list_machines() where an unshift does modify
it, that a my variable be included in the header of
CMU::Netdb::add_mod_machine_static(), setting it to
@CMU::Netdb::structure::machine_fields. Doing this seems to solve the
problem, though perhaps I am just calling the function incorrectly. Can you
folks help me? I need to know what I should do.
-- 
Sean Spillane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/netreg-devel/attachments/20061115/252c5a01/attachment.html


More information about the Netreg-devel mailing list