[7489] in Perl-Users-Digest
Perl-Users Digest, Issue: 1115 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 2 12:07:14 1997
Date: Thu, 2 Oct 97 09:00:32 -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 Thu, 2 Oct 1997 Volume: 8 Number: 1115
Today's topics:
[HELP] I need a CGI but don't know perl (Tobias Batch)
Re: [Q] multi-dim hash -> DB? (Thierry Guillotin)
A Tricky Question!! (Claudia Ma)
Re: A Tricky Question!! (Jeremy D. Zawodny)
Re: a2p (newbie question) (Keith Willis)
Re: accessing a printer's status via socket?... <kevinl@ascend.com>
Re: associative arrays prob (Bart Lateur)
Re: associative arrays prob <rootbeer@teleport.com>
Re: Change /etc/passwd (Jeremy D. Zawodny)
Re: convert ms word document to plain text <bewins@gssec.bt.co.uk>
Deleting duplicates in an array <chaffee@cpdmfg.cig.mot.com>
Re: Deleting duplicates in an array (Tom Grydeland)
Re: Deleting duplicates in an array (Mike Stok)
Re: expect lib for perl? (Danny R. Faught)
Re: FilePush Browser Probs <rootbeer@teleport.com>
Re: Generating bit patterns "00000000" .. "11111111" <seay@absyss.fr>
Re: How to write a context sensitive subroutine in PERL <rootbeer@teleport.com>
Re: Multiple Simultaneous prints??? <rootbeer@teleport.com>
Re: Multiple Simultaneous prints??? <rootbeer@teleport.com>
Re: New CGI Web Site <rootbeer@teleport.com>
Re: oraperl (Clay Irving)
Re: post-query form help! <rootbeer@teleport.com>
usemymalloc (Malcolm Hoar)
Why is PERL a good prototyping language? <ncabrera@attila.stevens-tech.edu>
Re: Why is PERL a good prototyping language? (Raymond Morsman)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 02 Oct 1997 14:25:15 GMT
From: toby@io.com (Tobias Batch)
Subject: [HELP] I need a CGI but don't know perl
Message-Id: <3434ac84.18116149@reading.news.pipex.net>
I, for my sins, am a java developer, java is the only language that I
know and work in and I've come up against a problem. My ISP does not
support server side java which until now has not been a problem. Up
until now any CGI I had to write was quite simple and I have been able
to struggle through using common sense, research and shell script but
now I have real big problem.
I have a java applet that allows a user to select a number of gif's
that are drawn overlaying each other (so that the transparent area's
reveal the gif underneath). I grab this Image and create a gif using
this data, this gif I want the user to be able to print but to do that
I need to get it onto the server.
Is there anybody who could write me a CGI that starts, creats a socket
on a known port that my applet would connect to, writes the byte
stream from that socket to a file (the filename being
$REMOTE_ADDR.gif) and returned the file name as the CGI response?
I can't offer much, but you can have a copy of my applet (source and
all).
------------------------------
Date: 2 Oct 1997 08:34:04 GMT
From: guilloti@ghibli.centsci.france.ibm.com (Thierry Guillotin)
Subject: Re: [Q] multi-dim hash -> DB?
Message-Id: <60vm9s$p46$1@grimsel.zurich.ibm.com>
In article <3430D191.41C6@heidelbg.ibm.com>,
Stefan Geissler <geissler@heidelbg.ibm.com> writes:
>Hi,
>
>in my latest perl-script I build a trie structure for a lexicon
>by using multi-dimensional hashes. That is, the information
> "sleep verb"
>is stored as
> "$Trie{s}{l}{e}{e}{p}{cat} = "verb";
>
>It's a big lexicon, and once the trie is computed, I'd like to
>store it in a file for later reuse.
>
> dbmopen(%FileTrie,"myhash",0666);
> %FileTrie = %Trie;
> dbmclose(%FileTrie);
>
>But when I reopen the "myhash" file the information about
>the second and all the further "dimensions" seems to be lost.
>
>I'm sure there more than one way to do it. But how?
>(Is there a simple one which doesn't require any non-standard
>DB modules?)
>
>Thanks a lot for every hint,
>--stefan
>
>--
>_______________________________________________________________________
>: Stefan Geissler, stefan.geissler@heidelbg.ibm.com :
>:Inst. fuer Logik und Linguistik, IBM Deutschland Informationssysteme :
>:Vangerowstr 18, D-69115 Heidelberg, Tel/Fax. 0049-6221-59-{4482/3200}:
>:_____________________________________________________________________:
--
Hi Stephan,
This situation is normal with the kind of DBM interface yu use.
Yu might find usefull things in the module list [edited/expurged version]
around DBM for multidimentional arrays and around Tries:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^
:::::::::::::::::::::::::::::::::::::::::::::::
Archive-name: perl-faq/module-list
Revision: 2.21 1996/03/21 22:16:16
The Perl 5 Module List Maintained by Tim Bunce <Tim.Bunce@ig.co.uk>
====================== $Revision: 2.21 $$Date: 1996/03/21 22:16:16 $
Where Are The Modules Kept?
A Comprehensive Perl Archive Network (CPAN) of mirrored FTP sites is
being developed. Within the CPAN scheme the modules described in this
list can be found in a modules/ directory below the CPAN root directory.
Try one of these places first:
Africa
South Africa
ftp://ftp.is.co.za/programming/perl/CPAN/
Asia
Japan
ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/
Taiwan
ftp://dongpo.math.ncu.edu.tw/perl/CPAN/
Australasia
Australia
ftp://coombs.anu.edu.au/pub/perl/
ftp://ftp.mame.mu.oz.au/pub/perl/CPAN/
New Zealand
ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/
Canada
British Columbia
ftp://mango.pinc.com/pub/perl/CPAN/
Europe
Czech Republic
ftp://sunsite.mff.cuni.cz/Languages/Perl/CPAN/
Finland
ftp://ftp.funet.fi/pub/languages/perl/CPAN/
France
ftp://ftp.ibp.fr/pub/perl/CPAN/
ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/
Germany
ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/
ftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
Poland
ftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
Portugal
ftp://ftp.ci.uminho.pt/pub/lang/perl/
Slovenia
ftp://ftp.arnes.si/software/perl/CPAN/
Sweden
ftp://ftp.sunet.se/pub/lang/perl/CPAN/
Switzerland
ftp://ftp.switch.ch/mirror/CPAN/
the Netherlands
ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
UK
ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
ftp://unix.hensa.ac.uk/mirrors/perl-CPAN/
USA
Florida
ftp://ftp.cis.ufl.edu/pub/perl/CPAN/
Illinois
ftp://uiarchive.cso.uiuc.edu/pub/lang/perl/CPAN/
Massachusetts
ftp://ftp.delphi.com/pub/mirrors/packages/perl/CPAN/
Oklahoma
ftp://ftp.uoknor.edu/mirrors/CPAN/
Texas
ftp://ftp.metronet.com/pub/perl/
ftp://ftp.sedl.org/pub/mirrors/CPAN/
ftp://ftp.sterling.com/CPAN/
Part 2 - The Perl 5 Module List
===============================
The remainder of this document is divided up into sections. Each
section deals with a particular topic and lists all known modules
related to that topic. Modules are only listed in one section so
check all sections that might related to your particular needs.
All the information corresponds to the latest updates I have received.
I don't record the version number or release dates of the listed
Modules. Nor do I record the locations of these Modules. Consult the
contact, try the usual perl archive sites or ask in comp.lang.perl.misc.
Please do *not* ask me directly, I simply don't have the time. Sorry.
1) Module Listing Format
Each Module listing is very short. The main goal is to simply publish
the existence of the modules, or ideas for modules, and enough contact
information for you to find out more. Each listing includes some
characters which convey (approximate) basic status information.
For example:
Name DSLI Description Info
------------- ---- -------------------------------------------- -----
Fcntl Sdcf Defines fcntl() constants (see File::Lock) JHI
Where the 'DSLI' characters have the following meanings:
D - Development Stage (Note: *NO IMPLIED TIMESCALES*!):
i - Idea, listed to gain consensus or as a placeholder
c - under construction but pre-alpha (not yet released)
a/b - Alpha/Beta testing
R - Released
M - Mature (no rigorous definition)
S - Standard, supplied with Perl 5
S - Support Level:
m - Mailing-list
d - Developer
u - Usenet newsgroup comp.lang.perl.misc
n - None known, try comp.lang.perl.misc
L - Language Used:
p - Perl-only, no compiler needed, should be platform independent
c - C and perl, a C compiler will be needed
+ - C++ and perl, a C++ compiler will be needed
o - perl and another language other than C or C++
I - Interface Style
f - plain Functions, no references used
r - some use of unblessed References or ties
O - Object oriented using blessed references and/or inheritance
Where letters are missing they can usually be inferred from the
others. For example 'i' implies 'id', 'S' implies 'Su'.
The Info column gives a contact reference 'tag'. Lookup this tag in the
"Information / Contact Reference Details" section in Pert 3 of this
document. If no contact is given always try asking in comp.lang.perl.misc.
Most Modules are nested in categories such as IPC::Open2 and IPC::Open3.
These are shown as 'IPC::' on one line then each module listed below
with a '::' prefix.
Ideas For Adoption
Modules listed as in the 'i' Development Stage with no contact
reference are ideas without an owner. Feel free to 'adopt' these but
please let me know so that I can update the list and thus inform anyone
else who might be interested. Adoption simply means that you either
hope to implement the module one day or would like to cooperate with
anyone else who might be interested in implementing it.
Cooperation
Similarly, if an idea that interests you has been adopted by someone
please contact them so you can share ideas. Just because an idea has
been adopted does NOT imply that it's going to be implemented. Just
because a module is listed and being implemented does NOT mean it'll
get finised. Waiting silently in the hope that the Module will appear
one day is unlikely to be fruitful! Offer to help. Cooperate. Pool your
efforts. Go on, try it!
The same applies to modules in all states. Most modules are developed
in limited spare time. If you're interested in a module don't just wait
for it to happen, offer to help.
Module developers should feel free to announce incomplete work early.
If you're not going to be able to spend much time on something then say
so. If you invite cooperation maybe someone will implement it for you!
_______________________________________________________________________
6) Data Types and Data Type Utilities (see also Database Interfaces)
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
Array::
::Vec idp Implement array using vec() LWALL
::Substr idp Implement array using substr() LWALL
::Virtual idp Implement array using a file LWALL
::PrintCols adpf Print elements in vertically sorted columns AKSTE +
Set::
::Scalar adpO Set of scalars (inc references) JHI
::IntegerFast adcO Set of positive integers (in C) STBEY
::IntSpan adpO Set of integers newsrc style '1,5-9,11' etc SWMCD
Tie::
::Hash Supr Base class for implementing tied hashes
::Scalar Supr Base class for implementing tied scalars
::Array i
::SubstrHash RdpO Very compact hash stored in a string LWALL
::ShiftSplice i Defines shift et al in terms of splice LWALL
::Mem adcO Bind perl variables to memory addresses PMQS
::File adpr Tie hash to files in a directory AMW
::IxHash RdpO Indexed hash (ordered array/hash composite) GSAR
::Quick i Simple way to create ties TIMB
::Watch i Uses Tie::Quick to watch a variable TIMB
_______________________________________________________________________
7) Database Interfaces (see also Data Types)
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
DBI amcO Generic Database Interface (see DBD modules) DBIML
DBD::
::Oracle amcO Oracle Driver for DBI TIMB
::Ingres i Ingres Driver for DBI TIMB
::Informix adcO Informix Driver for DBI ADESC
::mSQL amcO Msql Driver for DBI ADESC
::DB2 adcO DB2 Driver for DBI MHM
::Sybase cdpO Sybase Driver for DBI (uses Sybase::CTlib) MEWP
::QBase amcO QBase Driver for DBI BENLI
Oraperl ampf Oraperl emulation interface for DBD::Oracle TIMB
Ingperl i Ingperl emulation interface for DBD::Ingres TIMB
Sybase::
::DBlib RdcO Sybase DBlibrary interface MEWP
::Sybperl Rdpf sybperl 1.0xx compatibility module MEWP
::CTlib bdcO Sybase CTlibrary interface MEWP
Msql RmcO Mini-SQL, a light weight SQL database ANDK
Pg Rdcf Postgres95 SQL database interface MERGL
Datascope Rdcf Interface to Datascope RDBMS DANMQ
Xbase bdpf Read Xbase files with simple IDX indexes PRATP
Tied Hash File Interfaces:
NDBM_File Suc Tie to NDBM files
DB_File Suc Tie to DB files PMQS
GDBM_File Suc Tie to GDBM files
SDBM_File Suc Tie to SDBM files
ODBM_File Suc Tie to ODBM files
AnyDBM_File Sup Uses first available *_File module above
DBZ_File adc Tie to dbz files (mainly for news history) IANPX
MLDBM bdpO Transparently store multi-level data in DBM GSAR
AsciiDB adp Generic text database parsing MICB
Stanza i Text format database used by OSF and IBM JHI
NetCDF bmcr Interface to netCDF API for scientific data SEMM
DTREE cdcf Interface to Faircom DTREE multikey ISAM db JWAT
Fame adcO Interface to FAME database and language TRIAS
_______________________________________________________________________
11) String Processing, Language Text Processing, Parsing and Searching
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
String::
::Edit adpf Assorted handy string editing functions TOMC
::Approx Rdpf Approximate string matching and substitution JHI
::Scanf Rdpf Implementation of C sscanf function JHI
::Parity adpf Parity (odd/even/mark/space) handling WINKO
::BitCount adpf Count number of "1" bits in strings WINKO
::MatchMany adpf Build fast code to match many patterns TOMC
::CRC i cf Assorted standard CRC functions
Language text related modules
Text::
::Abbrev Supf Builds hash of all possible abbreviations
::ParseWords Supf Parse strings containing shell-style quoting
::Soundex Supf Convert a string to a soundex value
::TeX cdpO TeX typesetting language input parser ILYAZ
::Stem bdpf Porter algorithm for stemming English words IANPX
::Tabs Sdpf Expand and contract tabs ala expand(1) MUIR
::Wrap Rdpf Wraps lines to make simple paragraphs MUIR
::Template bdpO Expand template text with embedded perl MJD
::German adpf German language stemming ULPFR +
Search::
::Dict Supf Search a dictionary ordered text file
Other Text:: modules (these should be under String:: but pre-date it)
Text::
::Trie adpf Find common heads and tails from strings ILYAZ
::Parser adpO String parser using patterns and states PATM
SGML::
::Element cdpO Build a SGML element structure tree LSTAF
::SP cd+O Interface to James Clark's Sp SGML parser BARTS
SGMLS RdpO A Post-Processor for SGMLS and NSGMLS DMEGG
Font::
::AFM RdpO Parse Adobe Font Metric files GAAS
Marpa cd+O Context Free Parser JKEGL
Anagram adcf Anangram generator ASHER
_______________________________________________________________________
13) Internationalization and Locale
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
I18N::
::Collate Sdpr Locale based comparisons JHI
::WideMulti i Wide and multibyte character string JHI
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Hope this helps,
Thierry Guillotin
Email: tguillotin@vnet.ibm.com
Tel: 01 40 01 55 53
Fax: 01 49 28 08 60
------------------------------
Date: 2 Oct 1997 15:09:08 GMT
From: maclaudi@cps.msu.edu (Claudia Ma)
Subject: A Tricky Question!!
Message-Id: <610dek$4ln$1@msunews.cl.msu.edu>
Hi there,
I'm working on a project: it goes to some other page, use their search engine
to do a query and get the result back. It's not a big deal -- until my boss
said he didn't want to "go to the other page". In other word, he wants the
"go to the page, enter the query, and click the submit" part being hiden from
user on our interface.
I can't figure out how to make the program "click the submit", and wonder if
this could be done in Perl.
Any ideas?
Thanks a lot!
-Claudia
--
**********************************************************************
-- "Life is an endless process of exploring and creating."
Claudia Y. Ma
Dept. of Computer Science email: maclaudi@cps.msu.edu
Michigan State University http://www.cps.msu.edu/~maclaudi
**********************************************************************
------------------------------
Date: Thu, 02 Oct 1997 15:27:31 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: A Tricky Question!!
Message-Id: <3440bcc1.71373830@igate.hst.moc.com>
[cc'd automagically to original author]
On 2 Oct 1997 15:09:08 GMT, maclaudi@cps.msu.edu (Claudia Ma) wrote:
>Hi there,
Howdy.
>I'm working on a project: it goes to some other page, use their search engine
>to do a query and get the result back. It's not a big deal -- until my boss
>said he didn't want to "go to the other page". In other word, he wants the
>"go to the page, enter the query, and click the submit" part being hiden from
>user on our interface.
That's very confusing sounding, but I *think* I've got he idea...
>I can't figure out how to make the program "click the submit", and wonder if
>this could be done in Perl.
You're asking a more general question, which is something like:
"How can a Perl script submit a form to a web server and get the
results back?"
Well, the Perl script simply has to act as if it's a web browser,
since that's a task usually performed by web browsers. To simplify
your life, you might want to look at the CGI::* and/or LWP::* modules
on CPAN.
The LWP::* modules were designed to make it easier to create web
clients in Perl.
Good Luck,
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Thu, 2 Oct 1997 15:11:41 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: a2p (newbie question)
Message-Id: <3435b8fb.882240534@news>
On Sat, 27 Sep 97 11:12:54 -0400, samdie@ibm.net wrote:
>In <01bccb53$bc7d8cc0$8314410c@boris>, on 09/27/97
> at 02, "Creede Lambard" <creede@worldnet.att.net> said:
>
>> I dunno. I tried both
>> a2p reorg.awk
>> and
>> a2p <reorg.awk
>
>> and they both worked on my system. :\ If you didn't try redirecting stdin
>> you might see if that works better for you, but it looks like you've tried a
>> lot. :D
>
>Yup. Tried that too. Still no output/error message.
I just pasted your awk code into a file junk.awk and ran
'a2p junk.awk' and got (on stdout):
----------------------------------------------------------------------
#!/usr/local/bin/perl
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
# process any FOO=bar switches
$[ = 1; # set array base to 1
$FS = ' '; # set field separator
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
$FS = $, = '|';
line: while (<>) {
chop; # strip record separator
@Fld = split($FS, $_, 9999);
if ($#Fld == 5) {
$Subject{$Fld[1]} = $Fld[4];
next line;
}
$is = substr($Fld[1], 6, 999999);
$sb = substr($Fld[9], 5, 6);
if ($is eq $sb) { #???
next line;
}
print $Fld[4], $Fld[1], $sb, $Subject{$sb};
}
Please check my work on the 1 line I've marked with "#???".
The operation I've selected may be wrong for the operand types.
----------------------------------------------------------------------
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.
------------------------------
Date: 02 Oct 1997 09:22:36 -0400
From: Kevin Lambright <kevinl@ascend.com>
Subject: Re: accessing a printer's status via socket?...
Message-Id: <yhfd8locnab.fsf@ascend.com>
Stephen Cole <scoler@earthlink.net> writes:
...
[snipped]
> We currently can check the que of this plotter & it's
> status using a C program that (I think) was developed by the
> plotter's manufacturer. The plotter is an old Synergy electrostatic
> plotter and the que program is sycom & sycom_d. I don't know
> if anyone out there has any experience with this plotter.
>
> If anyone has any similiar experiences or suggestions,
> I'm all ears..
>
>
> Thanks in advance-
>
> Stephen Cole
Stephen,
I don't have any experience with this plotter, but from your explanation
of the C programs the manufacturer provided (and you may already
know this), my guess is that sycom_d is a daemon that runs on the
host where the plotter resides and sycom is a client program that can
be run from anywhere to get the current status of the plotter. If you
already knew this, then, so far, I haven't been much help :-)
If you don't know the protocol that sycom/sycom_d are using, you are
going to have a difficult time determining how to mimic the same thing
in Perl. Furthermore, if you don't know the commands that sycom_d is
issuing to the plotter to get the status, that is going to be difficult
as well.
You could try to reverse engineer sycom/sycom_d, but this would be
painful and time consuming.
I assume the manafucturer does not have any documentation that describes
either the commands to issue to the plotter to get status, or the
protocol used for communication between sycom/sycom_d. If they do, you
should be able to mimic the behavior in Perl.
Otherwise, I would try one of two things.
1. If you know the port on which sycom_d listens on plotter host, you
can try to telnet to it and determine the (potentially) simple
protocol that sycom uses to get the status.
2. Run sycom from within your Perl script and capture the output that
it receives from sycom_d. If the current implementation of
sycom/sycom_d work, I would try this option. Why reinvent a solution
if you already have something that works? This would be trivial
to implement in perl.
Hope this helps.
Kevin
--
------------------------------------------------------------------------------
Kevin Lambright email: kevinl@casc.com
Ascend Communications voice: 978-952-7407
1 Robbins Road fax: 978-692-1510
Westford, Ma. 01886
------------------------------
Date: Thu, 02 Oct 1997 14:00:58 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: associative arrays prob
Message-Id: <3433a60c.24710702@news.tornado.be>
webadmin <webadmin@prestel.net> wrote:
> print FILE $in{'name$x'};
Make that double quotes. Varable interpolation (as they call it) doesn't
work in single quotes.
print FILE $in{"name$x"};
HTH,
Bart.
------------------------------
Date: Thu, 2 Oct 1997 07:33:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: webadmin <webadmin@prestel.net>
Subject: Re: associative arrays prob
Message-Id: <Pine.GSO.3.96.971002072824.24335I-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, webadmin wrote:
> I have an associative array which takes in details from a form
>
> $in{'name1'}
> $in{'name2'}
> $in{'name3'}
> $in{'name4'}
You should really use CGI.pm rather than cgi-lib.pl, and you should call
it a 'hash' instead of an 'associative array'. :-)
> for ($x=1; $x<=6; $x++)
The more perlish way is like this.
for $x (1..6) { ... }
Or even this.
for (1..6) { ... }
> {
> print FILE $in{'name$x'};
> }
Close. Use double quotes when you want interpolation:
print FILE $in{ "name$x" }; # or whatever
But maybe you want something like this:
print FILE
map "$_ => $in{$_}\n", # A nice line for each item
sort keys %in; # in the list of data
(Not as nice as it could be if your data are long or complex...) Hope this
helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 02 Oct 1997 12:59:58 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Change /etc/passwd
Message-Id: <343e9a65.62577271@igate.hst.moc.com>
[cc'd automagically to original author]
On Thu, 02 Oct 1997 15:03:25 +0100, Juan Carlos del Rio
<jcarlosd@ford.com> wrote:
>I post this question again:
>Is there any way I can allow users to change their passwords from CGI?
Yes. I implemented this a few *years* ago for a network of SunOS
boxes.
I wrote a Perl script that knew how to intelligently manipulate the
password file, log everything it did to syslog, and then I put a web
front-end on it with CGI.pm.
It was run from a special (more secure) web server that ran with root
privileges and knew how to do only a few basic things.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 02 Oct 1997 14:31:43 +0100
From: Brian Ewins <bewins@gssec.bt.co.uk>
Subject: Re: convert ms word document to plain text
Message-Id: <y1u20242sw0.fsf@gssec.bt.co.uk>
jwilliam@jwilliams.mayo.edu (RHS Linux User) writes:
> would like to convert some ms word documents to plain text on my linux
> box. Would appreciate any pointers to utilities,modules,etc. thanks.
> jim
The Laola package contains a tool called lhalw which can do this.
Laola is currently mostly still perl 4; though a perl 5 beta was recently
released. It doesnt need Windoze, but it only reads Word 6, Word7.
Damn fine piece of work, even if the code could do with some comments...
Its at:
http://user.cs.tu-berlin.de/~schwartz/pmh/laola.html
Cheers,
Baz
--
------------------------------
Date: Thu, 02 Oct 1997 10:01:59 -0500
From: Mark Chaffee <chaffee@cpdmfg.cig.mot.com>
Subject: Deleting duplicates in an array
Message-Id: <3433B767.5E47@cpdmfg.cig.mot.com>
Is there a built in function to delete duplicates in an array? If not,
what would be the easiest way to perform this operation?
I thought I could sort the array
@sorted=sort @tmpAry;
and with a foreach loop compare each position with the next, deleting if
the same, but I can't figure out the syntax. Is this the proper logic,
or is there a better way?
foreach $word (@sorted) {*something to compare and delete*};
Please email. Thanks!
--
- Mark Chaffee
chaffee@cpdmfg.cig.mot.com
--
- Mark Chaffee
Not The Joneses
http://www.ntj.com
------------------------------
Date: 2 Oct 1997 15:34:55 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Deleting duplicates in an array
Message-Id: <slrn637fov.nkr.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 02 Oct 1997 10:01:59 -0500,
Mark Chaffee <chaffee@cpdmfg.cig.mot.com> wrote:
> Is there a built in function to delete duplicates in an array? If not,
> what would be the easiest way to perform this operation?
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq4/
How_can_I_extract_just_the_uniqu.html
> Please email. Thanks!
Please read the FAQs.
Please read the manpages.
Please read the newsgroup. Thanks!
> --
> - Mark Chaffee
> chaffee@cpdmfg.cig.mot.com
> --
> - Mark Chaffee
> Not The Joneses
> http://www.ntj.com
Oh, and lose the doubled signatures, will you?
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 2 Oct 1997 15:42:56 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Deleting duplicates in an array
Message-Id: <610fe0$lsr@news-central.tiac.net>
In article <3433B767.5E47@cpdmfg.cig.mot.com>,
Mark Chaffee <chaffee@cpdmfg.cig.mot.com> wrote:
>Is there a built in function to delete duplicates in an array? If not,
>what would be the easiest way to perform this operation?
>
>I thought I could sort the array
>
>@sorted=sort @tmpAry;
>
>and with a foreach loop compare each position with the next, deleting if
>the same, but I can't figure out the syntax. Is this the proper logic,
>or is there a better way?
>
>foreach $word (@sorted) {*something to compare and delete*};
At the expense of some memory (and map's notational convenience can
encourage idioms that guzzle memory on large data sets...) you could say
@unsortedUniques = keys %{{map {$_ => 1} @list}};
or you can look at the perl FAQ and find this at
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq4/How_can_I_extract_just_the_uniqu.html
How can I extract just the unique elements of an array?
There are several possible ways, depending on whether the array is
ordered and whether you wish to preserve the ordering.
a) If @in is sorted, and you want @out to be sorted:
$prev = 'nonesuch';
@out = grep($_ ne $prev && ($prev = $_), @in);
This is nice in that it doesn't use much extra memory,
simulating uniq's behavior of removing only adjacent
duplicates.
b) If you don't know whether @in is sorted:
undef %saw;
@out = grep(!$saw{$_}++, @in);
c) Like (b), but @in contains only small integers:
@out = grep(!$saw[$_]++, @in);
d) A way to do (b) without any loops or greps:
undef %saw;
@saw{@in} = ();
@out = sort keys %saw; # remove sort if undesired
e) Like (d), but @in contains only small positive integers:
undef @ary;
@ary[@in] = @in;
@out = sort @ary;
The FAQ can be found at http://www.perl.com by folowing the FAQs link or
in the doc/FAQs directory at a CPAN (comprehensive perl archive network)
site. The master CPAN site is at
ftp://ftp.funet.fi/pub/languages/perl/CPAN/
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 2 Oct 1997 08:41:37 -0500
From: faught@convex.hp.com (Danny R. Faught)
Subject: Re: expect lib for perl?
Message-Id: <6108ah$pmf@feep.rsn.hp.com>
In article <Pine.GSO.3.95.971002103632.21584D-100000@jordan.uni-paderborn.de>,
Christopher Creutzig <ccr@jordan.uni-paderborn.de> wrote:
>#!/usr/local/bin/perl -w
>sub send_human {
> my $save = $|;
> $| = 1;
> foreach ( split(//, shift(@_))) {
> select(undef,undef,undef, rand()/2.0);
> print;
Still needs works in order to provide all of expect's features
(parameterizing the formula, using a Weibull distribution), but it
shows that this sort of thing isn't difficult.
--
Danny Faught -- HP-Convex -- Software Test Alchemist
"Everything is deeply intertwingled." (Ted Nelson, _Computer Lib_)
------------------------------
Date: Thu, 2 Oct 1997 07:24:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: onworld@onworld.com
Subject: Re: FilePush Browser Probs
Message-Id: <Pine.GSO.3.96.971002072233.24335H-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, WebMaster wrote:
> I am trying to understand why I can have my PERL script push a file to
> NEtscape Nav and have the browser recognize the fileName, yet the same
> push to Internet Explorer does not recognize the file, and names it
> wrong and does not recognize the exe extension on the end of it either.
It sounds as if your Perl code is just fine, since it works with one
browser. But if you really want to understand why this doesn't work with
another browser, you probably want to check the docs and FAQs and
newsgroups related to browsers. Those sources should give you a better and
more complete answer than we can here.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 02 Oct 1997 16:38:25 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Generating bit patterns "00000000" .. "11111111"
Message-Id: <3433B1E1.51E6E35D@absyss.fr>
Bart Lateur wrote:
>
> Ricky Roque <ricky.roque@bigfoot.com> wrote:
>
> >I'm trying to generate pattern like the following
> > "00000000"
> > "00000001"
> > "00000010"
> > :
> > :
> > "11111110"
> > "11111111"
>
> I'd think about doin this using sprintf. But sprintf doesn't seem to be
> able to format numbers as binary.
>
> Why not?
>
> Bart.
Because there isn't one in C's printf() either? I'd like to see this
too, but it seems that only bases 8, 10 and 16 have automatic printf()
options.
- doug
------------------------------
Date: Thu, 2 Oct 1997 07:34:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Raymond W Yu <rayyu@cup.hp.com>
Subject: Re: How to write a context sensitive subroutine in PERL?
Message-Id: <Pine.GSO.3.96.971002073335.24335J-100000@usertest.teleport.com>
On Tue, 30 Sep 1997, Raymond W Yu wrote:
> I would like to know how to write a subroute to return a string
> if it's called in a scalar context(ie $s = foo()), and to return
> a hash if it's called in a hash context.
Check out wantarray in the perlfunc(1) manpage. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 2 Oct 1997 07:17:53 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Wolfgang Viechtbauer <wviecht@rs6000.cmp.ilstu.edu>
Subject: Re: Multiple Simultaneous prints???
Message-Id: <Pine.GSO.3.96.971002071312.24335E-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, Wolfgang Viechtbauer wrote:
> While (-f data.lock){
> select (undef, undef, undef, 0.1);}
No! No! No!
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq5.html
Please, read the questions "How can I lock a file?" and "What can't I just
open(FH, ">file.lock")?"
> open (LOCKFILE, ">data.lock);
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check of the return value after opening a
file.
I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps!
http://www.stonehenge.com/merlyn/WebTechniques/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 2 Oct 1997 08:07:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Wolfgang Viechtbauer <wviecht@rs6000.cmp.ilstu.edu>
Subject: Re: Multiple Simultaneous prints???
Message-Id: <Pine.GSO.3.96.971002080559.24335N-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, Wolfgang Viechtbauer wrote:
> >lock the file in some fashion (see the
> >Perl FAQs for more info).
>
> I looked at the FAQ but did not find anything pertaining to the
> problem.
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq5/
How_can_I_lock_a_file_.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 2 Oct 1997 08:05:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: New CGI Web Site
Message-Id: <Pine.GSO.3.96.971002080315.24335M-100000@usertest.teleport.com>
On Mon, 29 Sep 1997, Lynn Andrews wrote:
> Please take a look at The Complete Webmaster, the new site for
> webmasters, by webmasters. Read articles about HTML, CGI, Java,
> JavaScript, and more.ters. Read articles about HTML, CGI, Java,
>
> http://www.abiglime.com/webmaster/ticles about HTML, CGI, Java,
>
> We welcome any feedback to feedback@abiglime.com. Thanks very ,
> much.lcome any feedback to feedback@abiglime.com. Thanks very ,
>
> -Josh Andrewsy feedback to feedback@abiglime.com. Thanks very ,
I think you have too much feedback already. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 2 Oct 1997 09:15:19 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: oraperl
Message-Id: <6106p7$etf@panix.com>
In <343320D6.2172@Sun.COM> MARI J MORTELL <mari.mortell@Sun.COM> writes:
>I am interested in oraperl.
>Can anyone point me to information on oraperl?
http://reference.perl.com/query.cgi?database
--
Clay Irving <clay@panix.com> http://www.panix.com/~clay/
------------------------------
Date: Thu, 2 Oct 1997 08:02:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: MT <sac31277@saclink.csus.edu>
Subject: Re: post-query form help!
Message-Id: <Pine.GSO.3.96.971002080210.24335L-100000@usertest.teleport.com>
On Mon, 29 Sep 1997, MT wrote:
> I keep getting Server Error!
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 02 Oct 1997 15:48:17 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: usemymalloc
Message-Id: <610fo0$85i$1@nntp1.ba.best.com>
I have a large Perl 5 program that is very stable on
multiple operating systems with multiple versions of
Perl 5.
However, on a couple of systems, we have seen mucho
weirdness.
1. One specific function gives the error:
"Bad free() ignored at ....".
2. The other system does all kinds of weird stuff. I
found a reproduceable example where we push items
onto a list but, later on, when we come to shift
them off, some of them have just disappeared :-(
Both machines are Sun's and, in both cases, Perl was
built with:
usemymalloc=y
Has anyone experienced similar problems or have any
comments?
TIA
--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| malch@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 02 Oct 1997 10:25:56 -0400
From: DomiNICKan <ncabrera@attila.stevens-tech.edu>
Subject: Why is PERL a good prototyping language?
Message-Id: <3433AEF4.8DE@attila.stevens-tech.edu>
Hi can anyone answer this question:
Why is PERL a good prototyping language?
I just hear about perl last week in one of my CS classes and want to
know more about it.
------------------------------
Date: Thu, 02 Oct 1997 15:20:06 GMT
From: raymond@iway.nl (Raymond Morsman)
Subject: Re: Why is PERL a good prototyping language?
Message-Id: <3433baca.14627894@news.nl.net>
On Thu, 02 Oct 1997 10:25:56 -0400, DomiNICKan
<ncabrera@attila.stevens-tech.edu> wrote:
>Hi can anyone answer this question:
>Why is PERL a good prototyping language?
>
In my opinion one can develop complete applications in perl very
rapidly, without losing the objective of the prototype. I mean, you
don't have to worry about typical programming questions like garbage
collection or memory allocation but can get right on to it.
Once done with the prototyping you could consider to convert it to
another language, however Perl isn't doing that bad as a
productionlanguage since perl compiles before it executes.
------------------------------
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 1115
**************************************