Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Importing constans and variables when "require"ing

by Perlbotics (Archbishop)
on Feb 22, 2019 at 21:58 UTC ( [id://1230430]=note: print w/replies, xml ) Need Help??


in reply to Importing constans and variables when "require"ing

use const does it's trick by creating a sub that returns a then "constant" value. Use the function call parents to honour that fact in the context of the print statement at compile time.

print "CONST=" . XYZ::CONST() . "\n"; # ^^-here

Replies are listed 'Best First'.
Re^2: Importing constans and variables when "require"ing
by bliako (Monsignor) on Feb 22, 2019 at 22:53 UTC

    ok that's a neat trick

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-24 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found