Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Want to create a common Perl module

by almut (Canon)
on Jun 28, 2010 at 14:41 UTC ( [id://846928]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Want to create a common Perl module
in thread Want to create a common Perl module

Could you show the exact code that you've written for abc.pm?  Which module is InitializeLog supposed to be imported from?

Replies are listed 'Best First'.
Re^4: Want to create a common Perl module
by pankaj41483 (Initiate) on Jun 28, 2010 at 14:47 UTC
    package abc;
    use strict;
    use myCustom::SysLogLoader;
    use myCustom::amodule;
    use myCustom:firstmod;
    use File::Path 'mkpath'; # for mkdir
    #use warnings;
    use integer;
    use File::Basename;
    use File::Copy; # for move
    use IO::Zlib; # to read gzip input files use IO::File; # to read non gzip input files use Text::Trim; use Data::Types qw(is_int is_string);
    use Shell qw (cat);
    use Sys::Hostname;
    use Time::Local;
    #our @ISA = qw(Exporter);
    sub import {
    my $caller =caller();
    strict->import();
    warning->import();
    MyCustom ::amodule ->import();
    myCustom:: firstmod->import();
    myCustom ::SysLogLoader->import();

    now i am using this package abc into my other myplscript.pl file. then it gives me this error.

      As I mentioned, when myCustom::SysLogLoader uses Exporter, you have to write

      { eval "package $caller; myCustom::SysLogLoader->import();" }

      Likewise for the other modules.  Simply writing

      myCustom::SysLogLoader->import();

      won't work in this case, because Exporter will then export the functions/symbols into the package abc, not the package in which you say use abc;

      ___

      P.S.: please use code tags (<c>...</c>) for code, and also please cut-n-paste it — there are several typos in what you posted.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://846928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-29 12:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found