Sorry... here's code
struct Dlayer => { name => '$', drl_start => '$', drl_end => '$', tool => '%', }; struct Tool => { bit => '$', finish => '$', tol => '$', type => '$', ptholes => '$', count => '$', ar => '%', }; struct AR => { value => '$', ranges => '$', }; sub Dlayer::addtool { my $this = shift; my($s,$bit,$f,$tol,$is_plated,$c,$ar) = @_; my $nt = new Tool; $nt->bit($bit); $nt->finish($f); $nt->tol($tol); $nt->ptholes($is_plated); $nt->count($c); my $h = $this->tool; $h->{$s} = $nt; $this->tool($h); $nt; }

And I access the data like this

#build the drill data structure foreach my $d ( @d_layer_list ) { my $do = new Dlayer; $do->name($d->{name}); $do->drl_start($d->{drl_start}); $do->drl_end($d->{drl_end}); set_d_vals($do,$d->{name}); push(@drill_arr,$do); } foreach my $o ( @drill_arr ) { while (my ($k,$t) = each %{$o->tool} ) { printf SESAME "Drill: %s %s %s %s\n", $o->name, $t->bit, $ +o->drl_start, $o->drl_end; # print SESAME "Drill: $o->{name} $t->{bit} $o->{drl_start +} $o->{drl_end}\n"; print SESAME "\t$drill_str{size} = $k\n"; foreach my $c ( keys %{$t} ) { # print Dumper($c); if ( $OS eq "hpux" ) { printf(SESAME "\t%s = %s\n", $drill_str{$c}, $t->{ +$c}) unless $c eq "ar" || $c eq "bit" || $c eq "type"; } else { my $pruned = $c; $pruned =~ s/Tool:://; printf(SESAME "\t%s = %s\n", $drill_str{$pruned}, +$t->$pruned) unless $pruned eq "ar" || $pruned eq "bit" || $pruned eq + "type"; } } } }

Sorry if I missed something... my brain is really becoming frazzled by this. If I get it to work on one platform I find I have broken something else on the other...


In reply to Re: class::struct compatibility by Anonymous Monk
in thread class::struct compatibility by Anonymous Monk

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.