From owner-freebsd-chat Mon Nov 18 06:32:51 1996 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA17014 for chat-outgoing; Mon, 18 Nov 1996 06:32:51 -0800 (PST) Received: from nimbus.superior.net (root@nimbus.superior.net [206.153.96.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id GAA17005 for ; Mon, 18 Nov 1996 06:32:38 -0800 (PST) Received: (from exidor@localhost) by nimbus.superior.net (8.7.6/8.7.5) id JAA18675; Mon, 18 Nov 1996 09:32:36 -0500 (EST) Message-Id: <199611181432.JAA18675@nimbus.superior.net> 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 ...) References: <199611180926.KAA27749@freebie.lemis.de> X-Mailer: Mutt 0.48.1 Mime-Version: 1.0 In-Reply-To: <199611180926.KAA27749@freebie.lemis.de>; from Greg Lehey on Nov 18, 1996 10:26:12 +0100 Sender: owner-chat@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 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.