Re: #include or similar

2002-02-26 Thread Jenda Krynicky
> Ok, maybe I should restate the problem. I have a bunch of scripts > which have a couple of lines that chuck some configuration stuff into > some variables. I'm sick of editing the scripts each time the config > changes. I realise that I could use a modules and do stuff like: > > $path = &Conf

Re: #include or similar

2002-02-25 Thread andrew . clark
Subject: Re: #include or similar 26/02/2002

Re: #include or similar

2002-02-25 Thread Agustin Rivera
Yes, modules are it. Here is an example... require 'plibs.pm'; plibs::cat("readme.txt"); --- then in the module --- package plibs; use strict; sub cat { my $file=shift(@_); my $data; open(IN, "$file") or die $!; while() {$data.=$_;} close(IN); return $data; } 1; Agustin River

Re: #include or similar

2002-02-25 Thread bob ackerman
i just went through this last week. put a line at top of file to be included like; package Util; at end of file put: 1; name the file Util.pm to include it in another file say: use Util; assume a subroutine in included file called 'foo'. to call it: &Util::foo(); this is the simple version of

RE: #include or similar

2002-02-25 Thread Timothy Johnson
This conversation just came up. Look in the archives for the subject "sharing subroutines". Summary: Yes, modules are the way to do it, but simple ones are not that hard to write. Look for the thread for the example. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED