Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Nov 1996 09:32:36 -0500
From:      exidor@superior.net (Christopher Masto)
To:        chat@freebsd.org
Subject:   Re: Who needs Perl? (Was: cvs commit: src/share/doc/handbook ...)
Message-ID:  <199611181432.JAA18675@nimbus.superior.net>
In-Reply-To: <199611180926.KAA27749@freebie.lemis.de>; from Greg Lehey on Nov 18, 1996 10:26:12 %2B0100
References:  <Mutt.19961117132540.roberto@keltia.freenix.fr> <199611180926.KAA27749@freebie.lemis.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Greg Lehey writes:
> > For many tasks over 20 lines of shell script, Perl will be faster. There
> > are some things I'd consider difficult with sh/awk/sed that are almost
> > trivial with Perl. C wil be faster but unless you don't know Perl at all,
> > you'll end up writing it faster in Perl...
> 
> Well, I won't say that I don't know perl at all, but I do know C, and
> I think I'll do it faster in C, so I obviously don't know enough perl.

Probably a valid statement..

> My real problem with perl is that it doesn't seem to offer enough to
> get to know well.  And maybe I should choose tcl?  Or guile?  Or YACL?
> What do I do when the particular operation I want to do takes too
> long?

Read the manual section on opitimizing for speed?  Re-write critical
sections in C?

> Where's the C language interface?

Right there.

PERLCALL(1)      Perl Programmers Reference Guide     PERLCALL(1)


NAME
       perlcall - Perl calling conventions from C

DESCRIPTION
       The purpose of this document is to show you how to call
       Perl subroutines directly from C, i.e. how to write
       callbacks.

       Apart from discussing the C interface provided by Perl for
       writing callbacks the document uses a series of examples
       to show how the interface actually works in practice.  In
       addition some techniques for coding callbacks are covered.
[---]

PERLXS(1)        Perl Programmers Reference Guide       PERLXS(1)


NAME
       perlxs - XS language reference manual

DESCRIPTION
       Introduction

       XS is a language used to create an extension interface
       between Perl and some C library which one wishes to use
       with Perl.  The XS interface is combined with the library
       to create a new library which can be linked to Perl.  An
       XSUB is a function in the XS language and is the core
       component of the Perl application interface.

       The XS compiler is called xsubpp.  This compiler will
       embed the constructs necessary to let an XSUB, which is
       really a C function in disguise, manipulate Perl values
       and creates the glue necessary to let Perl access the
       XSUB.  The compiler uses typemaps to determine how to map
       C function parameters and variables to Perl values.  The
       default typemap handles many common C types.  A supplement
       typemap must be created to handle special structures and
       types for the library being linked.

       See the perlxstut manpage for a tutorial on the whole
       extension creation process.
[...]

  Where's the debugger?

Right there.

nimbus:/tmp$ perl -d hello.pl
Stack dump during die enabled outside of evals.

Loading DB routines from perl5db.pl patch level 0.95
Emacs support available.

Enter h or `h h' for help.

main::(hello.pl:1):     print "Hello, World!\n";
  DB<1> h h
List/search source lines:               Control script execution:
  l [ln|sub]  List source code            T           Stack trace
  - or .      List previous/current line  s [expr]    Single step [in expr]
  w [line]    List around line            n [expr]    Next, steps over subs
  f filename  View source in file         <CR>        Repeat last n or s
  /pattern/ ?patt?   Search forw/backw    r           Return from subroutine
  v           Show versions of modules    c [line]    Continue until line
Debugger controls:                        L           List break pts & actions
  O [...]     Set debugger options        t [expr]    Toggle trace [trace expr]
  < command   Command for before prompt   b [ln] [c]  Set breakpoint
  > command   Command for after prompt    b sub [c]   Set breakpoint for sub
  ! [N|pat]   Redo a previous command     d [line]    Delete a breakpoint
  H [-num]    Display last num commands   D           Delete all breakpoints
  = [a val]   Define/list an alias        a [ln] cmd  Do cmd before line
  h [db_cmd]  Get help on command         A           Delete all actions
  |[|]dbcmd   Send output to pager        ![!] syscmd Run cmd in a subprocess
  q or ^D     Quit                        R           Attempt a restart
Data Examination:             expr     Execute perl code, also see: s,n,t expr
  S [[!]pat]    List subroutine names [not] matching pattern
  V [Pk [Vars]] List Variables in Package.  Vars can be ~pattern or !pattern.
  X [Vars]      Same as "V current_package [Vars]".
  x expr        Evals expression in array context, dumps the result.
  p expr        Print expression (uses script's current package).

-- 
Christopher Masto  .   .   .   .   Superior Net Support: support@superior.net
chris@masto.com  .   .   .   .   . Masto Consulting:           info@masto.com

On Poultry Inspectors, little-known importance of:
 The crime bill passed by the Senate would reinstate the Federal death
 penalty for certain violent crimes: assassinating the President; hijacking
 an airliner; and murdering a government poultry inspector.
 - Knight Ridder News Service dispatch.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611181432.JAA18675>