[7171] in Perl-Users-Digest
Perl-Users Digest, Issue: 796 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 30 21:21:48 1997
Date: Wed, 30 Jul 97 18:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 30 Jul 1997 Volume: 8 Number: 796
Today's topics:
Re: "Fast forward" within while loop? (Daniel E. Macks)
Re: [Q] Can you generate "page.html#bottom" in PERL? (Stefan Berglund)
A Better Solution: perldb + emacs <soup@ampersand.com>
Re: A Better Solution: perldb + emacs (Ilya Zakharevich)
ANNOUNCE: Data::Locations 3.0 (Steffen Beyer)
GetOpt::Long - Corequisite options? (Bryan Miller)
Re: HELP: perl 5.001 WinNT (John "E.R." Jasen)
Re: HELP: perl 5.001 WinNT <pittelli@ehsct7.envmed.rochester.edu>
Re: I'm looking for a perl logo... <merlyn@stonehenge.com>
In-line PERL in C/C++ <jhaspel@intr.net>
Re: interesting sorting problem (Dean Inada)
makefile won't run <jgeorgas@chat.carleton.ca>
Re: Need help on fork FAQ <nichori@cat.com>
Need Win32 Perl guru phone help - will pay cash <pociask@maricopa.edu>
Perl Code for Paragraph Justification? dilcher@cueva.com
Re: Perl Script with Netscape 4.01 <merlyn@stonehenge.com>
PERL/SOCKETS/Network advice requested <broomberg@ccgroupnet.com>
Print Web Page a la netscape <Joe.Kline@sdrc.com>
Q: perlembed and memory leaks - help! (Dragomir R. Radev)
Re: Question: MacPerl & "require" (Matthew D. Healy)
Search a CSV database <liam@dircon.co.uk>
Re: security holes in perl 5.00401 @_@ (Gil)
Re: security holes in perl 5.00401 @_@ <rra@stanford.edu>
use vars & global variables (Toutatis)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jul 1997 04:18:24 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: "Fast forward" within while loop?
Message-Id: <5rmfag$qmf$1@netnews.upenn.edu>
Qiang Dai (dq@leland.Stanford.EDU) said:
[wants to parse a set of lines that look like this:]
: .
: .
: .
: WantedBegin
: .
: .
: .
: WantedEnd
: .
: .
: .
Looks like a job for the range operator. Something like
( /WantedBegin/ .. /WantedEnd/ ) ? do_something : something_else;
See perlop for more info.
dan
--
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks
------------------------------
Date: 30 Jul 1997 07:38:43 GMT
From: emwsbl@emw.ericsson.se (Stefan Berglund)
Subject: Re: [Q] Can you generate "page.html#bottom" in PERL?
Message-Id: <5rmr23$ls0$2@infomania.emw.ericsson.se>
bowker@iNetWebInc.com wrote:
<snip>
: /usr/bin/perl;
: $var = $something;
: print <<"END";
: <HTML><BODY>
: Welcome, $var
: <a name="bottom">Bye-bye</a>
: </BODY></HTML>
: END
:
: Any suggestions on how to do this ...?
#!/usr/bin/perl # You need to have a #! first and no ; at the end
$var = $something;
print <<END # No ; at the end! And I like to have exactly the
# same name at top and bottom, you can leave the "
# there if you want
<HTML><BODY>
Welcome, $var
<a name="bottom">Bye-bye</a>
</BODY></HTML>
END
This is elementary and it's all in the manual, books and probably the FAQ
(hint, hint)
Oops, it seems that print <<END; works to.
--
/Stefan
Stefan.Berglund@emw.ericsson.se
Life - the ultimate practical joke
------------------------------
Date: 29 Jul 1997 15:08:03 -0400
From: Doug Campbell <soup@ampersand.com>
Subject: A Better Solution: perldb + emacs
Message-Id: <wkiuxt1xt8.fsf@ampersand.com>
Summary
-------
Here I show how to use the perl debugger with a modern emacs, using
the latest emacs capabilities of gud and compilation modes. This
works with Windows 95/NT as well as most unix variants. See
"Directions" below to get started.
Why the Change?
---------------
In the past (emacs 18.x?) perl debugging was supported under emacs
using a perldb.el file from the perl distribution that re-defined and
duplicated much of the functionality of the emacs debugging and
compilation capabilities with perl-specific versions. With newer
emacs, the gud functions provide a language-independent way of running
a debugger and the compilation mode functions provide a
language-independent way of performing compilations.
The problem is that the perl debugger requires both debugger support
*and* compilation support simultaneously. Happily, this can be
accomplished using compilation's minor mode capability under gud major
mode. The code below performs this.
I consider this an improvement over continuing to use perldb.el
because future capabilities and fixes for gud and compilation mode
will be available to perl debugger users, and perldb.el no longer has
to be maintained as a duplicate effort.
Usage
-----
After installation, any buffer containing perl code can be run through
perldb (in gud mode) by running the command "better-perldb". To visit
the next compilation error, use C-x` (as usual), which will put the
gud buffer in compilation minor mode. When done visiting compilation
errors and/or warnings, use C-xx in the gud buffer to get out of
compilation minor mode and back to debugger bindings.
Remaining Issues
----------------
I can't get perltk windows to come up while running in the debugger
under Windows 95. (Help, anyone?)
Directions
----------
In addition to working on almost any unix-like configuration, the
following directions also work for perl 5.004_01 and emacs 19.34.4
binary releases for Windows 95/NT. These can be obtained from:
perl:
ftp://ftp.digital.com/pub/plan/perl/CPAN/authors/Gurusamy_Sarathy/perl5.00401-bindist02-bc.tar.gz
emacs:
ftp.cs.washington.edu/pub/ntemacs/latest/i386/emacs-19.34.4-bin.tar.gz
ftp.cs.washington.edu/pub/ntemacs/latest/i386/emacs-19.34.4-lisp.tar.gz
1. In <perl5lib>/perl5db.pl, apply this patch:
--------------------------- begin patch -------------------------------
*** perl5db.FCS Wed Jul 16 19:16:13 1997
--- perl5db.pl Wed Jul 16 19:14:47 1997
***************
*** 297,303 ****
}
# Around a bug:
! if (defined $ENV{OS2_SHELL} and ($emacs or $ENV{WINDOWID})) { # In OS/2
$console = undef;
}
--- 297,303 ----
}
# Around a bug:
! if ((defined $ENV{OS2_SHELL} or $^O eq 'MSWin32') and ($emacs or $ENV{WINDOWID})) { # In OS/2
$console = undef;
}
---------------------------- end patch -------------------------------
2. Run the following emacs code (in your .emacs or whatever)
--------------------------- begin code -------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; perl debugger support
;;; Have to fix up compilation mode for perl
(require 'compile)
;; Add the regex for looking for perl compile errors
(defvar perl-compilation-error-regexp-alist
;; This looks like a paranoiac regexp: could anybody find a better one?
'(("^[^\n]* \\(file\\|at\\) \\([^ \t\n]+\\) [^\n]*line \\([0-9]+\\)[\\., \n]"
2 3))
"Alist that specifies how to match errors in perl output.")
(setq compilation-error-regexp-alist
(append compilation-error-regexp-alist
perl-compilation-error-regexp-alist))
;; Make compilation mode think that gud buffers are OK for error parsing.
(defsubst compilation-buffer-p (buffer)
(save-excursion
(set-buffer buffer)
(or (or compilation-minor-mode (eq major-mode 'compilation-mode))
(eq major-mode 'gud-mode))))
;;; Have to fix up gud mode for perl
(require 'gud)
;; Re-define gud-perldb-massage-args to handle variable perl flags
(defvar gud-perldb-interp-flags "-dw"
"The flags to pass to the perl interpreter when running a debug session.")
(defun gud-perldb-massage-args (file args)
(cons gud-perldb-interp-flags (cons (car args) (cons "-emacs" (cdr args)))))
;; Fix for perldb - make default reasonable and allow no-prompt option
(defun better-perldb (&optional arg)
"Runs perldb with better handling of default command string.
With arg true, doesn't prompt for new command, uses last one."
(interactive)
(if (not (null arg))
(perldb (car gud-perldb-history))
(perldb (read-from-minibuffer
"Run perldb (like this): "
(if (and (consp gud-perldb-history)
(string-match
(concat "^ *[^ ]+ +" (buffer-file-name))
(car gud-perldb-history)))
(car gud-perldb-history)
(concat "perl " (buffer-file-name)))
nil nil
'(gud-perldb-history . 1)))))
;; Add functions that do compilation error matching using compilation mode,
;; then switch back when done. (C-x` for next-error, C-xx to exit)
(defun perl-next-error ()
"Moves to the next perl error from the last perldb run."
(interactive)
(next-error))
(defun perl-next-error-start ()
"Moves to the next perl error from the last perldb run."
(interactive)
(compilation-minor-mode)
(define-key (current-local-map) "\C-x`" 'perl-next-error)
(define-key (current-local-map) "\C-xx" 'perl-next-error-end)
(next-error))
(defun perl-next-error-end ()
"Ends compilation mode for finding perl errors and returns to perldb mode."
(interactive)
(set-buffer (compilation-find-buffer))
(compilation-minor-mode))
(defun perldb-compilation-preferences ()
(define-key (current-local-map) "\C-x`" 'perl-next-error-start))
(add-hook 'perldb-mode-hook '(lambda () (perldb-compilation-preferences)))
---------------------------- end code --------------------------------
What the Code Does
------------------
The patch to perl5db.pl in step 1 above makes perl use stdout for
debugger messages instead of a console if it's running on Windows
under emacs (otherwise it hangs).
In step 2 above, the first part enhances compilation mode by allowing
it to recognize perl errors and to use gud buffers as sources of
compilation errors. The next part enhances gud mode by allowing
arbitrary flags to be passed to the perl interpreter (including the
all-important "-w" in the default) and making the default command line
for perl include the proper file name. The last part adds the key
bindings to get into compilation mode with C-x` and get out again with
C-xx.
Enjoy,
Doug Campbell
soup@ampersand.com
------------------------------
Date: 29 Jul 1997 19:40:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: A Better Solution: perldb + emacs
Message-Id: <5rlguj$eh8@agate.berkeley.edu>
In article <wkiuxt1xt8.fsf@ampersand.com>,
Doug Campbell <soup@ampersand.com> wrote:
> The problem is that the perl debugger requires both debugger support
> *and* compilation support simultaneously. Happily, this can be
> accomplished using compilation's minor mode capability under gud major
> mode. The code below performs this.
If somebody understands why something more than the M$-specific change
(below) to perl5db.pl is needed with CPerl, let me know.
Note that any discussion related to perldb.el makes me nervous (since
it was *incorporated* into Emacs 19), so I may have missed something
important.
Ilya
------------------------------
Date: 29 Jul 1997 20:11:45 GMT
From: sb@sdm.de (Steffen Beyer)
Subject: ANNOUNCE: Data::Locations 3.0
Message-Id: <5rliq1$brk$1@nadine.teleport.com>
Dear Perl users,
I am glad and proud to submit an especially useful and elegant module
to the Perl community, namely
===========================================
Package "Data::Locations" Version 3.0
===========================================
for Perl version 5.000 and higher
Copyright (c) 1997 by Steffen Beyer. All rights reserved.
This package is free software; you can redistribute and/or
modify it under the same terms as Perl itself.
Where to find:
--------------
You can download this module directly from the author's web site, where you
will also find my other modules and a couple of logos illustrating what the
modules do:
http://www.engelschall.com/u/sb/download/
You should also be able to find this module on any CPAN ftp site
(CPAN = "Comprehensive Perl Archive Network"), where the file
"Data-Locations-3.0.tar.gz" should be found in any of the
following directories:
.../CPAN/authors/id/STBEY/
.../CPAN/modules/by-category/06_Data_Type_Utilities/Data/
.../CPAN/modules/by-module/Data/
To find a CPAN ftp site, you can either direct your web browser to
http://www.perl.com/CPAN/authors/id/STBEY/Data-Locations-3.0.tar.gz
(which will automatically redirect you to a CPAN ftp server near you) or
look into "The Perl 5 Module List" by Tim Bunce and Andreas Koenig either
on USENET in the "comp.lang.perl.modules" newsgroup or at
http://www.perl.com/CPAN/modules/00modlist.long.html
New features in version 3.0:
----------------------------
Two new modules have been added to this distribution:
"Data::Locations::Proxy" and "Data::Locations::Shell".
The first is needed for technical reasons only; the latter is a shell
which makes the handling of locations which are tied to file handles
more comfortable:
The advantage of having "Data::Locations::Shell" is that you don't need
TWO object references for the SAME location anymore: One for the location
itself and one for the file handle the location has been tied to.
Instead, you have only ONE object reference you can do everything with:
Use it as a file handle in Perl's built-in functions for dealing with files,
AND use it to invoke methods from the "Data::Locations" class, at the same
time!
Note that "Data::Locations::Shell" needs Perl 5.004 (or higher) in order
to run (whereas "Data::Locations" can do with previous versions of Perl).
Additionally, the two methods "set_filename()" and "get_filename()" have
been replaced by a single method, "filename()". Wether the filename of the
given location is set or returned depends on wether this method is called
with or without a filename argument, respectively.
To adapt your programs, you only need to replace "set_filename" and
"get_filename" by just "filename" using global text search & replace.
That's all.
New features in version 2.0:
----------------------------
In version 2.0, the following new methods and features have been added:
* $location->printf($format,@items); # equivalent of the C library "printf"
* $item = $location->read(); # to read the contents item by item
* @list = $location->read(); # to read the contents all at once
* $location->reset(); # reset the pointer for "read()"
* Data::Locations->reset(); # reset ALL locations at the same time
* $location->tie('FILEHANDLE'); # tie locations to symbolic filehandles
* $location->tie($filehandle); # tie 'em to file handle references...
* print @items; # do $location->tie('STDOUT'); first!
# (or "select(FILEHANDLE);")
* print FILEHANDLE @items;
* printf $format, @items; # (select() and tie() to default first)
* printf FILEHANDLE $format, @items;
* $item = <FILEHANDLE>; # to read the contents item by item
* @list = <FILEHANDLE>; # to read the contents all at once
In addition to these new features, the name of this module has been changed
slightly in order to satisfy the naming conventions of CPAN (= Comprehensive
Perl Archive Network) and The Perl 5 Module List:
Use global search & replace to substitute "Data::Locations" for "Locations"
in all your programs that "use Locations;".
Note also that tying locations to file handles requires Perl version 5.004
(or higher), whereas this module is otherwise perfectly happy with previous
versions of Perl 5 as well! (But see the "Preliminary steps for use with
Perl versions prior to 5.004" in the file "INSTALL" in this distribution)
What does it do:
----------------
Data::Locations - recursive placeholders in the data you generate
"Locations" free you from the need to GENERATE data in the
same order in which it will be USED later.
They allow you to define insertion points in the middle of your
data which you can fill in later, at any time you want!
For instance you do not need to write output files in rigidly
sequential order anymore using this module.
Instead, write the data to locations in the order which is the most
appropriate and natural for you!
When you're finished, write your data to a file or process it otherwise,
purely in memory (faster!).
Most important: You can nest these placeholders in any way you want!
Potential infinite recursions are detected automatically and refused.
This means that you can GENERATE data ONLY ONCE in your program and
USE it MANY TIMES at different places, while the data itself is stored
in memory only once.
Maybe a picture will help to better understand this concept:
Think of "locations" as folders (or drawers) containing papers
in a sequential order, most of which contain printable text or
data, while some may contain the name of another folder (or drawer).
When dumping a location to a file, the papers contained in it are
printed one after another in the order they were originally stored.
When a paper containing the name of another location is encountered,
however, the contents of that location are processed before continuing
to print the remaining papers of the current location. And so forth,
in a recursive descent.
Note that you are not confined to dumping locations to a file,
you can also process them directly in memory (you can read back
the contents of any given location item after item or all at once)!
Note further that you may create as many locations with as many
embedded locations, as many nesting levels deep as your available
memory will permit.
Not even Clodsahamp's multidimensionally expanded tree house (see
Alan Dean Foster's fantasy novel "Spellsinger" for more details!)
can compare with this! :-)
Possible applications of this module are for example:
- source code generation
- web page generation
- generating mail messages in mime format
- filling in forms
- ...
Let your fantasy go wild inventing more applications!
(And tell me about them!)
See the "Tie::Handle(3)" manpage and the example given at the end of the
"Data::Locations(3)" manpage for how to tie data locations to file handles
in order to further simplify writing data to and reading data from locations.
See the "Data::Locations::Shell(3)" manpage for even more ease of use:
Use only ONE object reference instead of TWO (one for the location itself
and one for the file handle the location has been tied to) which you can
use as a file handle AND as a "Data::Locations" object reference, at the
same time!
Note that this module is fully compatible with "Data::Locations",
i.e., if you change all occurrences of "Data::Locations" in your
program to "Data::Locations::Shell", your program should work
exactly as before - with the added benefit that you don't need to
"tie()" your locations to a file handle explicitly anymore in order
to be able to use "print $location @items;" and "$item = <$location>;",
for instance.
Credits:
--------
Many thanks go to Mr. Gero Scholz (now at the Dresdner Bank in Frankfurt,
Germany) for writing the "ProMAC" macro processor (some sort of a precursor
to Perl in spirit!) and implementing the concept of "locations" there, which
inspired me to write this Perl module!
Mr. Scholz himself owes his inspiration to the "DELTA" macro processor
(a tool largely used during the seventies, as it seems) where a rudimentary
version of the concept of "locations" was implemented and where this name
("locations") seems to have been used for the first time.
Author's note:
--------------
I hope you will find this module beneficial!
Share and enjoy!
Yours,
--
Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
"There is enough for the need of everyone in this world,
but not for the greed of everyone." - Mahatma Gandhi
>> Unsolicited commercial email goes directly to /dev/null <<
------------------------------
Date: 30 Jul 1997 23:52:17 GMT
From: millerb@PROBLEM_WITH_INEWS_GATEWAY_FILE (Bryan Miller)
Subject: GetOpt::Long - Corequisite options?
Message-Id: <5rok3h$sbu@fcnews.fc.hp.com>
Hello all,
I've been scouring the docs for GetOpt::Long and haven't seen
anything that deals with corequisite options. Has anybody
done this kind of thing already?
What I'd like to do is require the user to use -blech if they
have specified option -bar. I can do this with a pile of
"if" statements but I would prefer the tidiness and consistency
of a package. If there is enough interest I will put something
together and bounce it off Johan.
Another thought. Perhaps it would be simpler to use one option
but to require two arguments. I don't see a method for doing
this either.
cheers,
Bryan
------------------------------
Date: 29 Jul 1997 12:54:57 -0400
From: jjasen1@umbc.edu (John "E.R." Jasen)
Subject: Re: HELP: perl 5.001 WinNT
Message-Id: <5rl791$5ej@umbc9.umbc.edu>
In article <33DDF4FD.2D1F@cs.bu.edu>, Leonid Lamburt <leonid@cs.bu.edu> wrote:
>nor
> opendir MYDIR "c:\somedir";
> @all_files = readdir MYDIR;
> print @all_files;
>works
try open (DIR, "| dir c:\somedirectory") or some such...
>
>What is going on?
>(I am running the script directly on my machine)
--
"What do you want?" -- Mr. Morden, Microsoft Sales VP
-- John E. Jasen // Systems Alchemist \\ jjasen1@umbc.edu --
-- My views are not those of UMBC, AFAIK. HTH. HAND. --
------------------------------
Date: Tue, 29 Jul 1997 20:01:21 -0600
From: Randal Pittelli <pittelli@ehsct7.envmed.rochester.edu>
Subject: Re: HELP: perl 5.001 WinNT
Message-Id: <870224051.130@dejanews.com>
Use a forward-slash:
opendir(DIR,'/some-dir-from-root/');
print join("\n",readdir(DIR));
closedir(DIR);
-Randy
In article <33DDF4FD.2D1F@cs.bu.edu>,
Leonid Lamburt <leonid@cs.bu.edu> wrote:
>
> I installed perl 5.003_07 from ActiveWare on NT
>
> neither
> $files = `dir c:\somedir /B`;
> print $files;
>
> nor
> opendir MYDIR "c:\somedir";
> @all_files = readdir MYDIR;
> print @all_files;
> works
>
> What is going on?
> (I am running the script directly on my machine)
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 29 Jul 1997 12:24:23 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "M. Mustun" <mustun@active.ch>
Subject: Re: I'm looking for a perl logo...
Message-Id: <8cyb6p3bmg.fsf@gadget.cscaper.com>
>>>>> "M" == M Mustun <mustun@active.ch> writes:
M> I'm looking for a perl logo?
M> Where can I get Perl logos/pictures?
Perl doesn't have a Logo.
I suspect there are many pearls in Logo, however. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 398 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 30 Jul 1997 18:02:28 -0400
From: Joel Haspel <jhaspel@intr.net>
Subject: In-line PERL in C/C++
Message-Id: <33DFB9F3.16D458B9@intr.net>
Does anyone know how to inline PERL in C or C++ code? If so, any
pointers would be extremely helpful.
Thanks,
Joel
------------------------------
Date: 30 Jul 1997 00:06:09 GMT
From: dmi@delta1.deltanet.com (Dean Inada)
Subject: Re: interesting sorting problem
Message-Id: <5rm0hh$8ee$1@news01.deltanet.com>
In article <33DDB2B5.41C67EA6@csfp.co.uk>,
Paul Cunnell <pcunnell@csfp.co.uk> wrote:
>Larry D'Anna wrote:
>>
>> Craig Ciquera wrote:
>>
>> > Sorry, I should have been more specfic. I would like to obtain the
>> > foillowing from the list below:
>> >
>> > 0.0.2.2
>> > 0.0.3.0.1.0
>> > 0.0.4.0
>> > 1.0.1.0
>> > 1.0.1.1
>> > 2.0.0.2
>> > 17.0
>> > 17.6
>> > 18.0.0.2
>> > 34.1
>> >
>> > So basically, I would like to sort on all '.' separated fields and
>> > have
>> > the output appear in ascending order.
>>
>
>Or there's the (in)famous Schwartzian Transform, which with
>a reasonable amount of data will save you a zillion splits.
>(http://www.5sigma.com/perl/schwtr.html)
>
>@stuff = qw(1.0.1.0 1.0.1.1 17.0 17.6 2.0.0.2 18.0.0.2 34.1 0.0.4.0
>0.0.2.2 0.0.3.0.1.0);
>
sub ST(&@){
my $metric=shift;
map {$_->[0]}
sort {$a->[1] cmp $b->[1]}
map {[$_,&{$metric}]} @_
}
@sorted_stuff = ST {pack "N*",split(/\./)} @stuff;
>
>print join("\n", @sorted_stuff), "\n";
>
------------------------------
Date: Wed, 30 Jul 1997 17:57:20 -0400
From: Gerge <jgeorgas@chat.carleton.ca>
Subject: makefile won't run
Message-Id: <33DFB8C0.57E8@chat.carleton.ca>
This is probably easy to fix for some one who knows how, but it has me
stifled. I am trying to build the latest version of perl under Linux,
but the makefile produced after the sh Configure( or CC=gcc ./configure
etc.) does not run. I tried it both as root and as su under a different
user. The error I keep getting is something like : make:2 *** missing
separator. Stop. No alterations of the makefile I tried helped. The 1st
part of my makefile (which may be like everyone else's) is:
#! /bin/sh
case $CONFIG in
'')
if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;
elif test -f ../../config.sh; then TOP=../..;
elif test -f ../../../config.sh; then TOP=../../..;
elif test -f ../../../../config.sh; then TOP=../../../..;
else
echo "Can't find config.sh."; exit 1
fi
. $TOP/config.sh
;;
esac
: This forces SH files to create target in same directory as SH file.
: This is so that make depend always knows where to find SH derivatives.
A solution would be very much appreciated, thanks.
P.S. Even though I re-downloaded the source, I kept getting a warning
that the set was incomplete because I was missing perly.c.diff.
------------------------------
Date: Tue, 29 Jul 1997 13:39:45 -0500
From: "Rowland I. Nicholson" <nichori@cat.com>
Subject: Re: Need help on fork FAQ
Message-Id: <33DE38F1.502F@cat.com>
Solved my own problem. It works fine on a Netscape server, but
doesn't on the NCSA server I was using. Here's my sample code
#!/usr/local/bin/perl
$|;
print "Content-type: text/html\n\n";
if ($pid = fork) {
print "Forked process is $pid.<br>\n";
print "Output is <a href=\"/test.htm\">test.htm</a>\n";
close(STDOUT);
exit(0);
} else {
exec("./test2 < /dev/null > ../htdocs/test.htm 2>&1 &");
exit(0);
}
Rowland
> I'm trying to launch an application, which takes 4 minutes to run,
> without the browser having to wait for it to finish. I found the
> following from the FAQ at:
> ftp://ftp.dti.ad.jp/pub/lang/CPAN/doc/manual/html/pod/perlfaq8/How_do_I_fork_a_daemon_proces_.html
>
> >How do I fork a daemon process?
> >
> >If by daemon process you mean one that's detached (disassociated from its tty), then the following process is reported to work on most
> >Unixish systems. Non-Unix users should check their Your_OS::Process module for other solutions.
> >
> > * Open /dev/tty and use the the TIOCNOTTY ioctl on it. See tty(4) for details.
> >
> > * Change directory to /
> >
> > * Reopen STDIN, STDOUT, and STDERR so they're not connected to the old tty.
> >
> > * Background yourself like this:
> >
> > fork && exit;
>
> I've experimented with this but have not gotten it to work yet. Has
> anyone
> got some code that works (launches the application and closes the
> browser
> connection without waiting). Thanks in advance.
>
> Rowland
------------------------------
Date: Tue, 29 Jul 1997 16:45:41 -0600
From: Jason Pociask <pociask@maricopa.edu>
Subject: Need Win32 Perl guru phone help - will pay cash
Message-Id: <33DE7295.266A@maricopa.edu>
I'm trying to install Perl5.003 (Activeware build 307) on a Win95 PC
(P166).
PERL itself installs fine -- I have a couple Perl programs that I
developed
on Unix that run fine on the Win95 PC also.
But what I really want to do is add the LIBWWW-PERL-5.10 modules so I
can do some web stuff (Mostly getting URL's to parse the returned
pages).
The docs for LIBWWW-PERL5.10 say that there are 4 other modules that
must
be installed first:
" We recommend that you have
the following packages installed before you install libwww-perl:
MIME-Base64-#.##
IO-#.## (bundled with perl5.004 and better)
libnet-#.##
MD5-#.## "
OK, so I pulled those off CPAN, and after GZIP/TAR'ing them out, I try
to follow the directions in the first one, the Base64 module:
VVVVVV... (I typed this stuff)
C:\perl\Modules\MIME-Base64-2.01>perl makefile.pl > save.errs
substr outside of string at C:\perl\lib/ExtUtils/MM_Win32.pm line 138.
Warning: PERL_LIB () seems not to be a perl library directory
(Exporter.pm not found) at (eval 3) line 298.
substr outside of string at C:\perl\lib/ExtUtils/MM_Win32.pm line 138.
Can't open perl script "\ExtUtils\xsubpp": No such file or directory
And...
Here's the contents that were written to "save.errs" in addition to the
above:
C:\perl\Modules\MIME-Base64-2.01>type save.errs
CONFIG key 'ar' does not exist in Config.pm
CONFIG key 'lib_ext' does not exist in Config.pm
CONFIG key 'obj_ext' does not exist in Config.pm
CONFIG key 'sitearchexp' does not exist in Config.pm
CONFIG key 'exe_ext' does not exist in Config.pm
Have C:\perl\lib\Config.pm expected \Config.pm
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [lib]
Config says: [i386-win32]
This may or may not cause problems. Please check your installation
of perl if you
have problems building this extension.
Writing Makefile for MIME::Base64
C:\perl\Modules\MIME-Base64-2.01>
What the hell is going on here? I have pulled and installed both the
PW32I307.EXE file and the PW32S307.ZIP source code files from the
activeware site (God bless then, there's no directions anywhere on
how exactly to install the two of them).
The README.TXT file in /perl/docs/PERL-WIN refers to a file called
"install.txt"... so I do a DIR/S INSTAL*.* and there's no such file
anywhere (just an install.log and a couple install.pm files).
I'd pay cash money to anyone willing to spend 120 seconds on the phone
with me to explain how you can get libwww-perl-5 installed and working
with Activeware perl 5.003/307 on Win95. Seriously. I need it working,
"stat", for a project and if it means shelling out for 3 minutes of a
Win32 Perl guru's time, so be it.
For example, there are references to a "make" command or utility, is
this really used on the Win32 platforms?
-Jason Pociask
------------------------------
Date: Wed, 30 Jul 1997 04:14:22 GMT
From: dilcher@cueva.com
Subject: Perl Code for Paragraph Justification?
Message-Id: <201f21db.9590481@news.mindspring.com>
I am looking for a piece of perl code or a program to automatically
justify the paragraphs in a document based on a particular line
length.
If anyone is familiar with the control-J justification in "Pico", this
is what I am trying to do via Perl code.
Can anyone help me out?
direct email graciously appreciated,
-Jeff Dilcher
Atlanta, GA
------------------------------
Date: 30 Jul 1997 15:53:46 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Script with Netscape 4.01
Message-Id: <8chgdc179h.fsf@gadget.cscaper.com>
>>>>> "Tom" == Tom Phoenix <rootbeer@teleport.com> writes:
Tom> Perl neither knows nor cares what version your browser is. In
Tom> fact, it has no idea that browsers exist. As far as Perl is
Tom> concerned, it's all just data in and data out.
How do you know it hasn't developed a mythology around where that data
must be coming from and going to? Passed down from the great Perl 0,
via Perl 1, and Perl 2, on to the current Perl 5.004_01. Perhaps
branch cults have developed, thinking that not all of the data must be
from files and "the user" anymore, but "gasp!" other machines via
"gasp!" browsers. Of course, these Perl cults were probably shunned
by the majority of the centrists and orthodox Perls.
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 397 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 30 Jul 1997 00:25:53 GMT
From: "Barry Roomberg" <broomberg@ccgroupnet.com>
Subject: PERL/SOCKETS/Network advice requested
Message-Id: <01bc9c7c$85dd93a0$c20b67cf@seawolf>
I'm looking for some direction here.
Any advice would be appreciated.
Situation:
Multiple processes running on 1 or several Unix
systems. Systems may be SCO, LINUX, Solaris,
AIX, HP-UX, etc. The processes are in PERL.
Initial development will be SCO, and then ported to others.
These processes must communicate with a management "console",
hopefully a browser, either NS or IE.
Each of these processes would occupy a window (or frame) in the
console app (browser). They would send messages and receive
responses from the operator.
All systems would be TCP/IPed together on a local net, most likely
never even router hopped, since the app is controlling a local piece
of hardware and prompting for user operation.
I'm trying to figure out how the backend/frontend interaction will work.
Possible solution:
Each backend process queries the local net, scanning ip addresses on
a predetermined port.
If it finds the console app running, it registers with it and is given
the next available port for future communications.
On an ongoing basis, the console app checks all active/registered backend
processes, display messages as required, and prompting the operator for
input as required to send back to the back-end.
What I already know:
PERL
SQL
Database interaction
Unix/Xenix
C
Client server (as a luser)
tcp/ip setup (as a luser)
What I'll probably have to learn:
Socket programming (PERL)
????? HTML, JAVA, BROWSER SETUP, ????
How about Penguin?
Anybody have any direction to point me, books to read,
FAQs to digest, etc?
Thanks for reading this far.
------------------------------
Date: Wed, 30 Jul 1997 17:45:01 -0400
From: Joe Kline <Joe.Kline@sdrc.com>
Subject: Print Web Page a la netscape
Message-Id: <33DFB5DD.794B@sdrc.com>
Anyone,
I want a script that dumps a web page to a printer.
I have looked through a great many resources (FAQ,
Dejanews, _CGI Programming_, Blue Camel, Randall's Web
Techniques,...) and all I seem to find is how to download
the source document of the web page.
What I am looking for is a way to print the web page the way it
looks viewed through a browser (something similar to the print
icon in netscape).
Please inform me if I missed something in the documentation.
Thanks,
joe
--
/=================================\
| Joe Kline=>Joe.Kline@sdrc.com |
| Try not. |
| Do or do not. |
| There is no try. |
| -Yoda |
\=================================/
------------------------------
Date: 29 Jul 1997 13:55:00 -0400
From: radev@news.cs.columbia.edu (Dragomir R. Radev)
Subject: Q: perlembed and memory leaks - help!
Message-Id: <5rlapk$c5b@bluewhale.cs.columbia.edu>
I am using perlembed to access several Perl scripts from within a C
program. Everything works the way that I want, except for the memory
leaks. The main C process keeps growing at a very fast rate with every call
to perl_parse().
I have declared all relevant variable as "my". I have made sure that the
perl interpreter gets initialized only once.
Any solution to my problem?
Thanks in advance.
D.
--
Dragomir R. Radev Graduate Research Assistant
Natural Language Processing Group Columbia University CS Department
H: 212-749-9770 O: 212-939-7121 http://www.cs.columbia.edu/~radev
------------------------------
Date: Wed, 30 Jul 1997 18:22:08 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: Question: MacPerl & "require"
Message-Id: <Matthew.Healy-3007971822080001@pudding.med.yale.edu>
In article <33D6B9CE.2781@eecs.ukans.edu>, Mousheng Xu
<mxu@eecs.ukans.edu> wrote:
...>
> Everything is OK. But in MacPerl, I always get an error message
> 'common.cgi' did not return a true value.
Sounds to me as though the problem has nada to do with the
fact that it's running on a Mac. Sounds like your common.cgi
does not return a value of true. The last line in any code
to be called with require, on any platform, must be something
like
return 1;
Which returns a nonzero, ie, true, value. This is how require
knows that it succeded.
If in fact your code _does_ end with return 1, then you need
to check @INC to be sure the include file is located somewhere
that Perl looks for suchlike...
--------
Matthew.Healy@yale.edu http://ycmi.med.yale.edu/~healy/
As of 29 Jul 1997, only 885 days until Y2K....
Any person with a phone line can become a town crier with a voice
that resonates farther than it could from any soapbox.
--The US Supreme Court, overturning the Communications Decency Act
------------------------------
Date: 30 Jul 1997 11:58:50 GMT
From: "Liam Bateman" <liam@dircon.co.uk>
Subject: Search a CSV database
Message-Id: <01bc9ce8$83ae1160$763970c2@pennys>
Hi All,
I have a database file, 500 records each record has about 10 fields!
The file is saved as CSV (Comma Delimited)
How do I, using one search, search three 'address' fields for a given
string.
i.e. house, street, county
Any help would be appreciated, as this is for a web page.
I have two years Pascal experience, I am just learning PERL and was
wondering if there is a built in module to do this, a library/unit/any
thing.
Or if anyone has a script to do this that I may play with and adjust!
Please email any replies liam@dircon.co.uk
Thanks,
Liam
--
liam@dircon.co.uk <Liam Bateman>
------------------------------
Date: Wed, 30 Jul 1997 04:04:05 GMT
From: mingtian@hotmail.com (Gil)
Subject: Re: security holes in perl 5.00401 @_@
Message-Id: <33debc4c.2060650@usenet.kornet.nm.kr>
Russ Allbery <rra@stanford.edu> wrote:
>Gil <mingtian@hotmail.com> writes:
>
>> earth.gaianet.net has hacked by someone, the system admin told me it was
>> perl 5.00401, the hacker deleted /bin/sh using perl 5.00401's security
>> holes..
>
>> any opinion on this?
>
>Yes. "Show me." (Not aimed at you, but aimed at the system admin.) If
>5.004_01 has holes, I'd like to know about them. A lot of effort was
>expended in trying to make sure that it was secure, but it's always
>*possible* that something was missed.
the admin said the hacker told them he used Perl's security hole..
I don't know futher more about it :)
>On the other hand, with nothing to go on besides just that statement, my
>inclination would be to discount the story entirely. I'd need to see real
>proof that there was a hole.
the admin said netcom.net's dial up connecting system has also hacked..
>(And note that if you don't install suidperl there really isn't much
>chance for people to exploit security holes in Perl itself.)
what's suidperl?
...
Gil
Homepage: http://soback.kornet.nm.kr/~chlang/
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
!F 1W4k 3*?!0T4B >pA&3* GQ<[@L 2I@L?4@84O 0q8q1f 59>F3*?@4B !F
"> 594c ?6?!<- H/Hw 9L<RA~0m @V4B 5i2I GQ<[@L?M55 00>F ">
!F H%@Z@V>n >5>5GQ 3*@G 0!=??! Hq8A@; @|GXAV4x 2I !F
!F "4^7!<- >HAV8i ;/>n6s" !F
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
------------------------------
Date: 29 Jul 1997 17:37:44 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: security holes in perl 5.00401 @_@
Message-Id: <m3n2n51ijr.fsf@windlord.Stanford.EDU>
Gil <mingtian@hotmail.com> writes:
> earth.gaianet.net has hacked by someone, the system admin told me it was
> perl 5.00401, the hacker deleted /bin/sh using perl 5.00401's security
> holes..
> any opinion on this?
Yes. "Show me." (Not aimed at you, but aimed at the system admin.) If
5.004_01 has holes, I'd like to know about them. A lot of effort was
expended in trying to make sure that it was secure, but it's always
*possible* that something was missed.
On the other hand, with nothing to go on besides just that statement, my
inclination would be to discount the story entirely. I'd need to see real
proof that there was a hole.
(And note that if you don't install suidperl there really isn't much
chance for people to exploit security holes in Perl itself.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 29 Jul 1997 23:42:03 GMT
From: toutatis@remove.this.toutatis.net (Toutatis)
Subject: use vars & global variables
Message-Id: <toutatis-ya023180003007970142140001@news.euro.net>
I traced several replies on the "use vars qw($var)" header, but none of them
were completely clear to me.
This is my code, that does NOT do what I want:
####script1.pl###
#!/usr/bin/perl -w
package main;
use strict;
use Module.pm;
require 'script2.pl'
use vars qw($time $id $databasehandle $input);
$time = time; #etcetera
#I want to be able to access these variables *whithout* having
#to say $main::time, or $::$id. For laziness, and I also hope to get
#rid of the "used only once" -w errors (a problem I still did not
#read a satisfying answer for).
####Module.pm####
package module;
use vars qw($time $id $databasehandle $input);
#in script1.pl declared variables are not visible
####script2.pl####
use vars qw($time $id $databasehandle $input);
#Also here, variables declared in script 1, are not visible.
print $time; #does not work
Hope sombody helps.
--
Toutatis
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 796
*************************************