Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:25:01+00:00 2026-06-12T20:25:01+00:00

I am calling many Perl scripts in my Bash script (sometimes from csh also).

  • 0

I am calling many Perl scripts in my Bash script (sometimes from csh also).

At the start of the Bash script I want to put a test which checks if all the Perl scripts are devoid of any compilation errors.

One way of doing this would be to actually call the Perl script from the Bash script and grep for “compilation error” in the piped log file, but this becomes messy as different Perl scripts are called at different points in the code, so I want to do this at the very start of the Bash script.

Is there a way to check if the Perl script has no compilation error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:25:02+00:00Added an answer on June 12, 2026 at 8:25 pm

    Beware!!

    Using the below command to check compilation errors in your Perl program can be dangerous.

    $ perl -c yourperlprogram
    

    Randal has written a very nice article on this topic which you should check out

    • Sanity-checking your Perl code (Linux Magazine Column 91, Mar 2007)

    Quoting from his article:

    Probably the simplest thing we can tell is “is it valid?”. For this,
    we invoke perl itself, passing the compile-only switch:

    perl -c ourprogram
    

    For this operation, perl compiles the program,
    but stops just short of the execution phase. This means that every
    part of the program text is translated into the internal data
    structure that represents the working program, but we haven’t actually
    executed any code. If there are any syntax errors, we’re informed, and
    the compilation aborts.

    Actually, that’s a bit of a lie. Thanks to BEGIN blocks (including
    their layered-on cousin, the use directive), some Perl code may have
    been executed during this theoretically safe “syntax check”. For
    example, if your code contains:

    BEGIN { warn "Hello, world!\n" } 
    

    then you will see that message,
    even during perl -c! This is somewhat surprising to people who
    consider “compile only” to mean “executes no code”. Consider the
    code that contains:

    BEGIN { system "rm", "-rf", "/" } 
    

    and you’ll see the problem with
    that argument. Oops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model which I'm calling many times from Python. The model takes
How many InsertOnSubmit should I call before calling SubmitChanges ? I'm adding data from
I'm trying to index many hundrets of web-pages. In Short Calling a PHP script
I have many methods which are calling using Delegate.DynamicInvoke . Some of these methods
I have noticed many code examples of calling a web service which returns json
I have many scripts in a directory that all start with deploy_ (for instance,
I'm calling a .net webservice from Linux using Perl (5.8.7). I'm using the SOAP::Lite
I have a crash from releasing an object too many times and calling it
I have a javascript calling a javascript interface many times (around 500 times sometimes),
We have a .NET application (VB / VS2010) and are calling many stored procedures

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.