I am not familiar with the module but from a quick look at the docs it seems that, in order to implement callbacks, you need to create your own class which inherits from Verilog::Preproc. To experiment, you could add a couple of lines to your script like this (untested):
#!/usr/bin/perl use Verilog::Getopt; use Verilog::Preproc; my $opt = new Verilog::Getopt; @ARGV = $opt->parameter(@ARGV); # call new on derived class my $vp = My::Verilog::Preproc->new(options=>$opt); $vp->open(filename=>"../common/tiri_defines.vh"); while (defined (my $line = $vp->getline())) { print $line; } package My::Verilog::Preproc; # define derived class use parent qw(Verilog::Preproc); # inherit from Verilog::Preproc sub define { my $self = shift; my $defname = shift; my $value = shift; my $params = shift; print "defname = $defname\n"; print " value = $value\n"; print " params = $params\n"; } sub def_exists { my $self = shift; my $defname = shift; print "DEF_EXISTS\n"; } 1;

In reply to Re: Verilog Preproc callbacks by tangent
in thread Verilog Preproc callbacks by richmaes

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.