Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Strange and special comments in OpenXPKI Code in the form ##! 2: "new: class instantiated" in OpenXPKI Code

by ait (Hermit)
on Feb 12, 2021 at 12:16 UTC ( #11128289=perlquestion: print w/replies, xml ) Need Help??

ait has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks,

Trying to setup my very first OpenXPKI but having trouble getting some stuff to work and I can't sit around waiting for answers on the mailing list so I decided to debug the code... (LOL)

I found these comments in the code that look like breakpoints or some sort of debug info in the form:

##! 2: "new: class instantiated" ##! 32: 'worldinfo ' . Dumper $worldinfo

Anybody know what these are and how to use them?

TIA!
Alex

  • Comment on Strange and special comments in OpenXPKI Code in the form ##! 2: "new: class instantiated" in OpenXPKI Code
  • Download Code

Replies are listed 'Best First'.
Re: Strange and special comments in OpenXPKI Code in the form ##! 2: "new: class instantiated" in OpenXPKI Code
by choroba (Archbishop) on Feb 12, 2021 at 12:23 UTC
    Seem similar to Smart::Comments or Devel::Comments, but neither of them uses the prefix ##!.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: Strange and special comments in OpenXPKI Code in the form ##! 2: "new: class instantiated" in OpenXPKI Code
by haukex (Bishop) on Feb 12, 2021 at 12:32 UTC

    It appears to be some custom debugging code implemented in OpenXPKI::Debug. The POD at the bottom of the file describes it a bit.

      Thank you so much haukex you hit the nail on the head!

      Interesting code. In a previous answer choroba mentions other smart comment schemes. Been coding in Perl for many years and I've always thought about doing stuff like this and never knew they existed.

      Material for a larger Meditation...

      I feel there is so much stuff on the CPAN that we don't leverage but there is also a lot of useless and redundant stuff. The add to favourites in meta::cpan is helpful but I don't think many people use it. Not sure how well popularity contest worked for the Debian folks (I switched all my servers to FBSD circa 2006 and have lost track of the Linux world), but maybe if there is some way we can do something similar (yeah, I know, it's probably on the CPAN already but I don't know about it).

      Maybe there exists something we can stick in our code and send some anonymous stats to used modules etc. There's probably tons of security concerns but maybe a command line you could run ad-hoc and send anonymized stats about your Perl code. It would have to be something pretty easy to enable or execute else people won't use it. There could also be some incentive for people to use it, like PerlCoin lol.

      It would also help keep track of people using Perl around the world, how they are using, what they are using from the CPAN, and do away with stupid myths like Perl is dying, Perl is dead, nobody uses Perl, etc.

        Since the CPAN mirror network is being retired and (as I understand it), public CPAN requests are all to go through the www.cpan.org hostname, in theory something could do a peg count of requests for each distribution. I would assume* the Fastly CDN provides basic analytics that would support such a thing.

        * Famous last words.

        – Aaron
        Preliminary operational tests were inconclusive. (The damn thing blew up.)

        I recently found Task::Kensho which isn't exactly what you are talking about but still interesting.

        From the pod:

        Task::Kensho is a list of recommended modules for Enlightened Perl development. CPAN is wonderful, but there are too many wheels and you have to pick and choose amongst the various competing technologies.

        The plan is for Task::Kensho to be a rough testing ground for ideas that go into among other things the Enlightened Perl Organisation Extended Core (EPO-EC).

        The modules that are bundled by Task::Kensho are broken down into several categories and are still being considered. They are all taken from various top 100 most used perl modules lists and from discussions with various subject matter experts in the Perl Community.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11128289]
Approved by marto
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2021-05-18 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (180 votes). Check out past polls.

    Notices?