Line 489: |
Line 489: |
| * examples | | * examples |
| | | |
− | /home/e-smith/configuration | + | /home/e-smith/configuration |
− | AccessType=dialup | + | AccessType=dialup |
− | sshd=service|InitscriptOrder|05|status|enabled | + | sshd=service|InitscriptOrder|05|status|enabled |
| | | |
− | /home/e-smith/accounts | + | /home/e-smith/accounts |
− | jim=user|EmailForward|local|LastName|Morrison | + | jim=user|EmailForward|local|LastName|Morrison |
− | cdrom=system | + | cdrom=system |
− | cgi-bin=url | + | cgi-bin=url |
− | jim.morrison=pseudonym|account|jim | + | jim.morrison=pseudonym|account|jim |
| | | |
− | $hash ; the file containing the variables | + | $hash ; the file containing the variables |
− | /home/e-smith/configuration | + | /home/e-smith/configuration |
− | or /home/e-smith/accounts | + | or /home/e-smith/accounts |
− | shown as /%conf or /%accounts in the panel perl code | + | shown as /%conf or /%accounts in the panel perl code |
| | | |
− | key/value pairs | + | key/value pairs |
− | $key ; AccessType, cdrom, cgi-bin, jim.morrison | + | $key ; AccessType, cdrom, cgi-bin, jim.morrison |
− | $new_value ; dialup, system, url | + | $new_value ; dialup, system, url |
| | | |
− | key/property|value sets | + | key/property|value sets |
− | $key ; sshd, jim, jim.morrison | + | $key ; sshd, jim, jim.morrison |
− | $type ;service, user, pseudonym | + | $type ;service, user, pseudonym |
− | $prop ;InitscriptOrder, EmailForward, account, status | + | $prop ;InitscriptOrder, EmailForward, account, status |
− | $new_value ; 05, local, Morrison, jim, enabled | + | $new_value ; 05, local, Morrison, jim, enabled |
| | | |
− | $hashref ; see below for explanation | + | $hashref ; see below for explanation |
| | | |
| * explanations | | * explanations |
Line 527: |
Line 527: |
| # It returns one on success and undef on failure. | | # It returns one on success and undef on failure. |
| #-------------------------------------------------------------------------- | | #-------------------------------------------------------------------------- |
− | | + | |
| sub db_set (%$$;$) | | sub db_set (%$$;$) |
| my ($hash, $key, $new_value, $hashref) | | my ($hash, $key, $new_value, $hashref) |
Line 544: |
Line 544: |
| # suitable for assigning to a type and properties hash list) | | # suitable for assigning to a type and properties hash list) |
| # or undef if the key does not exist. | | # or undef if the key does not exist. |
− | | + | |
| sub db_get (%;$) | | sub db_get (%;$) |
| my ($hash, $key) | | my ($hash, $key) |
Line 555: |
Line 555: |
| # Takes a reference to a hash and a scalar key and deletes the key. It | | # Takes a reference to a hash and a scalar key and deletes the key. It |
| # returns one on success and undef if the key does not exist. | | # returns one on success and undef if the key does not exist. |
− | | + | |
| sub db_delete (%$;) | | sub db_delete (%$;) |
| my ($hash, $key) | | my ($hash, $key) |
Line 570: |
Line 570: |
| # Takes a reference to a hash, a scalar key and a scalar value and sets | | # Takes a reference to a hash, a scalar key and a scalar value and sets |
| # the type for the key. It returns one on success and undef on failure. | | # the type for the key. It returns one on success and undef on failure. |
− | | + | |
| sub db_set_type (%$$;) | | sub db_set_type (%$$;) |
| my ($hash, $key, $type) | | my ($hash, $key, $type) |
Line 579: |
Line 579: |
| # Takes a reference to a hash and a scalar key and returns the type | | # Takes a reference to a hash and a scalar key and returns the type |
| # associated with the key. It returns undef if the key does not exist. | | # associated with the key. It returns undef if the key does not exist. |
− | | + | |
| sub db_get_type (%$;) | | sub db_get_type (%$;) |
| my ($hash, $key) | | my ($hash, $key) |
Line 599: |
Line 599: |
| # scalar value and sets the property from the value. It returns with | | # scalar value and sets the property from the value. It returns with |
| # the return status of db_set or undef if the key does not exist. | | # the return status of db_set or undef if the key does not exist. |
− | | + | |
| sub db_set_prop (%$$$;) | | sub db_set_prop (%$$$;) |
| (( | | (( |
Line 620: |
Line 620: |
| # hash of all properties for the key. It returns undef if the key or | | # hash of all properties for the key. It returns undef if the key or |
| # the property does not exist. | | # the property does not exist. |
− | | + | |
| sub db_get_prop (%$;$) | | sub db_get_prop (%$;$) |
| my ($hash, $key, $prop) | | my ($hash, $key, $prop) |
Line 634: |
Line 634: |
| # deletes the property from the value. It returns with the return status | | # deletes the property from the value. It returns with the return status |
| # of db_set or undef if the key or the property do not exist. | | # of db_set or undef if the key or the property do not exist. |
− | | + | |
| sub db_delete_prop (%$$;) | | sub db_delete_prop (%$$;) |
| my ($hash, $key, $prop) | | my ($hash, $key, $prop) |
Line 655: |
Line 655: |
| # the scalar key is provided, it prints key=value for that key. It | | # the scalar key is provided, it prints key=value for that key. It |
| # returns one on success or undef if the key does not exist. | | # returns one on success or undef if the key does not exist. |
− | | + | |
| sub db_print (%;$) | | sub db_print (%;$) |
| my ($hash, $key) | | my ($hash, $key) |
Line 667: |
Line 667: |
| # that key. The value is expanded to show properties. It returns one | | # that key. The value is expanded to show properties. It returns one |
| # on success or undef if the key does not exist. | | # on success or undef if the key does not exist. |
− | | + | |
| sub db_show (%;$) | | sub db_show (%;$) |
| my ($hash, $key) | | my ($hash, $key) |
Line 678: |
Line 678: |
| # the scalar key is provided, it prints key=type for that key. It | | # the scalar key is provided, it prints key=type for that key. It |
| # returns one on success or undef if the key does not exist. | | # returns one on success or undef if the key does not exist. |
− | | + | |
| sub db_print_type (%;$) | | sub db_print_type (%;$) |
| my ($hash, $key) | | my ($hash, $key) |
Line 690: |
Line 690: |
| # provided, it prints prop=value for that key. It returns one on success | | # provided, it prints prop=value for that key. It returns one on success |
| # or undef if the key or property does not exist. | | # or undef if the key or property does not exist. |
− | | + | |
| sub db_print_prop (%$;$) | | sub db_print_prop (%$;$) |
| my ($hash, $key, $prop) | | my ($hash, $key, $prop) |