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 8299129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:02:16+00:00 2026-06-08T16:02:16+00:00

Pragmas, like autodie , according to the docs, are lexically scoped. { use autodie;

  • 0

Pragmas, like autodie, according to the docs, are lexically scoped.

{
use autodie;
  ..
  ..
}
# Can die here

Does this apply to all modules loaded with use?
As far as I know, use is almost the same as:

BEGIN {
  require autodie;
  autodie->import(LIST);
}

BEGIN happens at compile time, and require is not lexically scoped. So how is autodie aware of its scope?

  • 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-08T16:02:18+00:00Added an answer on June 8, 2026 at 4:02 pm

    The short answer is that lexically-scoped pragmatic modules are explicitly written to behave that way, and use the magical internal variables $^H and %^H during compile time to enable and disable features.

    The compiler plays its part by implicitly localising these variables so their value is restored at the end of compiling a code block to what it was at the start. In that way it provides the basis of lexical semantics.

    Originally only the $^H variable was available. It contains a bit mask that dictates which compiler options are available at any time during the compilation. Because of that the only lexical pragmas that could be written were ones that manipulated the defined set of magic bits in $^H.

    Later the %^H hash was introduced, and any pragma can now store values in this hash with keys that start with the name of the pragma. Because the compiler localises the hash in the same way as the scalar, any pragma can store automatically scoped status information here.

    The autodie module doesn’t manipulate either of these variables, but subclasses the Fatal module which does all the hard work. It uses %^H to keep track of which operators have been made fatal, and relies on the compiler to discard this information at the end of the block.

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

Sidebar

Related Questions

Are g_hash_table_lookup and g_hash_table_insert thread-safe? Can I use code like this: dict = g_hash_table_new();
If I use nested parallel for loops like this: #pragma omp parallel for schedule(dynamic,1)
Is it ok to use omp pragmas like critical, single, master, or barrier outside
I have a loop in my C++/OpenMP code that looks like this: #pragma omp
I wrote class like this: #pragma once #include stdafx.h struct Date { private: int
I write UISearchBar in my TopBar.m like this: _tempSearchBar =[[UISearchBar alloc]initWithFrame:CGRectMake(44, 0, 320 -
First for all I would like to start by saying I am relatively new
I have a basic C++ class .The header looks like this: #pragma once class
This is my first attempt to inline Java code in Perl. We cannot use
I am having trouble applying openmp to a nested loop like this: #pragma omp

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.