Perl: How to load some functions automaticaly, starting Perl inteructively (with -d -e 0)?


 
Thread Tools Search this Thread
Top Forums Programming Perl: How to load some functions automaticaly, starting Perl inteructively (with -d -e 0)?
# 1  
Old 08-25-2014
Perl: How to load some functions automaticaly, starting Perl inteructively (with -d -e 0)?

I would like to use Perl in 'interactive' mode (kind off), starting it by
> perl -d -e 0;

But I need to have some function be read on loading.
Also, it should not be for anyone who starting Perl or use it any how.
I did try to search, but not much result.
I have try a file '.perldb': seems, perl did try to read that (complained on permission mode), but no defined functions available after that.

By now I only able to load functions by (having all them in .perldb)
Code:
   DB<#> do('.perldb');

command, but it is uncomfortable, starting from different locations...,
and I would like to have the file to be load automaticaly when I starting the perl in debug mode.

I guess, Perl should have such possibility.

I would appreciate your help!
# 2  
Old 09-29-2014
(No any reply on pretty simple question: not many Perl developers?)

Finally, I am using such way:
- file named as a Perl module: with 'pm' in extension.
- Starting Perl in 'interactive' mode I use -M<module_name> and -I<dir_name>
- if I need it in some Perl-script that stared with sheband #!/usr/bin/perl I have on that line additionaly -I<dir_name> and one of starting line:
USE <module_name>

So, the <module_name> is the file name without the .pm extension, and
-I<dir_name> is including to @INC array the directory of the file, allowing the Perl to search for the module (under USE) in that directory.

And, finaly, to avoid typing for starting Perl interactively, I use alias with those -I<dir> and -M<mdl>
This User Gave Thanks to alex_5161 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Perl: restrict perl from automaticaly creating a hash branches on check

My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence. I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have ... (2 Replies)
Discussion started by: alex_5161
2 Replies

2. Shell Programming and Scripting

Need help figuring out how to create sharable functions in Perl

I am somewhat new to Perl. I have Googled Perl one liners and worked with the MIME::Lite library to send emails with attachments. But I have not done any real Perl scripting. I need to write a script to install code for our application using an Oracle database with DBI, and to track in the... (4 Replies)
Discussion started by: gandolf989
4 Replies

3. Shell Programming and Scripting

Perl script to Archive the data file after the load

I have written a perl scripts which loads the data. Now i want to modify the script, to Archive the Input file after the successful load of data. Can anyone please share it and help me .... Thanks. (2 Replies)
Discussion started by: msrahman
2 Replies

4. Shell Programming and Scripting

Perl script to load data by calling sqlldr

Hello all, I know this is Unix forum, but i also know that there are some experts here who can help me out with this situation; I am loading a data file into oracle table using Perl script by calling sqlldr script. It does not do anything, and no data is getting loaded. Any help,... (2 Replies)
Discussion started by: msrahman
2 Replies

5. Shell Programming and Scripting

How to load a hash with a file in Perl

Hi to everybody. I have a script in AWK with a revursive function, when I make the recursive call I'm loosing values in the local variables. So I'm trying to do the script in Perl, but I don't know Perl. I want to load several hashes with the data in a pipe separated file. In AWK it looks... (0 Replies)
Discussion started by: kcoder24
0 Replies

6. Shell Programming and Scripting

Perl script to find where functions is called in c

Hello, I need to write a perl script to find where functions is called in c files.. The script should scan the file and find out the function names and then search to see where they are called... Lets for now assume all functions are internal. I don't know where to start :( ... (4 Replies)
Discussion started by: bojomojo
4 Replies

7. UNIX Desktop Questions & Answers

gtk2-perl load error help

I write this code. It show the first dialog correctly. but, no matter i modify the code(load module by use or require, or something i think maybe error) it can't pop-up anymore. and show this warning. Thanks. (I'm sorry for my English.) Tue Mar 16 17:24:36 2010 ... (0 Replies)
Discussion started by: snyh
0 Replies

8. Shell Programming and Scripting

perl - passing hash references to functions

hi there I have the following script in which i have created a PrintHash() function. I want to pass to this function the reference to a hash (in the final code i will be passing different hashes to this print function hence the need for a function). I am getting an error Type of arg 1 to... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

9. Shell Programming and Scripting

Perl script to load text file into DB field

Hello, maybe this post is offtopic, sorry for the inconveniencies (maybe should be in the forum with questions about C, C++, Java, SQL...). I found examples about how to populate different fields from a text file (with MySQL, the LOAD DATA INFILE sentece), but not about how to load a complete... (2 Replies)
Discussion started by: aristegui
2 Replies

10. Shell Programming and Scripting

perl functions and arrays

Hi, First I will tell my objective of this function (function one). I have a table for ex: id passwd name -- ------ ----- 1 fdhgfs werwer 2 fsdfs sdfsdf 3 sdfs sdfsdf 4 fdsfs dssdf . . . . . . The id, passwd and name are the arguments for another function say two. (1 Reply)
Discussion started by: mercuryshipzz
1 Replies
Login or Register to Ask a Question