Re: Suggestions, please

From: Dester223@aol.com
Date: Mon Oct 25 1999 - 00:53:07 EDT


I'd get a fiberglass tonneau. Check "checkmate" tonneau covers. they sell
for 350 for mini trucks? fit flush with the bed. hey, if you want a "over
the rail one" i'll sell you mine and buy that checkmate. I've seen one on a
s-10 and they are slick...
-Dester

<< I need some advice on what kind of bed cover to get for my Dak. Hard or
 soft? Good and bad points. Good and bad mfg's. Price range. Also looking
 into some "nerf bars", prefer chrome. I was just thinking, my Dak is
 just as long, wide, and heavy as my old '66 F-85 4-door, but less 91
 cubes (239 vs. 330), 2 cyls, 110 horses (200 vs. 310), 2 mpg (21 Dak, 23
 Olds) and probably 2 secs. (ran a 15.7@85mph) slower. I really miss that
 car. Total sleeper. Pure grandma ride. Hubcaps, Midas quiet duals, and
 it was Tb of printing out complex data structures. However, the
     perl5db that Ilya Zakharevich <_i_l_y_a@_m_a_t_h._o_h_i_o-_s_t_a_t_e._e_d_u>
     wrote, which is accessible at

         ftp://ftp.perl.com/pub/perl/ext/perl5db-kit-0.9.tar.gz

     has several new features, including command line editing as
     well as the x command to dump out complex data structures.
     For example, given the assignment to $LoL above, here's the
     debugger output:

         DB<1> X $LoL
         $LoL = ARRAY(0x13b5a0)
            0 ARRAY(0x1f0a24)
               0 'fred'
               1 'barney'
               2 'pebbles'
               3 'bambam'
               4 'dino'
            1 ARRAY(0x13b558)
               0 'homer'
               1 'bart'
               2 'marge'
               3 'maggie'
            2 ARRAY(0x13b540)
               0 'george'
               1 'jane'
               2 'alroy'
               3 'judy'

     There's also a lower-case xxxx command which is nearly the
     same.

CCCCOOOODDDDEEEE EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
     Presented with little comment (these will get their own man
     pages someday) here are short code examples illustrating
     access of various types of data structures.

LLLLIIIISSSSTTTTSSSS OOOOFFFF LLLLIIIISSSSTTTTSSSS

30/Jan/96 Last change: perl 7

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF LLLLIIIISSSSTTTTSSSS

      @LoL = (
             [ "fred", "barney" ],
             [ "george", "jane", "elroy" ],
             [ "homer", "marge", "bart" ],
           );

     GGGGeeeennnneeeerrrraaaattttiiiioooonnnn ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF LLLLIIIISSSSTTTTSSSS

      # reading from file
      while ( <> ) {
          push @LoL, [ split ];

      # calling a function
      for $i ( 1 .. 10 ) {
          $LoL[$i] = [ somefunc($i) ];

      # using temp vars
      for $i ( 1 .. 10 ) {
          @tmp = somefunc($i);
          $LoL[$i] = [ @tmp ];

      # add to an existing row
      push @{ $LoL[0] }, "wilma", "betty";

     AAAAcccccccceeeessssssss aaaannnndddd PPPPrrrriiiinnnnttttiiiinnnngggg ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF LLLLIIIISSSSTTTTSSSS

      # one element
      $LoL[0][0] = "Fred";

      # another element
      $LoL[1][1] =~ s/(\w)/\u$1/;

      # print the whole thing with refs
      for $aref ( @LoL ) {
          print "\t [ @$aref ],\n";

      # print the whole thing with indices
      for $i ( 0 .. $#LoL ) {
          print "\t [ @{$LoL[$i]} ],\n";

      # print the whole thing one at a time
      for $i ( 0 .. $#LoL ) {
          for $j ( 0 .. $#{$LoL[$i]} ) {
              print "elt $i $j is $LoL[$i][$j]\n";
          }

30/Jan/96 Last change: perl 8

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

HHHHAAAASSSSHHHHEEEESSSS OOOOFFFF LLLLIIIISSSSTTTTSSSS
     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF LLLLIIIISSSSTTTTSSSS

      %HoL = (
             "flintstones" => [ "fred", "barney" ],
             "jetsons" => [ "george", "jane", "elroy" ],
             "simpsons" => [ "homer", "marge", "bart" ],
           );

     GGGGeeeennnneeeerrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF LLLLIIIISSSSTTTTSSSS

      # reading from file
      # flintstones: fred barney wilma dino
      while ( <> ) {
          next unless s/^(.*?):\s*//;
          $HoL{$1} = [ split ];

      # reading from file; more temps
      # flintstones: fred barney wilma dino
      while ( $line = <> ) {
          ($who, $rest) = split /:\s*/, $line, 2;
          @fields = split ' ', $rest;
          $HoL{$who} = [ @fields ];

      # calling a function that returns a list
      for $group ( "simpsons", "jetsons", "flintstones" ) {
          $HoL{$group} = [ get_family($group) ];

      # likewise, but using temps
      for $group ( "simpsons", "jetsons", "flintstones" ) {
          @members = get_family($group);
          $HoL{$group} = [ @members ];

      # append new members to an existing family
      push @{ $HoL{"flintstones"} }, "wilma", "betty";

     AAAAcccccccceeeessssssss aaaannnndddd PPPPrrrriiiinnnnttttiiiinnnngggg ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF LLLLIIIISSSSTTTTSSSS

      # one element
      $HoL{flintstones}[0] = "Fred";

      # another element
      $HoL{simpsons}[1] =~ s/(\w)/\u$1/;

      # print the whole thing
      foreach $family ( keys %HoL ) {
          print "$family: @{ $HoL{$family} }\n"

30/Jan/96 Last change: perl 9

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

      # print the whole thing with indices
      foreach $family ( keys %HoL ) {
          print "family: ";
          foreach $i ( 0 .. $#{ $HoL{$family} ) {
              print " $i = $HoL{$family}[$i]";
          }
          print "\n";

      # print the whole thing sorted by number of members
      foreach $family ( sort { @{$HoL{$b}} <=> @{$HoL{$b}} } keys %HoL ) {
          print "$family: @{ $HoL{$family} }\n"

      # print the whole thing sorted by number of members and name
      foreach $family ( sort { @{$HoL{$b}} <=> @{$HoL{$a}} } keys %HoL ) {
          print "$family: ", join(", ", sort @{ $HoL{$family}), "\n";

LLLLIIIISSSSTTTTSSSS OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS
     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      @LoH = (
             {
                Lead => "fred",
                Friend => "barney",
             },
             {
                 Lead => "george",
                 Wife => "jane",
                 Son => "elroy",
             },
             {
                 Lead => "homer",
                 Wife => "marge",
                 Son => "bart",
             }
       );

     GGGGeeeennnneeeerrrraaaattttiiiioooonnnn ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      # reading from file
      # format: LEAD=fred FRIEND=barney
      while ( <> ) {
          $rec = {};
          for $field ( split ) {
              ($key, $value) = split /=/, $field;
              $rec->{$key} = $value;
          }
          push @LoH, $rec;

30/Jan/96 Last change: perl 10

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

      # reading from file
      # format: LEAD=fred FRIEND=barney
      # no temp
      while ( <> ) {
          push @LoH, { split /[\s+=]/ };

      # calling a function that returns a key,value list, like
      # "lead","fred","daughter","pebbles"
      while ( %fields = getnextpairset() )
          push @LoH, { %fields };

      # likewise, but using no temp vars
      while (<>) {
          push @LoH, { parsepairs($_) };

      # add key/value to an element
      $LoH[0]{"pet"} = "dino";
      $LoH[2]{"pet"} = "santa's little helper";

     AAAAcccccccceeeessssssss aaaannnndddd PPPPrrrriiiinnnnttttiiiinnnngggg ooooffff aaaa LLLLIIIISSSSTTTT OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      # one element
      $LoH[0]{"lead"} = "fred";

      # another element
      $LoH[1]{"lead"} =~ s/(\w)/\u$1/;

      # print the whole thing with refs
      for $href ( @LoH ) {
          print "{ ";
          for $role ( keys %$href ) {
              print "$role=$href->{$role} ";
          }
          print "}\n";

      # print the whole thing with indices
      for $i ( 0 .. $#LoH ) {
          print "$i is { ";
          for $role ( keys %{ $LoH[$i] } ) {
              print "$role=$LoH[$i]{$role} ";
          }
          print "}\n";

      # print the whole thing one at a time
      for $i ( 0 .. $#LoH ) {
          for $role ( keys %{ $LoH[$i] } ) {
              print "elt $i $role is $LoH[$i]{$role}\n";
          }

30/Jan/96 Last change: perl 11

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

HHHHAAAASSSSHHHHEEEESSSS OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS
     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      %HoH = (
             "flintstones" => {
                 "lead" => "fred",
                 "pal" => "barney",
             },
             "jetsons" => {
                  "lead" => "george",
                  "wife" => "jane",
                  "his boy"=> "elroy",
              }
             "simpsons" => {
                  "lead" => "homer",
                  "wife" => "marge",
                  "kid" => "bart",
           );

     GGGGeeeennnneeeerrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      # reading from file
      # flintstones: lead=fred pal=barney wife=wilma pet=dino
      while ( <> ) {
          next unless s/^(.*?):\s*//;
          $who = $1;
          for $field ( split ) {
              ($key, $value) = split /=/, $field;
              $HoH{$who}{$key} = $value;
          }

      # reading from file; more temps
      while ( <> ) {
          next unless s/^(.*?):\s*//;
          $who = $1;
          $rec = {};
          $HoH{$who} = $rec;
          for $field ( split ) {
              ($key, $value) = split /=/, $field;
              $rec->{$key} = $value;
          }

      # calling a function that returns a key,value list, like
      # "lead","fred","daughter","pebbles"
      while ( %fields = getnextpairset() )
          push @a, { %fields };

      # calling a function that returns a key,value hash
      for $group ( "simpsons", "jetsons", "flintstones" ) {
          $HoH{$group} = { get_family($group) };

30/Jan/96 Last change: perl 12

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

      # likewise, but using temps
      for $group ( "simpsons", "jetsons", "flintstones" ) {
          %members = get_family($group);
          $HoH{$group} = { %members };

      # append new members to an existing family
      %new_folks = (
          "wife" => "wilma",
          "pet" => "dino";
      );
      for $what (keys %new_folks) {
          $HoH{flintstones}{$what} = $new_folks{$what};

     AAAAcccccccceeeessssssss aaaannnndddd PPPPrrrriiiinnnnttttiiiinnnngggg ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF HHHHAAAASSSSHHHHEEEESSSS

      # one element
      $HoH{"flintstones"}{"wife"} = "wilma";

      # another element
      $HoH{simpsons}{lead} =~ s/(\w)/\u$1/;

      # print the whole thing
      foreach $family ( keys %HoH ) {
          print "$family: ";
          for $role ( keys %{ $HoH{$family} } {
              print "$role=$HoH{$family}{$role} ";
          }
          print "}\n";

      # print the whole thing somewhat sorted
      foreach $family ( sort keys %HoH ) {
          print "$family: ";
          for $role ( sort keys %{ $HoH{$family} } {
              print "$role=$HoH{$family}{$role} ";
          }
          print "}\n";

      # print the whole thing sorted by number of members
      foreach $family ( sort { keys %{$HoH{$b}} <=> keys %{$HoH{$b}} } keys %HoH ) {
          print "$family: ";
          for $role ( sort keys %{ $HoH{$family} } {
              print "$role=$HoH{$family}{$role} ";
          }
          print "}\n";

      # establish a sort order (rank) for each role
      $i = 0;
      for ( qw(lead wife son daughter pal pet) ) { $rank{$_} = ++$i }

30/Jan/96 Last change: perl 13

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

      # now print the whole thing sorted by number of members
      foreach $family ( sort { keys %{$HoH{$b}} <=> keys %{$HoH{$b}} } keys %HoH ) {
          print "$family: ";
          # and print these according to rank order
          for $role ( sort { $rank{$a} <=> $rank{$b} keys %{ $HoH{$family} } {
              print "$role=$HoH{$family}{$role} ";
          }
          print "}\n";

MMMMOOOORRRREEEE EEEELLLLAAAABBBBOOOORRRRAAAATTTTEEEE RRRREEEECCCCOOOORRRRDDDDSSSS
     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff MMMMOOOORRRREEEE EEEELLLLAAAABBBBOOOORRRRAAAATTTTEEEE RRRREEEECCCCOOOORRRRDDDDSSSS

     Here's a sample showing how to create and use a record whose
     fields are of many different sorts:

          $rec = {
              STRING => $string,
              LIST => [ @old_values ],
              LOOKUP => { %some_table },
              FUNC => \&some_function,
              FANON => sub { $_[0] ** $_[1] },
              FH => \*STDOUT,
          };

          print $rec->{STRING};

          print $rec->{LIST}[0];
          $last = pop @ { $rec->{LIST} };

          print $rec->{LOOKUP}{"key"};
          ($first_k, $first_v) = each %{ $rec->{LOOKUP} };

          $answer = &{ $rec->{FUNC} }($arg);
          $answer = &{ $rec->{FANON} }($arg1, $arg2);

          # careful of extra block braces on fh ref
          print { $rec->{FH} } "a string\n";

          use FileHandle;
          $rec->{FH}->autoflush(1);
          $rec->{FH}->print(" a string\n");

     DDDDeeeeccccllllaaaarrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF CCCCOOOOMMMMPPPPLLLLEEEEXXXX RRRREEEECCCCOOOORRRRDDDDSSSS

30/Jan/96 Last change: perl 14

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

          %TV = (
             "flintstones" => {
                 series => "flintstones",
                 nights => [ qw(monday thursday friday) ];
                 members => [
                     { name => "fred", role => "lead", age => 36, },
                     { name => "wilma", role => "wife", age => 31, },
                     { name => "pebbles", role => "kid", age => 4, },
                 ],
             },

             "jetsons" => {
                 series => "jetsons",
                 nights => [ qw(wednesday saturday) ];
                 members => [
                     { name => "george", role => "lead", age => 41, },
                     { name => "jane", role => "wife", age => 39, },
                     { name => "elroy", role => "kid", age => 9, },
                 ],
              },

             "simpsons" => {
                 series => "simpsons",
                 nights => [ qw(monday) ];
                 members => [
                     { name => "homer", role => "lead", age => 34, },
                     { name => "marge", role => "wife", age => 37, },
                     { name => "bart", role => "kid", age => 11, },
                 ],
              },
           );

     GGGGeeeennnneeeerrrraaaattttiiiioooonnnn ooooffff aaaa HHHHAAAASSSSHHHH OOOOFFFF CCCCOOOOMMMMPPPPLLLLEEEEXXXX RRRREEEECCCCOOOORRRRDDDDSSSS

          # reading from file
          # this is most easily done by having the file itself be
          # in the raw data format as shown above. perl is happy
          # to parse complex datastructures if declared as data, so
          # sometimes it's easiest to do that

          # here's a piece by piece build up
          $rec = {};
          $rec->{series} = "flintstones";
          $rec->{nights} = [ find_days() ];

30/Jan/96 Last change: perl 15

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

          @members = ();
          # assume this file in field=value syntax
          while () {
              %fields = split /[\s=]+/;
              push @members, { %fields };
          }
          $rec->{members} = [ @members ];

          # now remember the whole thing
          $TV{ $rec->{series} } = $rec;

          ###########################################################
          # now, you might want to make interesting extra fields that
          # include pointers back into the same data structure so if
          # change one piece, it changes everywhere, like for examples
          # if you wanted a {kids} field that was an array reference
          # to a list of the kids' records without having duplicate
          # records and thus update problems.
          ###########################################################
          foreach $family (keys %TV) {
              $rec = $TV{$family}; # temp pointer
              @kids = ();
              for $person ( @{$rec->{members}} ) {
                  if ($person->{role} =~ /kid|son|daughter/) {
                      push @kids, $person;
                  }
              }
              # REMEMBER: $rec and $TV{$family} point to same data!!
              $rec->{kids} = [ @kids ];
          }

          # you copied the list, but the list itself contains pointers
          # to uncopied objects. this means that if you make bart get
          # older via

          $TV{simpsons}{kids}[0]{age}++;

          # then this would also change in
          print $TV{simpsons}{members}[2]{age};

          # because $TV{simpsons}{kids}[0] and $TV{simpsons}{members}[2]
          # both point to the same underlying anonymous hash table

30/Jan/96 Last change: perl 16

PERLDSC(1) Perl Programmers Reference Guide PERLDSC(1)

          # print the whole thing
          foreach $family ( keys %TV ) {
              print "the $family";
              print " is on during @{ $TV{$family}{nights} }\n";
              print "its members are:\n";
              for $who ( @{ $TV{$family}{members} } ) {
                  print " $who->{name} ($who->{role}), age $who->{age}\n";
              }
              print "it turns out that $TV{$family}{'lead'} has ";
              print scalar ( @{ $TV{$family}{kids} } ), " kids named ";
              print join (", ", map { $_->{name} } @{ $TV{$family}{kids} } );
              print "\n";
          }

DDDDaaaattttaaaabbbbaaaasssseeee TTTTiiiieeeessss
     You cannot easily tie a multilevel data structure (such as a
     hash of hashes) to a dbm file. The first problem is that
     all but GDBM and Berkeley DB have size limitations, but
     beyond that, you also have problems with how references are
     to be represented on disk. One experimental module that
     does attempt to partially address this need is the MLDBM
     module. Check your nearest CPAN site as described in the
     _p_e_r_l_m_o_d manpage for source code to MLDBM.

SSSSEEEEEEEE AAAALLLLSSSSOOOO
     the _p_e_r_l_r_e_f manpage, the _p_e_r_l_l_o_l manpage, the _p_e_r_l_d_a_t_a
     manpage, the _p_e_r_l_o_b_j manpage

AAAAUUUUTTTTHHHHOOOORRRR
     Tom Christiansen <_t_c_h_r_i_s_t@_p_e_r_l._c_o_m>

     Last update: Tue Dec 12 09:20:26 MST 1995

30/Jan/96 Last change: perl 17
none

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

NNNNAAAAMMMMEEEE
     perlembed - how to embed perl in your C program

DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
     PPPPRRRREEEEAAAAMMMMBBBBLLLLEEEE

     Do you want to:

     UUUUsssseeee CCCC ffffrrrroooommmm PPPPeeeerrrrllll????
          Read the _p_e_r_l_c_a_l_l manpage and the _p_e_r_l_x_s manpage.

     
     _p_r_o_g_r_a_m

     the section on _P_e_r_f_o_r_m_i_n_g _P_e_r_l _p_a_t_t_e_r_n _m_a_t_c_h_e_s _a_n_d
     _s_u_b_s_t_i_t_u_t_i_o_n_s _f_r_o_m _y_o_u_r _C _p_r_o_g_r_a_m

     the section on _F_i_d_d_l_i_n_g _w_i_t_h _t_h_e _P_e_r_l _s_t_a_c_k _f_r_o_m _y_o_u_r _C
     _p_r_o_g_r_a_m

     This documentation is UNIX specific.

30/Jan/96 Last change: perl 1

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

     CCCCoooommmmppppiiiilllliiiinnnngggg yyyyoooouuuurrrr CCCC pppprrrrooooggggrrrraaaammmm

     Every C program that uses Perl must link in the _p_e_r_l
     _l_i_b_r_a_r_y.

     What's that, you ask? Perl is itself written in C; the perl
     library is the collection of compiled C programs that were
     used to create your perl executable (/_u_s_r/_b_i_n/_p_e_r_l or
     equivalent). (Corollary: you can't use Perl from your C
     program unless Perl has been compiled on your machine, or
     installed properly--that's why you shouldn't blithely copy
     Perl executables from machine to machine without also
     copying the _l_i_b directory.)

     Your C program will--usually--allocate, "run", and
     deallocate a _P_e_r_l_I_n_t_e_r_p_r_e_t_e_r object, which is defined in the
     perl library.

     If your copy of Perl is recent enough to contain this
     documentation (5.002 or later), then the perl library (and
     _E_X_T_E_R_N._h and _p_e_r_l._h, which you'll also need) will reside in
     a directory resembling this:

         /usr/local/lib/perl5/your_architecture_here/CORE

     or perhaps just

         /usr/local/lib/perl5/CORE

     or maybe something like

         /usr/opt/perl5/CORE

     Execute this statement for a hint about where to find CORE:

         perl -e 'use Config; print $Config{archlib}'

     Here's how you might compile the example in the next
     section, the section on _A_d_d_i_n_g _a _P_e_r_l _i_n_t_e_r_p_r_e_t_e_r _t_o _y_o_u_r _C
     _p_r_o_g_r_a_m, on a DEC Alpha running the OSF operating system:

         % cc -o interp interp.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE
         -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm

     You'll have to choose the appropriate compiler (_c_c, _g_c_c, et
     al.) and library directory (/_u_s_r/_l_o_c_a_l/_l_i_b/...) for your
     machine. If your compiler complains that certain functions
     are undefined, or that it can't locate -_l_p_e_r_l, then you need
     to change the path following the -L. If it complains that
     it can't find _E_X_T_E_R_N._h or _p_e_r_l._h, you need to change the
     path following the -I.

30/Jan/96 Last change: perl 2

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

     You may have to add extra libraries as well. Which ones?
     Perhaps those printed by

        perl -e 'use Config; print $Config{libs}'

     AAAAddddddddiiiinnnngggg aaaa PPPPeeeerrrrllll iiiinnnntttteeeerrrrpppprrrreeeetttteeeerrrr ttttoooo yyyyoooouuuurrrr CCCC pppprrrrooooggggrrrraaaammmm

     In a sense, perl (the C program) is a good example of
     embedding Perl (the language), so I'll demonstrate embedding
     with _m_i_n_i_p_e_r_l_m_a_i_n._c, from the source distribution. Here's a
     bastardized, non-portable version of _m_i_n_i_p_e_r_l_m_a_i_n._c
     containing the essentials of embedding:

         #include <stdio.h>
         #include <EXTERN.h> /* from the Perl distribution */
         #include <perl.h> /* from the Perl distribution */

         static PerlInterpreter *my_perl; /*** The Perl interpreter ***/

         int main(int argc, char **argv, char **env)
         {
             my_perl = perl_alloc();
             perl_construct(my_perl);
             perl_parse(my_perl, NULL, argc, argv, env);
             perl_run(my_perl);
             perl_destruct(my_perl);
             perl_free(my_perl);
         }

     Now compile this program (I'll call it _i_n_t_e_r_p._c) into an
     executable:

         % cc -o interp interp.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE
         -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm

     After a successful compilation, you'll be able to use _i_n_t_e_r_p
     just like perl itself:

         % interp
         print "Pretty Good Perl \n";
         print "10890 - 9801 is ", 10890 - 9801;
         <CTRL-D>
         Pretty Good Perl
         10890 - 9801 is 1089

     or

         % interp -e 'printf("%x", 3735928559)'
         deadbeef

     You can also read and execute Perl statements from a file

30/Jan/96 Last change: perl 3

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

     while in the midst of your C program, by placing the
     filename in _a_r_g_v[_1] before calling _p_e_r_l__r_u_n().

     CCCCaaaalllllllliiiinnnngggg aaaa PPPPeeeerrrrllll ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ffffrrrroooommmm yyyyoooouuuurrrr CCCC pppprrrrooooggggrrrraaaammmm

     To call individual Perl subroutines, you'll need to remove
     the call to _p_e_r_l__r_u_n() and replace it with a call to
     _p_e_r_l__c_a_l_l__a_r_g_v().

     That's shown below, in a program I'll call _s_h_o_w_t_i_m_e._c.

         #include <stdio.h>
         #include <EXTERN.h>
         #include <perl.h>

         static PerlInterpreter *my_perl;

         int main(int argc, char **argv, char **env)
         {
             my_perl = perl_alloc();
             perl_construct(my_perl);

             perl_parse(my_perl, NULL, argc, argv, env);

                                          /*** This replaces perl_run() ***/
             perl_call_argv("showtime", G_DISCARD | G_NOARGS, argv);
             perl_destruct(my_perl);
             perl_free(my_perl);
         }

     where _s_h_o_w_t_i_m_e is a Perl subroutine that takes no arguments
     (that's the _G__N_O_A_R_G_S) and for which I'll ignore the return
     value (that's the _G__D_I_S_C_A_R_D). Those flags, and others, are
     discussed in the _p_e_r_l_c_a_l_l manpage.

     I'll define the _s_h_o_w_t_i_m_e subroutine in a file called
     _s_h_o_w_t_i_m_e._p_l:

         print "I shan't be printed.";

         sub showtime {
             print time;
         }

     Simple enough. Now compile and run:

         % cc -o showtime showtime.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE
         -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm

         % showtime showtime.pl
         818284590

30/Jan/96 Last change: perl 4

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

     yielding the number of seconds that elapsed between January
     1, 1970 (the beginning of the UNIX epoch), and the moment I
     began writing this sentence.

     If you want to pass some arguments to the Perl subroutine,
     or you want to access the return value, you'll need to
     manipulate the Perl stack, demonstrated in the last section
     of this document: the section on _F_i_d_d_l_i_n_g _w_i_t_h _t_h_e _P_e_r_l
     _s_t_a_c_k _f_r_o_m _y_o_u_r _C _p_r_o_g_r_a_m

     EEEEvvvvaaaalllluuuuaaaattttiiiinnnngggg aaaa PPPPeeeerrrrllll ssssttttaaaatttteeeemmmmeeeennnntttt ffffrrrroooommmm yyyyoooouuuurrrr CCCC pppprrrrooooggggrds.com (ahmlir1-2.mail.eds.com [192.85.154.25])
        by ahmler1.mail.eds.com (8.9.3/8.9.3) with ESMTP id DAA20169
        for <dakota-truck@buffnet.net>; Mon, 25 Oct 1999 03:30:21 -0400 (EDT)
Received: from ahmlir1.mail.eds.com (localhost [127.0.0.1])
        by ahmlir1.mail.eds.com (8.9.3/8.9.3) with ESMTP id DAA15477
        for <dakota-truck@buffnet.net>; Mon, 25 Oct 1999 03:29:31 -0400 (EDT)
Received: from usahm007.exmi01.exch.eds.com (usahm007.exmi01.exch.eds.com [207.37.138.147])
        by ahmlir1.mail.eds.com (8.9.3/8.9.3) with ESMTP id DAA15473
        for <dakota-truck@buffnet.net>; Mon, 25 Oct 1999 03:29:31 -0400 (EDT)
Received: by usahm007.exmi01.exch.eds.com with Internet Mail Service (5.5.2650.21)
        id <VCFYNPJ0>; Mon, 25 Oct 1999 03:27:49 -0400
Message-ID: <92D60A12331ED2119F5300A02461F04705F324DB@usahm009.exmi01.exch.eds.com>
From: "Densteadt, James" <james.densteadt@eds.com>
To: dakota-truck@buffnet.net
Subject: DML: check engine light on????
Date: Mon, 25 Oct 1999 03:27:47 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain;
        charset="iso-8859-1"
Sender: owner-dakota-truck@buffnet.net
Reply-To: dakota-truck@buffnet.net
X-Mailing-List: The Dakota Mailing List
X-Mailing-List-Owner: stei0302@cs.fredonia.edu
X-URL: http://www.cs.fredonia.edu/~stei0302/WWW/DAKOTA/dakota.html
X-Unsubscribe-Info: Send "unsubscribe dakota-truck" to majordomo@buffnet.net.
X-Unsubscribe-URL: http://www.cs.fredonia.edu/~stei0302/WWW/CGI-BIN/dml.html

I got a new problem with my R/T and thought maybe one of you late night
mechanics might know the answer. I was driving up I75 yesterday towards
Flint......go to pass a semi when all of a sudden the engine bogs
down.....check engine light starts blinking..??? Now I'm about 200 miles
over do for an oil change so that can't be it. I pull over at a gas
station....check the oil....a little low...no biggie....added some more and
off I went. Now the engine bogs when ever I punch the gas....the check
engine light is staying on. I pull over again and the temp gauge starts
reading above the 210 mark. I check the coolant reserve...a little low so I
add some water....let it cool off....and on I go again. Still the same
problem....the gauges read hot....then the next minute ok. No power when I
punch it and it sounds like the motor is being muffled.....no rumble out
that 3 inch exhaust like it had just a short while ago!! Any ideas....it's
going to the shop tomorrow!! Thanks!



This archive was generated by hypermail 2b29 : Fri Jun 20 2003 - 12:18:15 EDT