[6350] in Perl-Users-Digest
Perl-Users Digest, Issue: 972 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 19 06:07:15 1997
Date: Wed, 19 Feb 97 03:00:19 -0800
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, 19 Feb 1997 Volume: 7 Number: 972
Today's topics:
[Q] Making serveral http connections at the same time f (Repo)
Re: Associative array efficiency <jesse@ginger.sig.bsh.com>
BogoMIME - filter Sun mailtool messages into MIME forma <bos@serpentine.com>
Re: Breaking an @ down to individual fields (Honza Pazdziora)
Re: Class library to make C++ more Perlish? <charltoN@illustra.com>
Exemples de petits prog. en perl ? <Dominique.BAGOT@cetp.ipsl.fr>
How to improve my CHAT ROOM (Gilbert Yun)
html -> rtf perl conversion script (Roger Hart)
Re: Need help with variable manipulation (Mike Stok)
Re: Perl on Windows 95 (Hans Schrader)
Re: Perl5 and DBD-Oracle under Oracle 7.3.2.3 and HP-UX <Tim.Bunce@ig.co.uk>
Re: PRE-ANNOUNCE and RFC for new module File::Vpp <c.evans@clear.net.nz>
Re: Public Domain - Date Graphic Script (Jarle Aasland)
Re: Q: Automatically move text from one page to another (Luu Tran)
Radius Accounting (Greg)
Rewiite Sort command in NT perl <edmond@email.tech-trans.com>
Re: Set operations (union, intersection, etc...) <stupid+@andrew.cmu.edu>
Substitute question (Jim Harkins)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Feb 1997 10:18:26 GMT
From: st.aim@a1.nl (Repo)
Subject: [Q] Making serveral http connections at the same time for searching files {win32::internet)
Message-Id: <330bcee5.70976362@news.xs4all.nl>
Greetings reader,
I have to search in html files on tons of domain's. One connection at
the time is to time consumming.
1/ Do you know if it possible to make several connection at the same
time with perl and win32::internet or a other module for win32 ?
2/ If so can you tell me were to get info on it or do you have source
code whitch does it?
Repo:) (Robert E Bakker)
------------------------------
Date: 18 Feb 1997 22:03:19 -0500
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: Associative array efficiency
Message-Id: <4o4tf9mr9k.fsf@ginger.sig.bsh.com>
Perl 5 startup/end time is usually slower, because it just does more. It's
unlikely hash lookups contribute anything at all noticeable to your script's
execution time. Prufile with Devel::DProf if in doubt. A simpler script is
often quicker than an apparently hand-tuned one in Perl since it can be
compiled more quickly.
--
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017
------------------------------
Date: 19 Feb 1997 00:48:38 -0800
From: Bryan O'Sullivan <bos@serpentine.com>
Subject: BogoMIME - filter Sun mailtool messages into MIME format
Message-Id: <87u3n9mba1.fsf@serpentine.com>
--Hello_to_all_my_fans_in_domestic_surveillance-nuclear-Croatian-Vq0HFbXz+miceEYk
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Tired of receiving multipart messages in the elderly Sun mailtool
format and not being able to read them with your MIME-capable mail
reader? Hankering for something that will convert them into a sane
format?
Introducing BogoMIME, a Perl filter that reads in a mailtool-encoded
message and spits out a MIME-encoded message. Used in conjunction
with a tool like procmail, you need never again be aware of the
existence of mailtool!
Useful features:
- Converts uuencoded bodyparts to use base64 encoding, so that users
don't have to jump through hoops to read bodyparts
- Recursively handles mailtool-encoded message digests, such that
messages are maintained in sane ways and encoding conversions are
performed on nested bodyparts
- Goes to some lengths not to screw up when tweaking encodings, so
that users are unlikely to lose data, even in the event of
unforeseen problems
Feedback and fixes for problems I haven't encountered greatly
appreciated.
<b
--Hello_to_all_my_fans_in_domestic_surveillance-nuclear-Croatian-Vq0HFbXz+miceEYk
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
#!/usr/local/bin/perl -w
#
# bogomime - filter to convert Sun mailtool messages with attachments
# to MIME-encoded messages
#
# Copyright (C) 1997 Bryan O'Sullivan
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# To obtain a copy of the GNU General Public License, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
#
# COMMENTARY:
#
# This program operates as a filter; it takes a message on stdin,
# munges it, and spits it out again on stdout.
#
# You can call this program as a filter from within procmail by
# including a section such as the following in your ~/.procmailrc:
#
# ## Convert messages sent by Sun's mailtool to MIME.
# :0 fhbw
# * ^Content-Type: X-Sun-attachment
# | bogomime
#
# As things currently stand, this program has a number of very useful
# features:
#
# - Recursively handles mailtool message digests, such that messages
# are maintained in sane ways
#
# - Converts uuencoded bodyparts to use base64 encoding, so that users
# don't have to jump through hoops to read bodyparts
#
# - Goes to some lengths not to screw up when tweaking encodings, so
# users are unlikely to lose data, even in the event of unforeseen
# problems
#
# Note that this program is not complete or necessarily correct; it
# makes certain assumptions about the way mailtool mail is encoded
# that just happen to almost always be correct. However, I have not
# run into any problems thus far.
#
# If you make tweaks to the code that you think may be generally
# applicable, please send me context diffs; if I find your changes
# useful, I may incorporate them. Feedback is always appreciated.
#
# Bryan O'Sullivan <bos@serpentine.com>
require 5.000;
## Change these if you need to.
# The location of a standard uudecode utility.
$uudecode = "/usr/bin/uudecode";
# The location of some program that will take input on stdin and spit
# it out base64-encoded on stdout.
$base64_encode = "/opt/local/bin/base64-encode";
# Mappings from Sun attachment types to MIME types. Anything not
# listed here defaults to application/octet-stream.
%mappings =
qw(
ae-file text/plain
audio-file audio/basic
c-file text/plain
cshell-script text/plain
default text/plain
gif-file image/gif
jpeg-file image/jpeg
mail-file multipart/digest
mail-message multipart/digest
message multipart/digest
postscript-file application/postscript
readme-file text/plain
shell-script text/plain
sun-deskset-message multipart/digest
text text/plain
);
## No user-serviceable parts beyond this point.
# Keep "perl -w" happy.
$bodycount = 0;
$time = time();
srand($time);
@imprecations = qw(cruft pain lossage braindamage headache kludge hack
mess disaster moby sludge yeugh dummitude glorp evil
stinkiness bogosity bletcherousness heinosity);
@funk = <STDIN>;
$text = &process_message(\@funk);
print @$text;
exit(0);
# Process a message in Unix mailbox format. Sole parameter is a
# reference to a list of all lines in the message.
sub process_message {
my ($complete_header, $header_body, $line, $sun_attachment, $header, $content_length,
@headers, @body, @return, $prev_header, $prev_header_body, $content_encoding,
$content_type, $body);
my ($text) = @_;
$complete_header = "";
# Grunge through the headers, and try to figure out whether this
# is a Sun mailtool message with attachments.
header:
while ($line = shift @$text) {
# Ignore mailbox format crud.
if ($line =~ /^From /) {
push @headers, $line;
} elsif ($line eq "\n" || $line =~ /^([^\s]*):\s*(.*)$/) {
# Every time we see the beginning of a new header, process
# its predecessor.
if ($complete_header ne "") {
$header_body =~ s/[\n\s]+/ /g;
if ($header eq "content-type" && $header_body eq "x-sun-attachment") {
$sun_attachment = 1;
$complete_header = "X-Sun-" . $complete_header;
} elsif ($header eq "content-length") {
$content_length = $header_body;
$complete_header = "X-Sun-" . $complete_header;
}
push @headers, $complete_header;
}
last header if ($line eq "\n");
$line =~ /^([^\s]*):\s*(.*)$/;
$header = lc $1;
$header_body = lc $2;
$complete_header = $line;
} else {
$header_body .= lc $line;
$complete_header .= $line;
}
}
if ($sun_attachment) {
$boundary = &make_boundary;
# Stuff out some standard MIME headers. We don't yet know the
# true content length of this message.
push @headers, <<END_MIME_HEADER;
X-Mime-Munger: bogomime 0.1 - <bos\@serpentine.com>
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="$boundary"
Content-Transfer-Encoding: 7bit
END_MIME_HEADER
$complete_header = "";
my ($in_bodypart_headers, @bodypart);
# This must default to empty, in order for handle_bodypart to
# work correctly for the toplevel message.
$content_type = "";
$content_encoding = "7bit";
# Processing the body of the message is a pain. We have to
# watch out for bodypart headers, and process bodyparts with
# some care.
body:
while ($line = shift @$text) {
if ($in_bodypart_headers) {
if ($line eq "\n" || $line =~ /^(.*):\s*(.*)$/) {
if ($complete_header ne "") {
$header_body =~ s/[\n\s]+/ /g;
if ($header eq "x-sun-data-type") {
if (defined $mappings{$header_body}) {
$content_type = $mappings{$header_body};
} else {
$content_type = "application/octet-stream";
}
} elsif ($header eq "x-sun-encoding-info") {
if ($header_body =~ /uuencode/) {
$content_encoding = "uuencode";
} else {
$content_encoding = $header_body;
}
}
push @body, $complete_header;
}
if ($line eq "\n") {
# about to enter the body of a bodypart
$complete_header = "";
$in_bodypart_headers = 0;
$#bodypart = -1;
} else {
$header = lc $1;
$header_body = lc $2;
$complete_header = $line;
}
} else {
$header_body .= lc $line;
$complete_header .= $line;
}
} elsif ($line eq "----------\n") {
# about to enter the header of a body part
$body = &handle_bodypart($content_type, $content_encoding,
\@bodypart);
push @body, @$body, "\n--$boundary\n";
$in_bodypart_headers = 1;
} else {
push @bodypart, $line;
}
}
$body = &handle_bodypart($content_type, $content_encoding, \@bodypart);
push @body, @$body, "\n--$boundary--\n";
$body = join('', @body);
my ($length) = length $body;
push @return, @headers, <<END_LAST_MIME_HEADER;
Content-Length: $length
END_LAST_MIME_HEADER
push @return, @body;
} else {
push @return, @headers, <<END_VANILLA_HEADER;
Content-Length: $content_length
END_VANILLA_HEADER
push @return, @$text;
}
return \@return;
}
# Indicate whether a string is in a list of other strings. List is
# passed by reference.
sub in {
my ($key) = shift;
my ($values) = shift;
foreach $value (@$values) {
if ($key eq $value) {
return 1;
}
}
return 0;
}
# Handle a mailtool bodypart, with translation to a sane encoding
# format performed if necessary.
#
# @@@ We should handle files that have been compressed, then
# uuencoded. Bleah.
sub handle_bodypart {
my ($content_type) = shift;
my ($content_encoding) = shift;
my ($body) = shift;
my (@return);
if ($content_type eq "") {
return $body;
}
# The program structure here carefully tries to ensure that should
# firing off other programs cause problems, we will not lose any
# data (though we may leave it encoded in a way that is a pain to
# deal with).
if ($content_encoding eq "uuencode") {
if (open(UUDECODE, "| $uudecode")) {
my ($bogofile) = "/tmp/bogomime.$$.uudecode";
shift @$body;
@$body = ("begin 600 $bogofile\n", @$body);
print UUDECODE @$body;
close(UUDECODE);
if ($content_type eq "multipart/digest") {
if (open(DECODED, "< $bogofile")) {
@$body = <DECODED>;
close(DECODED);
}
# Since forwarded mail is likely to be in Unix mailbox
# format, we remove the mailbox header, if it exists.
# This should leave the message in fairly sane RFC822
# format.
if ($$body[0] =~ /^From /) {
shift @$body;
}
my ($text) = &process_message($body);
$body = $text;
} else {
# If a bodypart was uuencoded, we base64-encode it.
if (open(RECODED, "$base64_encode < $bogofile |")) {
@$body = <RECODED>;
$content_encoding = "base64";
close(RECODED);
}
}
unlink($bogofile);
}
}
if ($content_type eq "multipart/digest") {
my ($boundary) = &make_boundary;
my ($foo) = join('', @$body);
push @return, <<END_DIGEST_CRUFT;
Content-Type: $content_type;
boundary="$boundary"
Content-Transfer-Encoding: 7bit
This is a forwarded message, BogoMIME encapsulation.
--$boundary
$foo
--$boundary--
END_DIGEST_CRUFT
} else {
push @return, <<END_BODYPART_HEADER;
Content-Type: $content_type
Content-Transfer-Encoding: $content_encoding
END_BODYPART_HEADER
push @return, @$body;
}
return \@return;
}
# Make a new bodypart boundary.
sub make_boundary {
my ($random) = int(rand($time));
my (@foulness, $choice);
my ($i);
for ($i = 0; $i < ($random % 4) + 1; $i++) {
$choice = $imprecations[($random * ($i + 1)) % ($#imprecations + 1)];
if (!&in($choice, \@foulness)) {
push @foulness, $choice;
}
}
$bodycount += 1;
return "bogomime/$time/$$/$bodycount/" . join("/", @foulness);
}
--Hello_to_all_my_fans_in_domestic_surveillance-nuclear-Croatian-Vq0HFbXz+miceEYk--
------------------------------
Date: Wed, 19 Feb 1997 07:15:10 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Breaking an @ down to individual fields
Message-Id: <adelton.856336510@aisa.fi.muni.cz>
"fissio" <fissio@fission.com> writes:
> I am using Selena's Database Search 2.0 which searches a pipe delimited data
> file and returns is to the
> user. Right now the script spits out the data in a straight line of text
> which doesn't look good in the browser.
I am not familiar with Selena's Database Search 2.0, so may be ou t of
context. If it searches a pipe delimited data, do these data look like
name | first name | address | home directory
on one line, whatever the fields are?
> What I would like to do is breakdown the "@row" and print out each field
If so, doe the engine really returns you @row, an array? You say it is
a straight line of text, isn't it rather $row, a scalar that holds one
line? If that was the case, you would write the loop as
for $field (split /|/, $row)
{
which would split the line on delimiters.
> indivdually so that I can add
> html to each field. The html will be different for some fields otherwise I
> would just add html to the "search_results line. Here is the area in
> question:
>
> ----------------------------------------------------------------------
> foreach $field (@row)
> {
>
> $search_results .= "<TR><TD>$field</TD></TR>";
>
>
> }
> $search_results .= "</TR>";
> ----------------------------------------------------------------------
>
>
> Any help would be appreciated on how to break this down to individual
> fields.
I @row is really @row, then the above piece of code should work.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 19 Feb 1997 07:27:45 GMT
From: "Charlton Barreto" <charltoN@illustra.com>
Subject: Re: Class library to make C++ more Perlish?
Message-Id: <01bc1e36$64c06950$0ef03a9e@transmogrifier>
Tuomas J. Lukka <tjl@lukka.student.harvard.edu> wrote in article
<5e7lo6$qoi@lukka.student.harvard.edu>...
> In article <3309B25B.47EB@doc.ic.ac.uk>,
> Ben Jefferys <brj@doc.ic.ac.uk> wrote:
> >Hi I'm looking for a class library to give C++ some of the cool
> >functionality in Perl. Ideally it'd have scalar, array,
> >associative array classes and overload standard operators
> >as per C++. It should also have search, pattern matching
> >and so on as functions in the scalar class.
The STL already provide associative arrays, and the <vector> and
<matrix> template classes which are far superior to the built-in Perl
or C-type arrays. Regex pattern matching is available in the standard
libraries of most post-April-1995-DWP C++ compilers. Perl scalars
are strings, so you can just use C++ string classes.
> >My reason for wanting this is that I'm find my Perl programs
> >are too slow :( So I see C++ classes as the solution. If
> >there is another way I kind find out WHY my Perl is so slow
> >(ie. which bits are taking a long time) then I'd appreciate
> >a pointer.
First look at Tuomas's first recommendation below:
> 1. Are you sure you are doing things right: could you post
> an example that you consider too slow? It takes skill
> to get things right sometimes; your REs might be backtracking
> the life out of themselves.
Then make sure you're not using Perl 'functionality' that forces shell
invocation of Perl. For example, some of the sed/regex functionality in
Perl
can only be used via calling Perl through the operating shell and passing
it the appropriate argv-s. These calls make file open, read and related
system calls to UNIX, and all such file access goes through the UNIX
filesystem (unless you're one of those real shredders who uses rdsk
space). All of this is far less efficient than going through built-in
functionality
(where it exists) in Perl; this is analogous to using system calls
(bad, bad, bad!) versus library calls in C/C++.
Also, are you invoking flat-out shell commands or shell scripts in your
Perl scripts? This is also inefficient for the same reasons as above.
Make sure you use Perl functions (or classes/methods in 5.001+)
to implement what you might be implementing in other shell scripts.
You can implement _more_ in Perl than what you can in sh, ksh, or
csh so take advantage of it.
IHTH,
-Charlton.
--
+--------------------------------------------------------------------------+
| charlton barreto informix software, inc. |
| software development engineer 1111 broadway, suite 2000 |
| charlton@informix.com oakland, ca 94607 |
|--------------------------------------------------------------------------|
| TCHAR sz[] = _T("my opinions are my own; i do not speak for informix.");
|
+--------------------------------------------------------------------------+
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM/CS d---(d-) s+:s a? C++++$ U++++$ P++++$ L++++ E+++(---) W++++
N++++ o+++ !K w+++++$$ O+++$ M---(M+++)<$ V---(V+++)<$ Y+++ PGP++
t* 5 X++ R+++ tv b++++ DI++++ D+++ G++++ e+++ h++* r+++ z*
------END GEEK CODE BLOCK------
------------------------------
Date: Wed, 19 Feb 1997 10:00:42 +0100
From: Dominique BAGOT <Dominique.BAGOT@cetp.ipsl.fr>
Subject: Exemples de petits prog. en perl ?
Message-Id: <330AC13A.921@cetp.ipsl.fr>
Bonjour a tous,
connaissez-vous un (des) sites ayant des programmes
ecrits en perls a des fins pedagogiques. J'ai fait du perl il y a
assez longtemps et j'aimerais m'y remettre rapidos a l'aide
de petits exemples.
Merci, Dom
Dominique.BAGOT@cetp.ipsl.fr
------------------------------
Date: Wed, 19 Feb 1997 10:48:07 GMT
From: hemine@soback.kornet.nm.kr (Gilbert Yun)
Subject: How to improve my CHAT ROOM
Message-Id: <330ad7bf.3511818@usenet.kornet.nm.kr>
I recently opened one chat room in PERL script that I did not
created but only wove it from the two perl scripts, here is the source
script that I modified, and I would like to know how could I get it to show
the message which should be *refreshed* as soon as user post the message
into the chatting screen, the current script does not show it after user
hit "enter" key after type in.
And one more thing, how could I filter some character string? not a whole
string for example,
if ($ENV{'REMOTE_HOST'} eq "soback.kornet.nm.kr")
{ $ENV{'REMOTE_HOST'} = "He is from Korea"; }
But what should I do if I want to check it with only ".kr"?
You can visit the Chat Room,
http://soback.kornet.nm.kr/~hemine/linuxchat.html
----------------------cut here------------------------------------------
#!/usr/local/bin/perl
#This programme was created by Gilbert Yun, hemine@soback.kornet.nm.kr
#using MATT's perl script and Rescue's Minichat.pl. I just mix the two
#perl script to make my own style of chat room
#MATT's perl scripter --> http://worldwidemart.com/scripts/
#Rescue's Minichat.pl --> http://www.ask.or.jp/~rescue/cgitips/
$goto_chat_file =
"http://soback.kornet.nm.kr/~hemine/linuxchatwindow.html";
$chat_file = "/user5/kor1/hemine/web-home/linuxchatwindow.html";
$cgiurl =
"http://soback.kornet.nm.kr/~hemine/web-home/cgi-bin/linuxchat.pl";
$date_command = "/usr/bin/date";
$max="230";
$redirection = 1; # 1 = Yes; 0 = No
$entry_order = 1; # 1 = Newest entries added first;
# 0 = Newest Entries added last.
$allow_html = 1; # 1 = Yes; 0 = No
$date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
$shortdate = `$date_command +"%y/%m/%d, %T %Z"`; chop($date);
#######################################
# Get the input
if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer,
$ENV{'CONTENT_LENGTH'}); }
else { $buffer = $ENV{'QUERY_STRING'}; }
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}
$FORM{$name} = $value;
}
#######################################
if (!open(CUTE,"$chat_file")) { &error(0); }
@lines = <CUTE>;
close(CUTE);
$i = 0;
foreach $line (@lines) {
$i++;
if ($i == $max) { last; }
push(@new,$line);
}
if (!open(CUTE,">$chat_file")) { &error(0); }
print CUTE @new;
close(CUTE);
#######################################
open (CUTE,"$chat_file") || die "Can't Open $chat_file: $!\n";
@LINES=<CUTE>;
close(CUTE);
$SIZE=@LINES;
open (CUTE,">$chat_file") || die "Can't Open $chat_file: $!\n";
for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--begin-->/) {
if ($entry_order eq '1') {
print CUTE "<!--begin-->\n";
}
if ($line_breaks == 1) {
$FORM{'comments'} =~ s/\cM\n/<br>\n/g;
}
$hostname = $ENV{'REMOTE_HOST'};
if ($FORM{'nickname'} eq "") { $FORM{'nickname'} = $hostname; };
print CUTE "<font color=#ff0000><b> $FORM{'nickname'} ></b></font> ";
print CUTE "<b>$FORM{'chat'}</b>\n";
print CUTE "<font size=1 face=arial color=#808080> ($shortdate,";
print CUTE " $ENV{'REMOTE_HOST'},";
print CUTE " $ENV{'HTTP_USER_AGENT'})</font><p>\n\n";
if ($entry_order eq '0') {
print CUTE "<!--begin-->\n";
}
}
else {
print CUTE $_;
}
}
close (CUTE);
if ($redirection eq '1') {
print "Location: $goto_chat_file\n\n";
}
------------------------------- end ----------------------------------
___________
Gilbert Yun
------------------------------
Date: 19 Feb 1997 05:44:53 GMT
From: rhart@fas.harvard.edu (Roger Hart)
Subject: html -> rtf perl conversion script
Message-Id: <rhart-1802972145570001@ieas29.ias.berkeley.edu>
I am looking for a perl script to convert a html document into an rtf
document, preferably source code so that I could modify it and run it on
my Macintosh. (I started writing such a script, but it ended up that
there were too many html codes to complete the project in a reasonable
time ...)
Thanks so much,
Roger Hart
Please send replies to rhart@fas.harvard.edu
--
Roger Hart
Fairbank Center for East Asian Research
Harvard University
------------------------------
Date: 19 Feb 1997 10:32:21 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Need help with variable manipulation
Message-Id: <5eekrl$idt@news-central.tiac.net>
In article <4ozpx1lc30.fsf@ginger.sig.bsh.com>,
Jesse Glick <jesse@ginger.sig.bsh.com> wrote:
>"D. M. Johnson" <ez045864@peseta.ucdavis.edu> writes:
>> 1) If $name = randal, how can I reverse this. I need to get
>> $name = ladnar (Assuming I don't know how many characters are
>> in the name.)
>
>join '', reverse split //, $name
or even just
$name = 'randal';
$reversed = reverse $name;
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: Wed, 19 Feb 97 06:51:36 GMT
From: hans.schrader@geol.uib.no (Hans Schrader)
Subject: Re: Perl on Windows 95
Message-Id: <5ee8fq$i6n$1@toralf.uib.no>
In article <3308E0D4.371F@cougar.netutah.net>, Mark Perry <mdperry@cougar.netutah.net> wrote:
You may want to check out our Perl for Windoze pages:
URL="http://hjs.geol.uib.no/Perl/index3.htm"
>I am setting up a website and I want to use some scripts. I want to
>test them to make sure they work befor sending them to the ISP. I
>downloaded Perl for Windows 95/NT. I can see if a script compiles and
>what its output is in a dos box by typing C:\>perl myscript.pl.
>
>I would like to also see how it works by loading the page into Netscape
>locally and then running the script (like it would on a server). Is
>this possible. When I tried clicking on the button that calls the
>script nothing happened.
>
>Any suggestions?
>
>Thanks.
Hans Schrader-Eureka's SySop:
"nglhs@alf.uib.no"--"http://hjs.geol.uib.no/"
------------------------------
Date: Wed, 19 Feb 1997 03:29:17 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: Perl5 and DBD-Oracle under Oracle 7.3.2.3 and HP-UX 10.20.
Message-Id: <E5tz0v.B08@ig.co.uk>
In article <5dpns3$c4e@server05.icaen.uiowa.edu>,
Yan Lau <ylau@iworks.InterWorks.org> wrote:
> We are having a problem porting some code from one system to another.
> The system that works is running HP-UX 10.01, Oracle 7.2.2.4, DBI-0.73
> DBD-Oracle-0.43 and Perl 5.003.
Read the README for how to report problems. Upgrade to DBD-Oracle-0.44
(not related to this problem) and then build using static linking
(see the 0.44 README for details). Basically it's an Oracle problem.
Tim.
------------------------------
Date: 19 Feb 1997 23:21:38 +1300
From: Carey Evans <c.evans@clear.net.nz>
To: Dominique Dumont <domi@marlis.grenoble.hp.com>
Subject: Re: PRE-ANNOUNCE and RFC for new module File::Vpp
Message-Id: <87enedp03x.fsf@cassandra.evansnet>
Dominique Dumont <domi@marlis.grenoble.hp.com> writes:
> I've written a module named File::Vpp. Before releasing it, I'd like
> to submit the doc for suggestions or any comments on the interface.
>
> I'm wondering whether File::Vpp is a good choice for naming this
> module. I don't want to conflict with any other File::xxx module.,
>
> This is my 2nd try for a RFC (I guess that I've badly choosen the post
> subject for my first try since I didn't get any reply).
[snip]
I didn't get any reply to my post about File::Sync either. It's been
uploaded anyway (announce coming soon).
I don't know whether I'd ever use your module, which stopped me from
commenting on it before. Here's some feedback though:
I'm unsure whether it belongs in File::. I would prefer Text::
myself, since that's what its dealing with, and Text::Template has
some similarities. File:: seems to me to do things to/with file
handles.
--
Carey Evans <*> c.evans@clear.net.nz
"UMC 8891A Pentium chipset: Why did you think UMC was cheaper ??"
- Linux 2.0.29 kernel
------------------------------
Date: Wed, 19 Feb 1997 08:43:27 GMT
From: sajaa@sn.no (Jarle Aasland)
Subject: Re: Public Domain - Date Graphic Script
Message-Id: <330abca7.3036705@news.eunet.no>
I am new to perl also, and I'm curious: How do you call the script
from the web-page, and how do you get the output from the script into
the page. Are you using Server Side Include or some other method?
Sincerely,
Jarle Aasland
NORWAY
> With the help of a select few of you I was able to make my first decent
>perl/www script. Although this script is very specific, I thought that some
>of you might find it useful (but you will need to customize it for it to
>work on your web-site).
>
------------------------------
Date: Wed, 19 Feb 1997 06:45:33 GMT
From: luutran@sci.csupomona.edu (Luu Tran)
Subject: Re: Q: Automatically move text from one page to another
Message-Id: <5ee7ld$dfu@netline-fddi.jpl.nasa.gov>
In article <33089417.36152728@news.eunet.no>, kervarec@online.no (Varog Kervarec) wrote:
>I am indeed new to perl, so any help will be greatly appreciated.
>
>I have written (with a lot of good help and examples) a perl script
>for publishing text on a web-page.
>
>When the user writes text into a form, the input is automatically
>written to a predefined web-page, with the newest message at the top
>(like an ordinary guestbook-script).
>
>However, this script only accumulates text on this page - what I want
>to do is to get the script to automatically limit the amount of text
>to, let's say 10 messages, and then move the oldest onto another page
>("archive"). When the archive reaches for instance 50 messages, the
>oldest should be moved to yet another page ("archive 2"), and so on.
>
>Also, the script should generate a link when the total amount is
>reached ("Click here to view message archieve")...
>
>Please reply both to this group and directly using e-mail to
>sajaa@sn.no.
>
>TIA - Jarle Aasland, NORWAY
>
>
Well, an obvious solution is to keep a counter that is incremented
each time a message is added. This counter could be kept in some
external file or embedded in the message file itself as a comment,
e.g.,
<!-- counter: X -->
You also need to separate each message with some sort of delimiter so
that it can picked off and moved to another file. Again this can be
done using comments:
<!-- begin msg -->
..msg 2..........
<!-- begin msg -->
..msg1
Hope this gives you some idea.
[posted and mailed]
-- luu
Luu Tran
luutran@sci.csupomona.edu
webmaster: http://www.bayscenes.com/np/mdonline/
------------------------------------------------
------------------------------
Date: Wed, 19 Feb 1997 04:49:14 GMT
From: greg@webnology.com (Greg)
Subject: Radius Accounting
Message-Id: <330a8660.0@news.webnology.com>
Soooooo....Anyone seen any decent perl scripts for Radius detail file
parsing? I'd actually like to start an archive of shareware/freeware
scripts related to radius for posting to a web page....
TIA,
Greg
Greg Barnes
Network Services Division
Webnology LLC
3806 Highway 90 West
DelRio, TX 78840
Tel - 210-768-2292
The opinions expressed here are those of Greg Barnes
and are not necessarily the official position of
Webnology LLC or any of its associates
------------------------------
Date: Wed, 19 Feb 1997 14:02:47 +0800
From: edmond <edmond@email.tech-trans.com>
Subject: Rewiite Sort command in NT perl
Message-Id: <330A9787.4088@email.tech-trans.com>
I want to know how to rewrite the following unix commannd in NT perl 5:
"sort -u -k .2,12 -k .17,.22 filename"
------------------------------
Date: Wed, 19 Feb 1997 02:33:27 -0500
From: Michael George Schwern <stupid+@andrew.cmu.edu>
Subject: Re: Set operations (union, intersection, etc...)
Message-Id: <8n2en7C00YUq0TlYE0@andrew.cmu.edu>
Ker-DUH! Thanks, I've been using the 2nd edition book lately, doesn't
have the Common Tasks section. And apparently I overlooked the 'Set'
modules in CPAN, I've gotten a slew of responses saying that. My eyes
must glaze over with mist whenever I look at CPAN, I dunno.
Excerpts from mail: 18-Feb-97 Re: Set operations (union, .. by Bill
Kuhn@sun1.uconect.n
> When you said "wrote your own" did you mean that you wrote the set
> operations from scratch? If so, you may want to compare what you came
> up with to that published in Programming Perl in the Common Tasks With
> Perl chapter. The code for an intersections/differences is only 3
> lines. Maybe the reason nobody packaged these is because of their
> simplicity you could just include them directly into your main program
> instead of "use"ing a package?
What I wrote is (from what I remember) the basic algorithm for finding
the intersection of two lists. Here's the basic code...
# &Intersection( list_ref listA_ref, list_ref listB_ref );
# returns a sorted list of the intersection of lists A & B.
sub Intersection {
my($listA_ref, $listB_ref) = @_;
my(@intersection) = ();
my(@listA) = sort(@$listA_ref);
my(@listB) = sort(@$listB_ref);
# Treat the lists as stacks.
while ( $#listA >= 0 && $#listB >=0 ) {
if ( $listA[0] eq $listB[0] ) {
shift (@intersection, $listA[0]);
pop (@listA);
pop (@listB);
}
elsif ( $listA[0] gt $listB[0] ) {
pop (@listA);
}
elsif ( $listA[0] lt $#listB[0] ) {
pop (@listB);
}
else {
# Reality has failed.
print STDERR "Raelitee czech! Internal Error in \&Intersection!";
return -1;
}
}
return @intersection;
}
This FEElS like it should be faster than Programming Perl's suggestion
of using Grep, at least, it would be in C... but who knows with Perl?
Set seems to use a similar function (to Prog Perl), and I really don't
like (nor grok) OOP (please, I don't want to set off an OOP v Structured
Programming war). I also don't relish having to create a pair of 'set
objects' every time I want to find the intersection of two lists. Seems
a tad excessive to me. I'll probably stick with mine.
Anyhow, thanks. I'll try and wear my glasses while looking at CPAN.
"If you could imagine anyone obtaining this power of becoming invisible, and
never doing any wrong or touching what was another's he would be thought by
the lookers-on to be a most wretched idiot..."
Glaucon, Plato's _Republic_ Book II
auveyron@cmu.edu stupid@andrew.cmu.edu schwern@envirolink.org
Floggo the Stupid aka Milko aka Schwern aka Auveyron aka Dupre
OpMngr&Mac Wrangler @ EnviroLink http://www.envirolink.org/home/schwern
------------------------------
Date: 18 Feb 1997 13:06:43 -0800
From: t_jharki@qualcomm.com (Jim Harkins)
Subject: Substitute question
Message-Id: <5ed5l3$lqk@qualcomm.com>
I've got a bunch of lines with the following format:
word foo word { (maybe word) bar blatz more_words
Given the 2 input words foo and bar, I want to either return the value of
blatz, or modify the string to replace blatz with something else. The first
key (foo) is always the second word of the line. After I find foo I want
the opening '{', then I want to look for the second key (bar). The word
after the second key is the word of interest. foo and bar could be the
same word.
I've seen the following formats in my input data:
<a> <a> <junk> { <a> <data> }
<a> <b> <junk> { <a> <data> }
<a> <b> <junk> { <c> <data> }
<a> <a> <junk> { <b> <data> <c> <data> }
<a> <a> <junk> { <a> <b> <data> <c> <data> }
Single letters indicate repeating words (e.g. "fred wilma 0x8000 { fred 0x42 }"
would match the second case). Junk is a number. Inside the {} is either
the second word followed by key/value pairs, or just key/value pairs. There
can be more than 2 key/value pairs, I just used 2 (b/data c/data) as an
example.
Changing the format of these lines is not an option :-(
jim
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 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.
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 V7 Issue 972
*************************************