The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problems With A Custom Perl Script

Discussion in 'General Discussion' started by simoesp, Mar 6, 2008.

  1. simoesp

    simoesp Member

    Joined:
    Feb 13, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello Everyone :P

    I've Got a Problem that it's geting me crazy i'm not a pro PERL programer but i got some knowledge enough to program perl

    here is my doubt:

    i've made a scritpt to update a password list on a server but when i use this simple code it blows up with an error

    The Script is Located at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvent.pm

    Code:
    #!/usr/local/bin/perl
    package Cpanel::ChangePasswd::UpdateEvents;
    use strict;
    use DBI;
    
    sub process {
        my %OPTS = @_;
    
        my $user = $OPTS{'user'};
        my $newpass = $OPTS{'newpass'};
        my $message = $OPTS{'message'}; #only when changing password as root
        my $rawout = $OPTS{'rawout'};   #only when changing password as root
        my $service_ref = $OPTS{'service_ref'}; #only when changing password as root
    
        $rawout =~ s/[\n\r]/ /g;
        $message =~ s/[\n\r]/ /g;
    
        #the Rest of The Code Was Ommited because it Doesn't get Here
    
    }
    

    It Blows up With This Error
    Code:
    Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpanel /usr/local/cpanel/perl /usr/lib/perl5/5.6.2/i686-linux /usr/lib/perl5/5.6.2 /usr/lib/perl5/site_perl/5.6.2/i686-linux /usr/lib/perl5/site_perl/5.6.2 /usr/lib/perl5/site_perl .) at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
    
    i don't know what is wrong i use in other perl's the DBI and it works fine

    Best Regards,
    Pedro Simões
     
  2. troxalias

    troxalias Well-Known Member

    Joined:
    Nov 21, 2001
    Messages:
    96
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Athens - Greece
    What version of perl do you use ? Issue the command "locate DBI.pm" and check if it is located in any of the include paths you see on the error message.
     
  3. simoesp

    simoesp Member

    Joined:
    Feb 13, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    root@gaea [~]# locate DBI.pm
    /home/.cpan/build/Class-DBI-v3.0.17-PNDwSl/blib/lib/Class/DBI.pm
    /home/.cpan/build/Class-DBI-v3.0.17-PNDwSl/lib/Class/DBI.pm
    /home/.cpan/build/DBI-1.602-vd5iiB/DBI.pm
    /home/.cpan/build/DBI-1.602-vd5iiB/blib/lib/DBI.pm
    /home/.cpan/build/DBI-1.602-vd5iiB/blib/lib/Bundle/DBI.pm
    /home/.cpan/build/DBI-1.602-vd5iiB/lib/Bundle/DBI.pm
    /home/.cpan/build/Ima-DBI-0.35-S_3ANf/blib/lib/Ima/DBI.pm
    /home/.cpan/build/Ima-DBI-0.35-S_3ANf/lib/Ima/DBI.pm
    /home/.cpan/build/Tie-DBI-1.02-HTs6Um/blib/lib/Tie/DBI.pm
    /home/.cpan/build/Tie-DBI-1.02-HTs6Um/lib/Tie/DBI.pm
    /usr/lib/perl5/site_perl/5.8.8/Class/DBI.pm
    /usr/lib/perl5/site_perl/5.8.8/Ima/DBI.pm
    /usr/lib/perl5/site_perl/5.8.8/Tie/DBI.pm
    /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/DBI.pm
    /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Bundle/DBI.pm
    root@gaea [~]#
     
  4. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    change the first line to this and try it

    #!/usr/bin/perl
     
  5. simoesp

    simoesp Member

    Joined:
    Feb 13, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    didn't worked changinh from #!/usr/local/bin/perl to #!/usr/local/perl
     
  6. simoesp

    simoesp Member

    Joined:
    Feb 13, 2008
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    here's a Detailed Error

    Code:
    
    (internal death while parsing [stdin]) Wed Mar 12 10:22:26 2008 [7182] error: Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpanel /us
    r/local/cpanel/perl /usr/lib/perl5/5.6.2/i686-linux /usr/lib/perl5/5.6.2 /usr/lib/perl5/site_perl/5.6.2/i686-linux /usr/lib/perl5/site_perl/5.6
    .2 /usr/lib/perl5/site_perl .) at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
            require Cpanel/ChangePasswd/UpdateEvents.pm called at (eval 7) line 1
            eval 'require Cpanel::ChangePasswd::UpdateEvents;' called at /usr/local/cpanel/Cpanel/ChangePasswd.pm line 183
            Cpanel::ChangePasswd::loadmodules() called at /usr/local/cpanel/Cpanel/ChangePasswd.pm line 168
            Cpanel::ChangePasswd::_run_hooked_modules('user', 'tstdom1', 'newpass', 'qwewqrqweq', 'message', 'Password changed for user tstdom1', '
    rawout', 'Changing password for tstdom1^JPassword for tstdom1 has been chan...', ...) called at /usr/local/cpanel/Cpanel/ChangePasswd.pm line 1
    47
            Cpanel::ChangePasswd::_run_hooks('user', 'tstdom1', 'newpass', 'qwewqrqweq', 'message', 'Password changed for user tstdom1', 'rawout',
    'Changing password for tstdom1^JPassword for tstdom1 has been chan...', ...) called at /usr/local/cpanel/Cpanel/ChangePasswd.pm line 92
            Cpanel::ChangePasswd::change_password('new_password', 'qwewqrqweq', 'user', 'tstdom1') called at /usr/local/cpanel/Whostmgr/Passwd.pm l
    ine 14
            Whostmgr::Passwd::passwd('tstdom1', 'qwewqrqweq') called at whostmgr/bin/whostmgr.pl line 2518
            main::passwd called at whostmgr/bin/whostmgr.pl line 635
    
    
    (internal death while parsing [stdin]) Wed Mar 12 10:22:26 2008 [7182] error: Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpanel /us
    r/local/cpanel/perl /usr/lib/perl5/5.6.2/i686-linux /usr/lib/perl5/5.6.2 /usr/lib/perl5/site_perl/5.6.2/i686-linux /usr/lib/perl5/site_perl/5.6
    .2 /usr/lib/perl5/site_perl .) at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/ChangePasswd/UpdateEvents.pm line 10.
    
     
Loading...

Share This Page