Diff -- /var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/_debug_tmpl2.cgi

O Operator
Diff

/var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/_debug_tmpl2.cgi

added on local at 2026-07-01 12:35:19

Added
+86
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 6b2cd2269e24
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1#!/usr/bin/perl
2
3##################################################################################################################################
4# ______ ____ ____ ______ ______ ____ ___ __ ___ ______ _ __ ____ ____ __ __ _ __ _____ ____
5# / ____// __ \ / __ \ / ____/ / ____// __ \ / | / |/ // ____/| | / // __ \ / __ \ / //_/ | | / /|__ / / __ \
6# / / / / / // / / // __/ / /_ / /_/ // /| | / /|_/ // __/ | | /| / // / / // /_/ // ,< | | / / /_ < / / / /
7# / /___ / /_/ // /_/ // /___ / __/ / _, _// ___ | / / / // /___ | |/ |/ // /_/ // _, _// /| | | |/ / ___/ /_ / /_/ /
8# \____/ \____//_____//_____/ /_/ /_/ |_|/_/ |_|/_/ /_//_____/ |__/|__/ \____//_/ |_|/_/ |_| |___/ /____/(_)\____/
9#
10# - Written by: Shawn Pickering
11# - shawn@shawnpickering.com
12##################################################################################################################################
13use strict;
14use lib '/var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com';
15
16
17#############################################################
18## Variables
19#############################################################
20
21
22
23############################################################
24# Modules
25############################################################
26use MODS::Template;
27my $tfile = new MODS::Template;
28
29
30
31############################################################
32# Program Controls
33############################################################
34$|=1;
35&debug_gantt_render;
36
37
38############################################################
39# Subroutines
40############################################################
41sub debug_gantt_render{
42 #Dev diagnostic - captures + prints the template's compiled Perl code so we can
43 #eyeball what's actually being eval'd for the tf_gantt.html template
44 print qq~Content-Type: text/plain\n\n~;
45
46 #Monkey-patch to capture the eval code + error
47 {
48 no warnings 'redefine';
49 *MODS::Template::run_in_memory = sub {
50 my($code, $tvars) = @_;
51 our $tvars_test = $tvars;
52 print "---- CODE (", length($code), " chars) ----\n";
53 print substr($code, -2000), "\n"; #Last 2000 chars
54 my $r;
55 {
56 no strict;
57 $r = eval $code;
58 }
59 print "---- EVAL RESULT ----\n";
60 if($@){print "ERR: $@\n";}
61 else {print "len=", length($r // ''), "\n"; print "out:", substr($r // '', 0, 400), "\n";}
62 return $r;
63 };
64 }
65
66 my $tvars = {
67 proj_id => 1, proj_name => 'X', proj_color => '#fff',
68 has_tasks => 1, tasks => [{ id => 1, ticket_number => 1, title => 't1', display_ticket => 'X-1',
69 bar_left => 10, bar_width => 100, bar_color => '#fff', bar_left_css => '10px', bar_width_css => '100px',
70 progress_pct => 50, assignee_initials => '', assignee_color => '#fff' }],
71 bar_area_width => 500,
72 bar_area_width_css => '500px',
73 today_offset => 50,
74 today_offset_css => '50px',
75 months => [{ label => 'Jun', offset => 0, offset_css => '0px' }],
76 days => [{ label => '1', is_weekend => 0 }],
77 total_days => 30,
78 px_per_day => 28,
79 px_per_day_css => '28px',
80 min_date => '2026-06-01',
81 };
82
83 my $out = $tfile->template('tf_gantt.html', $tvars, undef);
84 print "---- FINAL ----\n";
85 print substr($out // '', 0, 500), "\n";
86}