Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

globals and current scope

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Other question. I want to know what are the global variables and variables available in current scope. Is there a way to do that? (I mean not listing the source code, but just printing them on the output)

Ion Filipski
1c.bmp
 
Reading the source should be enough, if you're using use strict. The my directive states that the variable being declared is visible only to that block, so a variable declared within a subroutine, while it can have the same name is visible only to that block of code/function/if statement/while statement.

There may be utilities to dump the namespace of a program, or the debugger may be able to do this, but given that the code is interpreted it's unlikely, but I'm ready to learn to the contrary as they say ;-)

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
I can't use or not to use strict. This is a big application what already is done by something else. I have only to fix bugs and to do small changes in the program. There are many including directives, with many variables.

Ion Filipski
1c.bmp
 
are you using any kind of an IDE? If not, you probably want to start using one. I think there is a list of perl IDE's in the perl FAQs.
 
The only IDE available there is vi editor. And I want to output all the variables in the browser, so I could view them. At least at once.

Ion Filipski
1c.bmp
 
Ion

There is a module called Padwalker that might do what you want. It doesn't work on Activestate, but might help you out as it sounds like you are on *nix.
Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top