I don't have any Macs so I tested on a PC.

I modified your code to get rid of the evals. With some luck, this may fix your (unidentified) problem.

#!/usr/bin/env perl use strict; use warnings; use POSIX; use Tk; my %pid; %pid=( DCDC_A_51=>{cmd=>'22 46 5B', cu=>'51', desc=>'DC/DC output curren +t t30', unit=>'A', d=>2, formula=>sub{sprintf("%.2f", U1 +6(1,4)/16)}}, DCDC_V_51=>{cmd=>'22 46 5C', cu=>'51', desc=>'DC/DC output voltag +e t30', unit=>'V', d=>2, formula=>sub{sprintf("%.2f", U1 +6(25,253)/512)}, val=>'---'}, DCDC_W_51=>{ desc=>'DC/DC power output' +, unit=>'W', action=>sub{sprintf("%.0f", ($ +pid{DCDC_V_51}{val} * $pid{DCDC_A_51}{val}))}, val=>'---'} ); my $mw=MainWindow->new(); $mw->Button(-text=>" Test ", -command=>sub{test()}, -font=>'Helvet +ica 18 bold', -pady=>20)->pack(); MainLoop; sub test { $pid{DCDC_V_51}{val}=$pid{DCDC_V_51}{formula}->(); print $pid{DCDC +_V_51}{val} ."\n"; $pid{DCDC_A_51}{val}=$pid{DCDC_A_51}{formula}->(); print $pid{DCDC +_A_51}{val} ."\n"; $pid{DCDC_W_51}{val}=$pid{DCDC_W_51}{action}->(); print $pid{DCDC_W_51}{val} ."\n"; } sub U16 { my($a,$b)=@_; return ($a*256+$b); }

                "These opinions are my own, though for a small fee they be yours too."


In reply to Re: weird problem with macports perl on apple m1/m2 based system by NetWallah
in thread weird problem with macports perl on apple m1/m2 based system by perltux

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.