Is there a tool for extracting all variable, module, and function names from a Perl module file?


My apologies if this is a duplicate; I may not know the proper
terms to search for.


I am tasked with analyzing a Perl
module file (.pm) that is a fragment of a larger application. Is there
a tool, app, or script that will simply go through the code and pull
out all the variable names, module names, and function calls? Even
better would be something that would identify whether it was declared
within this file or is something external.


Does such a
tool exist? I only get the one file, so this isn't something I can
execute -- just some basic static analysis I guess.

My apologies if this is a duplicate; I may not know the proper
terms to search for.


I am tasked with analyzing a Perl
module file (.pm) that is a fragment of a larger application. Is there
a tool, app, or script that will simply go through the code and pull
out all the variable names, module names, and function calls? Even
better would be something that would identify whether it was declared
within this file or is something external.


Does such a
tool exist? I only get the one file, so this isn't something I can
execute -- just some basic static analysis I guess.

Programming Languages

I've written a perl module (say foo), with one primary
subroutine (say f()), which I want to use in two
ways:


Import module foo , then call the sub
f(...) from the script importing module
foo.
Just import module foo and get
module foo to call the sub f(@ARGV) or some
appropriate variation.

Can I make one module which has these
two options,
or
Should I make a wrapper module, say
foo_default.pm, which will use foo and then
calls foo::f(@ARGV)?

Programming Languages

I have a variable in my main module which is changed using another
module, but I want to change the variable from my main module through
another module. I'm new to programmering, so I actually don't really
know how to explain this stuff - sorry if I'm asking a stupid
question.


The program's hierarchy looks a bit like
this:


Main

---Features />
---Pygame_handling

------Features


I use the
"Features" module to change a variable in the "Main". I do this simply
by getting the defined variable from "Features". But when I change the
variable through "Pygame_handling", it is not changed in the
"Features" object

Programming Languages

I'd like to define a helper function that has the ability to modify
a module-level variable (with known name) from surrounding context
without explicitly passing it, e.g.


# mod1.py />mod_var = 1
modify_var()
# mod_var modified
print
mod_var

The problem is - I can't reference
variable by mod1.mod_var, because I want to use helper
function across many modules (helper itself will be defined in other
module); it should dynamically 'pick' mod_var from surrounding calling
context/scope.


Is this possible? How to obtain
this?


My use case is to enhance defining URL -> vie

Programming Languages

The perl scripts contain all the module names in the beginning of
the script.


Ex:


use strict;
use
XML::Parser;
use XML::Simple;
use DBI;
use
DBD::DB2::Constants;
use POSIX qw( strftime );
use Storable
qw(dclone);
use Data::Dumper;
use Carp;
/>

How to keep all the module names in another file and include the
file in main perl script ?


Thanks.

Programming Languages

Can Config::Simple work with properties file with variable
assignment, e.g.:


server_name=myapp.com />home_url=${server_name}/home/index.html />login_url=${server_name}/login/
Programming Languages

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow