473,463 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

methods imported once should be available to all child classes

hsriat
1,654 Expert 1GB
I have a module from which I am importing a couple of methods. Here is the code:

Expand|Select|Wrap|Line Numbers
  1. package MyEncoder;
  2. use strict;
  3. use Exporter qw(import)
  4. use vars qw(@EXPORT);
  5. @EXPORT = qw(encode decode);
  6.  
  7. sub encode { ... }
  8. sub decode { ... }
  9.  
  10. 1;
Now what I want is, if I use this in some module ,say MyBase, encode & decode methods should be availabe to all the child classes of MyBase without having 'use MyEncoder' written in each child class.

Expand|Select|Wrap|Line Numbers
  1. package MyBase;
  2. use strict;
  3. use MyEncoder;
  4.  
  5. sub new {
  6.     shift;
  7.     return bless {
  8.         'value' => encode(shift || '')
  9.     };
  10. }
  11.  
  12. 1;
Is it possible at all?

Thanks
Sep 7 '11 #1
1 1440

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave Merrill | last post by:
Python newb here. Say a class contains some rich attributes, each defined as a class. If an instance of the parent class recieves a call to a method belonging to one of those attributes, it should...
1
by: Vikas | last post by:
I have a template class called Base with child classes called Child1 and Child2 as follows: template <typename T> class Base { … }; class Child1 : Base<Concrete1>
4
by: Alfonso Morra | last post by:
Hi, I have a variable that stores a pointer to a base class. I am using this variable to store pointers to objects of the base class, as well as pointers to other derived classes. However,...
2
by: Jenna Schmidt | last post by:
I know that one of the benefits of using "Shared" methods is you do not explicitly have to Dim as New object to access the method. Are there some other implications with memory and concurrency...
3
by: Horace | last post by:
Hello I have a class Parent1 that instantiates Child1 and Child2. But Child1 calls methods in Child2 like so :- ======================================== Imports Tiger_Devl.Includes.Child1...
5
by: David Isaac | last post by:
When I create an instance of a class, are the class's functions *copied* to create the methods? Or are method calls actually calls of the class's functions? I am sure this is both obvious and...
9
by: Allan Ebdrup | last post by:
I would like to use reflection to find all classes that inherit from my current class, even if they are in another assembly I want to find them if the current project has a reference to that...
4
by: Matteo Migliore | last post by:
Hi. I've a problem with parent-child circular references. Suppose have two classes, Person and Course: -------------------------- public class Person{ public Person(string name, Course...
1
by: 1x7y2z9 | last post by:
Say, we have a (parent) class P. It has N child classes C1(P), C2(P) ... CN(P) Each of the child classes defines (differently) a method func(). I wish to decorate all of the CX.func() in the...
8
MrPickle
by: MrPickle | last post by:
I wasn't sure what to call them so I'll just call them child classes. I have a child class: class Label : public Window, but I need to use a Label in Window, is this possible? If so how? I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.