running a perl program from a shell script

Luke (Terry) Vanderfluit luke at chipcity.com.au
Fri Jun 11 05:02:04 CST 2004


Hi,

I did all that already,
however when I run the popfile.pl script from a shell script it aborts
with the following message:

~~~~~~~~~~~~~
Can't locate POPFile/Loader.pm in @INC (@INC contains: ./
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/usr/local/popfile/popfile.pl line 37.
BEGIN failed--compilation aborted at /usr/local/popfile/popfile.pl line
37.
~~~~~~~~~~~~~

this is the popfile.pl script

~~~~~~~~~~~~~
      1 #!/usr/bin/perl -w
      2 #
-----------------------------------------------------------------------------        ----------------
      3 #
      4 # popfile.pl --- Message analyzer and sorter
      5 #
      6 # Acts as a server and client designed to sit between a real
mail/news client a        nd a real mail/
      7 # news server using POP3.  Inserts an extra header
X-Text-Classification: into         the header to
      8 # tell the client which category the message belongs in and much
more...
      9 #
     10 # Copyright (c) 2001-2003 John Graham-Cumming
     11 #
     12 #   This file is part of POPFile
     13 #
     14 #   POPFile is free software; you can redistribute it and/or
modify
     15 #   it under the terms of the GNU General Public License as
published by
     16 #   the Free Software Foundation; either version 2 of the
License, or
     17 #   (at your option) any later version.
     18 #
     19 #   POPFile is distributed in the hope that it will be useful,
     20 #   but WITHOUT ANY WARRANTY; without even the implied warranty
of
     21 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
the
     22 #   GNU General Public License for more details.
     23 #
     24 #   You should have received a copy of the GNU General Public
License
     25 #   along with POPFile; if not, write to the Free Software
     26 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
     27 #
     28 #   Modified by     Sam Schinke (sschinke at users.sourceforge.net)
     29 #
     30 #
-----------------------------------------------------------------------------        ----------------
     31
     32 use strict;
     33 use locale;
     34
     35 use lib defined($ENV{POPFILE_ROOT})?$ENV{POPFILE_ROOT}:'./';
     36
     37 use POPFile::Loader;
     38
     39 # POPFile is actually loaded by the POPFile::Loader object which
does all
     40 # the work
     41
     42 my $POPFile = POPFile::Loader->new();
     43
     44 # Indicate that we should create output on STDOUT (the POPFile
     45 # load sequence) and initialize with the version
     46
     47 $POPFile->debug(1);
     48 $POPFile->CORE_loader_init();
     49
     50 # Redefine POPFile's signals
     51
     52 $POPFile->CORE_signals();
     53
     54 # Create the main objects that form the core of POPFile. 
Consists of the confi        guration
     55 # modules, the classifier, the UI (currently HTML based),
platform specific cod        e,
     56 # and the POP3 proxy.  The link the components together,
intialize them all, lo        ad
     57 # the configuration from disk, start the modules running
     58
     59 $POPFile->CORE_load();
     60 $POPFile->CORE_link_components();
     61 $POPFile->CORE_initialize();
     62 if ( $POPFile->CORE_config() ) {
     63     $POPFile->CORE_start();
     64
     65     # This is the main POPFile loop that services requests, it
will exit only w        hen we
     66     # need to exit
     67
     68     $POPFile->CORE_service();
     69
     70     # Shutdown every POPFile module
     71
     72     $POPFile->CORE_stop();
     73 }
     74
     75 # END

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

kr,

Luke


















On Fri, 2004-06-11 at 14:18, Paul Schulz wrote:
> It has to do with the 'path' that the script sees.. eg. 'perl' is not in it.
> 
> BTW, to make to sript itself executable...
> 1. Do a 'which perl', to see where your perl in installed. It sould 
> respond with something like '/usr/bin/perl'
> 
> 2. Add the following line as the first line of your script..
> #!/usr/bin/perl -w
> 
> 3. Set the executible bit on your script with:
> chmod 755 /usr/local/popfile/popfile.pl
> 
> 4. Run the script..
> /usr/local/popfile/popfile.pl
> 
> 5. Add this command to your shell script.
> 
> Luke (Terry) Vanderfluit wrote:
> 
> >Hi,
> >
> >I've started using popFile
> >http://popfile.sourceforge.net/
> >as a mail filter,
> >It's great, I highly recommend it!
> >
> >to start it I need to run a perl script, which I would like to run from
> >rc.local (Redhat 9: /etc/rc.d/rc.local)
> >
> >how do get the perl script to run from the shell script?
> >
> >
> >If I run 
> >'perl /usr/local/popfile/popfile.pl >& /dev/null &'
> >from the command prompt, all is fine
> >
> >If I place that line in a shell script (bash) it doesn't work,
> >
> >what's the trick?
> >
> >thanks,
> >kind regards,
> >Luke
> >
> >
> >
> >  
> >
-- 
=============
Luke (Terry) Vanderfluit 
Mobile: 0421 276 282     
=============



More information about the linuxsa mailing list