package Label; use strict; use warnings; use Data::Dumper; use Time::Local; # Load the Time::Local module use Globals qw( $DEBUG $label_file $labelsettings ); sub WriteoutLabel { print "Label line 31 - Debug: \$DEBUG is " . ($DEBUG ? "enabled" : "disabled") . "\n"; my ($active_modules_ref) = @_; # Skip label generation if labelsdisplay is disabled my $labels_display = $Globals::modules{'labels'}{'labelsonoff'} // 1; # Default to 1 (enabled) return unless $labels_display; print "Label line 39 - Debug: Labels display is " . ($labels_display ? "enabled" : "disabled") . "\n" if $DEBUG; # Debug: Check that active_modules_ref is a hash reference unless (ref $active_modules_ref eq 'HASH') { print "Label::WriteoutLabel - Received invalid active_modules_ref: " . (ref $active_modules_ref || 'undefined') . "\n" if $DEBUG; die "Error: active_modules_ref is not a HASH reference."; } ...