![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Install Perl Module | hari.jnvc90 | SUN Solaris | 1 | 03-05-2008 10:08 AM |
| Can I use a Perl Module without installing it? | jjinno | Shell Programming and Scripting | 1 | 08-29-2007 01:55 PM |
| help with perl module installation | sabyasm | UNIX for Advanced & Expert Users | 2 | 01-04-2007 09:13 AM |
| PERL DBI module install | jerardfjay | Shell Programming and Scripting | 3 | 10-27-2006 10:29 AM |
| Replace Perl Module name in all Perl scripts | rahulrathod | Shell Programming and Scripting | 2 | 12-02-2005 01:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Yes. Perl modules have the extension ".pm" instead of the regular ".pl". Each Perl module is a class, in object-oriented programming (OOP) terms.
However, writing Perl modules require higher levels of Perl knowledge. In particular, you need to be proficient with references. Then, you can find more about writing Perl modules in the perlobj and perltoot manpage. But I guess these manpages are generally not easy to read. You should find a guidebook somewhere that talks about that. I can't tell you much about this here because this is not something I can explain with just a few lines of code and description. But if you just want to keep your functions in a separate file without adopting an OOP style, the way I showed you in your previous thread (that is, use require() to source in an external file) is already sufficient. Best of all, that's easiest unless you need to adopt a pure object-oriented approach. |
|
||||
|
I just need to create few basic functions in separate files like this one:
# lib.pl sub fonc { $arg1=$_[0]; $arg2=$_[1]; print "arg1=$arg1, arg2=$arg2\n"; } 1; I try to call this module in my main script but it seems not so easy : # main.pl use "lib.pl"; &fonc('test','ok'); |
|
||||
|
sorry ... and THANKS.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|