Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Tests were run but no plan was declared and done_testing() was not seen.

by choroba (Cardinal)
on Jul 10, 2015 at 23:35 UTC ( [id://1134283]=note: print w/replies, xml ) Need Help??


in reply to Re: Tests were run but no plan was declared and done_testing() was not seen.
in thread Tests were run but no plan was declared and done_testing() was not seen.

You can use Syntax::Construct to find out, or even to tell Perl and fellow programmers reading your code:
use Syntax::Construct qw{ auto-deref };
End of blatant boasting plug
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^2: Tests were run but no plan was declared and done_testing() was not seen.
  • Download Code

Replies are listed 'Best First'.
Re^3: Tests were run but no plan was declared and done_testing() was not seen. (Syntax::Construct)
by toolic (Bishop) on Jul 13, 2015 at 13:50 UTC
    Syntax::Construct looks like a useful tool. All useful tools should be promoted.

    However, after reading the POD, it is not clear to me why I should use it. I understand that I can add this line to a Perl file...

    use Syntax::Construct qw( // ... /r );
    and it will give me a message like:
    Unsupported construct /r at ... line ... (Perl 5.014)
    I am running on Perl version 5.12. Is this telling me that the /r construct was added in Perl version 5.014? If so, I find that very helpful. However, can you elaborate on the qw( // ... /r )? It's not clear from the POD why you chose that. Is that guaranteed to cover all the constructs supported by the module?

    Regarding use Syntax::Construct qw{ auto-deref };, if I am using 5.14 (which supports keys EXPR), does this alter the behavior of my code with keys $foo?

      The answer to your first question is Yes. Maybe I should add "needed" after the version?

      The three constructs shown in the Synopsis are the ones needed in the example code there. It's the programmer's responsibility to track them and list them. So yes, the human factor is the weakest part of the system.

      Under 5.14, keys $ref already work without any switch. Specifying use Syntax::Construct qw{ auto-deref }; wouldn't change anything for you running on 5.14 (or higher), but it would give meaningful error messages to you or anyone else trying to run it on 5.12 and below. For keys $ref, the default message isn't so bad:

      Type of arg 1 to keys must be hash (not scalar dereference)

      but for example for $x //= 1, I'm getting

      Search pattern not terminated

      in 5.8.3.

      It's in fact a triple-win situation:

      1. You win as the programmer, as you have all the constructs in one place (i.e. Syntax::Construct's documentation) and you don't waste your time searching through perldeltas and other places.
      2. Users of your modules win as they get meaningful error messages telling them to what Perl version they need to upgrade.
      3. The programmer they hired to workaround the problem wins as they know what constructs to replace in the code to make it run in the ancient version.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Thanks for the information. I think some text along these lines would make a good addition to the DESCRIPTION section of your POD. To me, it really explains why someone should use this module.

        Another question: is it possible via the command line to enable all features? For example:

        perl -MSyntax::Construct=all code.pl
        I see this as a valuable debug and development tool. If I inherit someone's code (which doesn't use Syntax::Construct), and I get a cryptic message, I could edit the code and add the Syntax::Construct line. But, I'd have to know which construct gave me the message, and I'd have to edit the code (neither of which is desirable). Or am I abusing this tool?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1134283]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found