Merge diff processes(.pl files) to one main program(.pl)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kdsutaia
    New Member
    • Nov 2006
    • 15

    Merge diff processes(.pl files) to one main program(.pl)

    In my program I have different .pl files.I come to a last stage of merging all files.

    my most of the program generate text file and that i need to give input to next process.Output of one file(Text file) to input to another.
    for example
    1)htmltotext.pl converts html file to text file then
    2)tockenized.pl converts text file with all tockens which again i am storing in text file.

    there are around 6 more processes i am doing at each point and alli need to do in sequence.

    I tried writing main.pl but i don't understand, how do i call all .pl files.i am working on linux.
    i tried by creating .pm files and calling all processes as a functions but somehow it don't work.
    can any one give a thought on this ?
  • GunnarH
    New Member
    • Nov 2006
    • 83

    #2
    Suggested reading:

    perldoc perlmod
    perldoc perlsub

    If that doesn't help you solve the problem, show us some code.

    Comment

    • kdsutaia
      New Member
      • Nov 2006
      • 15

      #3
      Thanks, I do read but I still need to know which approach is good to use.
      I am working on Linux.
      I was thinking to use System and pipe commond
      to call one program(.pl t.txt) at a time and send it's output to next .pl and next....

      second apprach i was thinking was,
      call diff modules:
      exmp
      main.pl

      require htmltotext qw(get_html);
      require tockenized qw(get_tocken);
      require calculate qw(get_cal);
      $file=@ARGV[0];
      open(OUT,'Query .txt' )|| die "$!";
      print OUT htmltotext::get _html($file);
      my $tockenized_fil e=tockenized::g et_tocken('Quer y.txt');
      calculate::get_ cal($tockenized _file);

      and output of calculate need to be displayed on console.

      My problem with this approch is when i am trying to call diff functions from diff modules(.pm files) my program don't gives me output but individually runs perfectly well.
      this each of the function is having many small subrutine and have used many modules used in it.
      exp
      get_html used HTML::Parser ..etc

      all works with this main program alone but when i am trying to do next step.it don't give me any output.

      is the module having it's own global variables ?

      thanks ..

      Originally posted by GunnarH
      Suggested reading:

      perldoc perlmod
      perldoc perlsub

      If that doesn't help you solve the problem, show us some code.

      Comment

      • GunnarH
        New Member
        • Nov 2006
        • 83

        #4
        Originally posted by kdsutaia
        Thanks, I do read but I still need to know which approach is good to use.
        I'd say that the preferred approach would be the use of modules in .pm files.

        Originally posted by kdsutaia
        ... output of calculate need to be displayed on console.

        My problem with this approch is when i am trying to call diff functions from diff modules(.pm files) my program don't gives me output but individually runs perfectly well.
        It's difficult to understand what your problem is. Please post some short and simplified code, that illustrates what it is you are trying to do. Something like this:
        Code:
        # main.pl
        use Mymodule;
        my @numbers = (2, 4, 3);
        my $product = Mymodule::multiply( @numbers );
        print "$product\n";
        
        # Mymodule.pm
        package Mymodule;
        sub multiply {
        	my $product = shift;
        	$product *= $_[$_] for 0..$#_;
        	$product;
        }
        1;

        Comment

        Working...