------- Main Script ------- #!/usr/bin/perl -w use strict; use warnings; use Class_t_client_types; our $t_client_types = Class_t_client_types->new(); # ^^^ # I'm using 'our' to make '$t_client_types' globally # available in the main Script. (...) ----- Package ----- package Class_t_client_types; sub inventory { my $self = shift; my $ip = shift; my $id_t_macaddrs = shift; my $id_t_clients; # inventory client_types my $id_t_client_types = $t_client_types->inventory(); # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Perl complains: Global symbol "$t_client_types" requires exp +licit package name at Class_t_clients.pm # this will teturn noop if the client is not yet inventorized my $id_t_status = $query->get_id_t_status_by_id_t_macaddrs($id +_t_macaddrs); # inventory $id_t_clients = cast2db::Class_t_clients->find_or_create( # GLOBAL VARIABLE id_t_macaddrs => $id_t_macaddrs, ip => $ip, id_t_client_types => $id_t_client_types, id_t_status => $id_t_status, ); # set time use POSIX qw(strftime); my $inventory_date = strftime "%Y-%m-%d", localtime; my $inventory_time = strftime "%H:%M:%S", localtime; $id_t_clients->inventory_date($inventory_date); $id_t_clients->inventory_time($inventory_time); $id_t_clients->update; return $id_t_clients; }
In reply to Strange Problems wit Class::DBI by redpantyhose
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |