Hy there When I execute the Script Perl complains: "Global symbol "$t_client_types" requires explicit package name at Class_t_clients.pm" even though I declared the variable "$t_client_types" with 'our' in the Main Script. Can someone explain this behaviour to me ? Thank's Denis
------- 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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.