[7039] in Perl-Users-Digest
Perl-Users Digest, Issue: 664 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 20:07:30 1997
Date: Wed, 25 Jun 97 17:00:22 -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, 25 Jun 1997 Volume: 8 Number: 664
Today's topics:
alphabetical sort? (Robin Ittigson)
calling subroutines with part of a $ as a name (Calle ]sman)
Re: calling subroutines with part of a $ as a name <merlyn@stonehenge.com>
Re: calling subroutines with part of a $ as a name (Calle ]sman)
Dialer or interface for Perl Win32 <eric@hilding.com>
Re: Executing from command line to simulate the web tra (Quentin Fennessy)
Re: Grade my first Perl Project <rsimmons@interface-designers.com>
Re: Help me to find my loose change !!! (Quentin Fennessy)
Re: Making a MUD with CGI (Steven Alexander)
Re: Making a MUD with CGI <mattias.lonnqvist@uidesign.se>
making an associative array of scalar arrays <foxkw@mh.us.sbphrd.com>
Re: Newbie question: 500 Server Error (Abigail)
Obfuscation of Perl <matt@dotshop.com>
Passing values between separate programs <Dskramer@concentric.net>
Perl Tk Tutorial <freddyb@acsatlanta.com>
perl with netscape fasttrack <kanneda@uclink4.berkeley.edu>
Re: perldoc option (was: Re: POssibly Dumb Question: qq (Abigail)
problem w/ format and linebreaks <jcmurphy@smurfland.cit.buffalo.EDU>
Re: promote array with tie() <bri@mojo.calyx.net>
Re: Q: MacPerl, MacHTTP and CGI <neeri@iis.ee.ethz.ch>
Re: Regexps on streams (Ilya Zakharevich)
Re: sysread/syswrite mangle data on Win32? <wm_n00@tarrcity.demon.co.uk>
Re: uninitialized value warning for "truth condition" (Quentin Fennessy)
Re: uninitialized value warning for "truth condition" <garye@iname.com>
Re: Use and code in 2 files <garye@iname.com>
Re: Validating E-Mail addresses and URL's (Abigail)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Jun 1997 21:51:27 GMT
From: ittigson@cats1.admin.pps.pgh.pa.us (Robin Ittigson)
Subject: alphabetical sort?
Message-Id: <5os3sv$764@titania.pps.pgh.pa.us>
i'm fairly new to perl and am writing a cgi script to take input from a
form (name, email, etc.) and write that to a file. all that is easy. the
tough part, as i see it, is i want the names in the files to be listed in
alphabetical order. i know perl has a sort function, but i'm not sure if
it works like that. could someone tell me if it does, and if it doesn't,
point me in the right direction of how to get started. thanks
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
"If human beings don't keep exercising | matt ittigson
their lips, their brains start working." | ittigson@pps.pgh.pa.us
-Ford Prefect |
------------------------------
Date: 25 Jun 1997 10:56:32 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: calling subroutines with part of a $ as a name
Message-Id: <w7pvi336oxr.fsf@fraggel71.mdstud.chalmers.se>
I want to call a subroutine like this:
#the script
sub text1{
local($p) = @_;
start_$p;
print "done\n";
#other stuff
}
sub start_apa{
print "apa\n";
#do something}
sub start_bepa{
print "bepa\n";
#do something}
and if I call:
text1("bepa);
it shall print:
bepa
done
and if I call:
text1("apa");
it shall print:
apa
done
how do I do this?
/Calle
------------------------------
Date: 25 Jun 1997 14:59:03 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: Re: calling subroutines with part of a $ as a name
Message-Id: <8cafkez6mw.fsf@gadget.cscaper.com>
Well, here's the way I would do it...
>>>>> "Calle" == Calle ]sman <md4calle@mdstud.chalmers.se> writes:
Calle> #the script
Calle> sub text1{
Calle> local($p) = @_;
Calle> start_$p;
Calle> print "done\n";
Calle> #other stuff
Calle> }
%routine_map = (
"apa" => \&start_apa,
"bepa" => \&start_bepa,
);
sub text1 {
my $text = shift;
die "missing func for $text"
unless exists $routine_map{$text};
$routine_map{$text}->();
}
Calle> sub start_apa{
Calle> print "apa\n";
Calle> #do something}
Calle> sub start_bepa{
Calle> print "bepa\n";
Calle> #do something}
--
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: 25 Jun 1997 11:57:58 +0200
From: md4calle@scooter.mdstud.chalmers.se (Calle ]sman)
Subject: Re: calling subroutines with part of a $ as a name
Message-Id: <w7pvi33c8d5.fsf@scooter.mdstud.chalmers.se>
forgot to include the thing it was all about: how do I pass arguments?
sub start_apa{
local($meck) = @_;
print "$meck\n";
#do something}
$tag="apa";
#what do I type here to pass the argument to start_apa?
#this won't work
eval("start_".$tag) ("hello, world");
shall give the result
hello, world
/Calle
------------------------------
Date: Wed, 25 Jun 1997 15:13:01 -0700
From: Eric Hilding <eric@hilding.com>
Subject: Dialer or interface for Perl Win32
Message-Id: <33B197ED.51BA@hilding.com>
Looking for a dialer or interface to use in conjunction with a
perl script to automate dialup, downloading & manipulating raw
text data from a mainframe (could be a TCP/IP dialer). I'm
using Hyperaccess and Procomm to get the data now, but need
to automate the whole process. Using Perl in WIN95.
Tnx for any help.
Eric Hilding
eric@hilding.com
------------------------------
Date: 25 Jun 1997 21:01:40 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: Executing from command line to simulate the web transaction
Message-Id: <5os0vk$gu9$1@amdint2.amd.com>
In article <33b363fd.222475713@news.polarnet.com>,
Chris Lott <eclectic@polarnet.com> wrote:
>I've tried figuring it out from MAN pages and other resources, but I
>can't figure out how to execute a cgi script from the command line in
>a way which simulates being run from the web, ie passing a
>variable/keyword to the perl program that does a search. Is there some
>simple way to do this?
Use CGI.pm, and this technique (from perldoc CGI.pm):
If you are running the script from the command line or in
the perl debugger, you can pass the script a list of
keywords or parameter=value pairs on the command line or
from standard input (you don't have to worry about tricking
your script into reading from environment variables). You
can pass keywords like this:
your_script.pl keyword1 keyword2 keyword3
or this:
your_script.pl keyword1+keyword2+keyword3
or this:
your_script.pl name1=value1 name2=value2
or this:
your_script.pl name1=value1&name2=value2
or even as newline-delimited parameters on standard input.
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: Wed, 25 Jun 1997 17:14:10 -0500
From: Raymond Simmons <rsimmons@interface-designers.com>
Subject: Re: Grade my first Perl Project
Message-Id: <33B19832.65C@interface-designers.com>
Simon Fairey wrote:
>
> Brian Foddy wrote:
> >
> > Hi all,
> >
> > I just finished my first Perl project and I thought I'd
> > post the problem and my code to see how the experts would
> > grade my work.
>
> > PROBLEM, SOLUTION AND OTHER COMMENTS SNIPPED <
>
> > Brian Foddy
> > Eagan, MN
>
> SOME RESPONSE SNIPPED <
>
> Most of all remember this, if it works then you have acheived your goal
> and with time you will pick up the little tricks. Quite often you will
> then end up going back to your old scripts and think "my god that 100
> line script could have been done in 10"; then you rewrite it.
I just finished my first major Perl CGI script. It runs a Client
Management System that allows the user to update information on
clients. I've already thought of a lot of ways I could have done things
differently. I'm actually kinda humbled by this. When you're looking
at structures (CGI programs, Web sites, public leaders, etc.) from the
outside (as I was with Perl and CGI scripts only two months ago), they
can seem so solid and confident. Yet when you get on the inside, it's
amazing how many different ways things can be done. Thanks for the
thoughts on this issue Simon :)
> Simon
> BTW: comp.lang.perl no longer exists.
What do you mean it no longer exists?
Raymond Simmons
------------------------------
Date: 25 Jun 1997 20:59:40 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: Help me to find my loose change !!!
Message-Id: <5os0rs$gtb$1@amdint2.amd.com>
In article <01bc8193$db5e57a0$83a426a4@notebook.dixons.co.uk>,
Martin Williams <info@welnet.co.uk> wrote:
>I have written a few scripts that procee financial transactions but thus
>far I have been unable to round my numbers up to 2 decimal places !!!
Use sprintf. See perlfunc(1).
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: 25 Jun 1997 15:13:24 -0700
From: stevena@kelly.teleport.com (Steven Alexander)
Subject: Re: Making a MUD with CGI
Message-Id: <5os564$kro$1@kelly.teleport.com>
On Mon, 23 Jun 1997 18:36:04 -0600, darkmanlives@hotmail.com
(Dave) wrote:
>I need to know how I can make a multi-user-dungeon with Perl 5.0...
See <URL:http://www.boutell.com/perlmud/>, PerlMUD 2.1.
Steven Alexander
stevena@teleport.com
------------------------------
Date: Wed, 25 Jun 1997 10:03:00 +0200
From: Mattias Lvnnqvist <mattias.lonnqvist@uidesign.se>
Subject: Re: Making a MUD with CGI
Message-Id: <33B0D0B4.42EA@uidesign.se>
darkmanlives@hotmail.com wrote:
>
> Hi all,
>
> I need to know how I can make a multi-user-dungeon with Perl 5.0...
> it can be done, I've seen it, but I am quite new at Perl so be
> patient with me while I explain... I want to make a small adventure
> game in CGI for telnet... So, if you could give me a brief overview
> of what I need and how to use it, I would be very greatful.
First it would be interesting to know if you are planning a www-based or
a telnet based application. Your post states telnet, but also CGI which
makes me believe you have something using a browser in mind.
Secondly, if you are planning a telnet application, you should learn
about
sockets first. See: "http://www.cs.uno.edu/~golden/teach.html" for that.
/Mattias
--
This was a message from Mattias Lonnqvist * mailto:malo@uidesign.se
http://www.uidesign.se/~malo * phone +46 - (0)13- 37 12 05
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.uidesign.se/~malo/mail.html> for more info.
------------------------------
Date: Wed, 25 Jun 1997 16:22:43 -0400
From: Ken Fox <foxkw@mh.us.sbphrd.com>
Subject: making an associative array of scalar arrays
Message-Id: <33B17E13.1C7A@mh.us.sbphrd.com>
I am trying to assign an array as the element of an associative array,
so that I can have indexed access to the scalar arrays as though they
were records in a database.
Perl version
===========================================================================
# /usr/local/bin/perl -v
This is perl, version 5.003 with EMBED
built under solaris at Jun 26 1996 13:23:45
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
===========================================================================
the following code would exist in a loop
{
$barcode = $1; # Barcode
$label = $2; # Label or trailset
$unit = $3; # Unit
$location = $4; # Location (slot)
$state = $5; # State - available, cleaner, Allocated, other
$drive = $6; # Drive if mounted
$type = $7; # application Backup, Migration, Other
$volid = $8; # Volume ID (16 digit hexadecimal number )
# Load sub array data
$volume_data[$vl_barcode] = $barcode; # Barcode
$volume_data[$vl_label] = $label; # Label or trailset
$volume_data[$vl_unit] = $unit; # Unit
$volume_data[$vl_location] = $location; # Location (slot)
$volume_data[$vl_state] = $state; # State - available, cleaner,
Allocated, other
$volume_data[$vl_drive] = $drive; # Drive if mounted
$volume_data[$vl_type] = $type; # application Backup, Migration,
Other
$volume_data[$vl_volid] = $volid; # Volume ID (16 digit hexadecimal
number )
# Populate Associative array using the key that is specified in the
$assoc_index variable
## the following works to put data in the array
$volumes_list{$barcode} = ['zero', $barcode , $label , $unit , $location
, $state , $drive , $type , $volid , $WriteProtectFlag , $MaxUses ,
$Uses , $EjectFlag , $LabelFlag , $RecallFlag]
unless (defined $volumes_list{$barcode});
## what I want to do is this
$volumes_list{$barcode} = \$volume_data; ## line should work but
doesn't
}
$index++;
print "Entry = $index:\t-> Reference: $volumes_list{$barcode} -> Volume
ID -> $volid\n";
# == test code ==
print "BEFORE evmvol -> $barcode | ";
for ($x=1;$x<=14;$x++){
print " $$volume_data_ref[$x] |"; #<<<<<<<<<<<<<<<<<<<<<<<<## line
gives error
}
print "\n";
# == test code ==
############ Error messages received ###################
Use of uninitialized value at /usr/bak/lib/TapeEject.pm line 271, <GEN0>
chunk 2530.
BEFORE evmvol -> CLEAN1 | CLEAN1 | | at_dlt_6176_0 | 1 | cleaner | no
| Other | 0000000000000000 |
Use of uninitialized value at /usr/bak/lib/TapeEject.pm line 305, <GEN0>
chunk 2530.
AFTER evmvol -> CLEAN1 | CLEAN1 | | at_dlt_6176_0 | 1 | cleaner | no |
Other | 0000000000000000 | 0 | 18 | 15 | 0 | 0 | 0 |
Entry = 1: -> Reference: ARRAY(0x169d88) -> Volume ID ->
0000000000000000
Use of uninitialized value at /usr/bak/lib/TapeEject.pm line 315, <GEN0>
chunk 2530.
AFTER reassignment -> CLEAN1 | CLEAN1 | | at_dlt_6176_0 | 1 | cleaner
| no | Other | 0000000000000000 | 0 | 18 | 15 | 0 | 0 | 0 |
------------------------------
Date: Wed, 25 Jun 1997 23:01:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie question: 500 Server Error
Message-Id: <ECCtA4.As6@nonexistent.com>
Andre Pinheiro (ip201945@ip.pt) wrote on 1393 September 1993 in
<URL: news:33AFF327.4931@ip.pt>:
++
++ Can anyone tell me what's happening?
Yes, three things:
- You failed to read or understand all the CGI faqs.
- You posted in the wrong group.
- You posted multiple times.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Wed, 25 Jun 1997 18:08:07 -0400
From: Matt Mankins <matt@dotshop.com>
Subject: Obfuscation of Perl
Message-Id: <33B196C6.41C6@dotshop.com>
Does anyone know of a script to obfuscate Perl scripts?
I've heard that www.infohighway.com used to have a program called PORL
that made perl sources more compact. Does anyone have a URL for
something like this, or have an idea of someone who might?
Let me know...
Matt Mankins
matt@dotshop.com
------------------------------
Date: Wed, 25 Jun 1997 17:57:17 -0400
From: David Kramer <Dskramer@concentric.net>
Subject: Passing values between separate programs
Message-Id: <Pine.SUN.3.96.970625174051.5006A-100000@voyager.cris.com>
The short version of the story is that I have two programs running, and I
want to pass some complex object between them, prolly using sockets (I may
resort to shared memory but I would like the ability to run the two
programs on separate machined).
The long version: we have several sparcstations that are both web servers
and oracle servers to themselves. Whenever a user hits our site, an
instance of oraperl5 is launched to run index.cgi. It connects to the
database, does stuff, disconnects, then require()'s the correct perl
program to paint the correct web page for that person. What we would like
to do is have a oraperl5 program that's always running, connected to
oracle, and maintaining an array of cursors. Whenever a user hits our
site and oraperl5 is launched to run index.cgi (which in turn calls bla
bla..) , index.cgi should ask the perl daemon to give it the vars it needs
to continue using it's cursors.
Lets say the program wants to display a bunch of info being read from
oracle over the course of 5 pages. It would ask the daemon for the
$dbh/$dbi vars in addition to a new cursor, paint the first page based on
the query, and exit. When the same user clicks on the "next" button, our
program would fire up and ask the daemon for the $dbh/$dbi vars, and the
$cursor it asked for last time, so that it can continue to fetch rows from
the existing query.
If that cannot be done, my simpler plan is to have each program submit a
query to the daemon, have the daemon do all the sql work, and return one
row at a time in an array. Passing a string via sockets is easy, but can
I pass an array? Or do I have to turn it into some kinda delimited
string?
TIA.
-------------------------------------------------------------------
DDDD David Kramer dskramer@concentric.net
DK KD http://www.concentric.net/~dskramer
DKK D
DK KD Men like to barbecue. Men will cook if danger is involved.
DDDD -Rita Rudner
------------------------------
Date: Wed, 25 Jun 1997 17:13:56 -0400
From: "Alfred P. Bartholomai" <freddyb@acsatlanta.com>
Subject: Perl Tk Tutorial
Message-Id: <33B18A14.263F@acsatlanta.com>
Any one know of a good tutorial ? They have been hard to find. I have
come across one, that was quite simplistic in nature.
Any books yet on Perl Tk ?
Also, does anyone have a working example of the File Selection
Dialog box ? I have come across a few but after some tweaking I
still couldn't get it to run.
Any help or advice would be appreciated.
Thanx,
Fred Bartholomai
--
Alfred P. Bartholomai
Advanced Control Systems
Norcross, GA 30092
770 446 8854
770 448 0957 ( fax )
fred.bartholomai@acsatlanta.com
... it is better to light a candle than curse the darkness ...
------------------------------
Date: Wed, 25 Jun 1997 15:30:17 -0700
From: Ryan Choi <kanneda@uclink4.berkeley.edu>
Subject: perl with netscape fasttrack
Message-Id: <33B19BF9.46BC@uclink4.berkeley.edu>
a quick question that someone must be able to answer:
i'm running a netscape fastrack server with perl win32. i run
stuff fine with a .bat file through an html file --executed with
"<form action="cgi-bin/baby.bat" method = "post">"-- and it returns
the right stuff.
PROBLEM!!! for some reason, although it loads up, it never seems to
finish. i have to click on "stop" in order to get the browser to
complete, and even then, it results in a "transer interrupted!" message.
help? the .bat not finishing? the perl script missing something? please
help!
ryan
------------------------------
Date: Wed, 25 Jun 1997 21:12:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: perldoc option (was: Re: POssibly Dumb Question: qq() and qw()...)
Message-Id: <ECCo8z.1qE@nonexistent.com>
Ronald Fischer (rfi@uebemc.siemens.de) wrote on 1394 September 1993 in
<URL: news:xz27mfjjg6t.fsf_-_@uebemc.siemens.de>:
++ >>>>> On Mon, 23 Jun 1997 02:11:24 GMT
++ >>>>> "A" == Abigail <abigail@fnx.com> wrote:
++ A> $ perldoc -f qw
++ A> =item qw/STRING/
++ What is the '-f' option for? I did a
++ perldoc -h
++ and it listed as valid switches only
++ -h, -t, -u, -v
Then you need to upgrade to perl 5.004.
$ perldoc -h
perldoc [options] PageName|ModuleName|ProgramName...
perldoc [options] -f BuiltinFunction
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 25 Jun 1997 17:12:37 -0400
From: Jeff Murphy <jcmurphy@smurfland.cit.buffalo.EDU>
Subject: problem w/ format and linebreaks
Message-Id: <wwabu4ugzei.fsf@smurfland.cit.buffalo.edu>
This is perl, version 5.003_05
also tried 5.004
i was expecting the following code to print
this is a variable
this is a variable
this is a variable
but instead it printed
this is a variable this is a variable this is a variable
$: is set correctly.. what is going wrong?
if i change $var to "1a2a3" and set $: to 'a' .. it still doesnt
print the linebreak..
#!/usr/local/bin/perl
$var = "this is a variable
this is a variable
this is a variable";
write;
format STDOUT =
~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$var
~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$var
~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$var
.
--
jcmurphy@acsu.buffalo.edu sunyab cit oss network management
standard disclaimers apply http://smurfland.cit.buffalo.edu/~jcmurphy/
``Men forget but don't forgive. Women forgive but never forget.''
------------------------------
Date: 25 Jun 1997 21:36:06 GMT
From: Sol Lightman <bri@mojo.calyx.net>
Subject: Re: promote array with tie()
Message-Id: <5os306$cf4@cdc2.cdc.net>
Hi,
Is there a reference trick to help promote a standard perl
array into a tied class without recopying the data? Something
along the lines of
package foo;
sub promote {
print "Promote called with @_\n";
my($class, $array) = @_;
delete $main::{foo};
@main::foo = ();
tie @$array, "foo", $array;
}
sub TIEARRAY {
print "Tiearray called with @_\n";
my($class, $array) = @_;
return bless {A=>$array}, "foo";
}
package main;
@foo = (1,2,43);
promote foo \@foo;
print tied(@foo), $foo[1];
Which doesn't work (calls FETCH recursively). I've already tried
various ways of getting a reference to the data and ditching
the connection between the data and the original perl symbol
table entry. Any tips?
--
Brian S. Julin
------------------------------
Date: 25 Jun 1997 23:09:19 +0200
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: Q: MacPerl, MacHTTP and CGI
Message-Id: <86n2oev18g.fsf@iis.ee.ethz.ch>
Tom Phoenix <rootbeer@teleport.com> writes:
> On Wed, 25 Jun 1997, Adam Schneider wrote:
>
> > You don't have all the nifty $ENV variables in
> > MacPerl (stuff like HTTP referers, remote hosts, etc.).
>
> That's not correct, as far as I know. There are other %ENV variables which
> are different on different systems, of course, but when those are supposed
> to be there, they are, AFAIK.
Tom is right. To the best of my knowledge, all the ENV variables in the CGI
spec are there. However, currently released versions don't support keys %ENV
correctly yet, so one might get the mistaken impression that the variables
aren't there.
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"I will grant, however, that the idea of using information from the Internet
is not as popular right now as, for example, viewing coffee cups with
animated vapors." -- Erik DeBenedictis
------------------------------
Date: 25 Jun 1997 21:12:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regexps on streams
Message-Id: <5os1jf$p3q@agate.berkeley.edu>
In article <Pine.GSO.3.96.970625091334.15150W-100000@kelly.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
> On 25 Jun 1997, Andrew Pimlott wrote:
>
> > Has anyone thought about making it possible to use regular expressions
> > on streams?
>
> Yes, and some regular expressions would require loading the entire stream
> into memory to search efficiently.
>
> /(\b\w+\b).*\b\1\b/s
Why would you need to load the whole stream for something like this?
A tiny change to your regexp would make it
/(\b\w+\b).*?\b\1\b/s
which is much better when stream-oriented (though may be much slower
on "finished" strings).
> Maybe useful enough to implement as a module, but I don't think there's
> any need for it in the core.
It is not possible to implement in the module, and an implementation
in the core would add only 10 or 15 lines to the core (well, it add 10
lines to RE engine, but to access this feature from the outside world
you will probably need a module indeed).
> If you do make such a module, be sure to
> include the oft-desired ability to read input up to a regular expression
> as a delimiter, analogous to the use of $/ in the line input operator.
> Thanks!
This is the next step. When the RE engine is capable of the above,
one can actually _use_ this feature from the core perl.
Ilya
------------------------------
Date: Wed, 25 Jun 1997 23:05:24 +0100
From: Wm <wm_n00@tarrcity.demon.co.uk>
Subject: Re: sysread/syswrite mangle data on Win32?
Message-Id: <up2yqFAkYZszEwCM@tarrcity.demon.co.uk>
Fri, 20 Jun 1997 08:28:59 <ug1ud4fw4.fsf@berkshire.net>
Norman Walsh <norm@berkshire.net> posted...
>Hello World,
>
>Is there any way to read/write binary data under Win32? I
>discovered this morning that read(), sysread(), print, and
>syswrite() all do CR/LF conversion on Win32. In other words,
>if you attempt to write a buffer that contains a bare ^J,
>it will always get turned into ^M^J.
>
>Try this test:
>
>$file1 = "\@\@TEST\@\@.1";
>$file2 = "\@\@TEST\@\@.2";
>
>$_ = "A\012B";
>
>open (F, ">$file1");
# add
binmode F;
# here
>print F $_;
>close (F);
>
>open (F, ">$file2");
# add
binmode F;
# here
>syswrite (F, $_, length($_));
>close (F);
>
>Both of these files are four bytes long! For even more fun, consider
>this fragment:
>
>$file1 = "\@\@TEST\@\@.1";
>open (F, $file1);
# add
binmode F;
# here
>sysread (F, $_, -s $file1);
>close (F);
>print "Size: ", -s $file1, "\n";
>print "Len : ", length($_), "\n";
>
>It prints
>
>Size: 4
>Len : 3
>
>So sysread() is mangling things as well. Is there some local
>wierdness on my machine? If not, is there a workaround?
>
> Cheers,
> norm
ie add "binmode F;" immediately after opening your file otherwise its
presumed to be text and end of line conversions, etc are done.
This is dealt with in section 8.11 of the Perl for Win32 FAQ.
You should also check your opens have worked eg:
open (F, $file1) || die "can't open $file1: $!\n";
HTH
--
Wm ... did you know? My spell checker wants tarrcity to be atrocity.
------------------------------
Date: 25 Jun 1997 20:57:31 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: uninitialized value warning for "truth condition"
Message-Id: <5os0nr$gru$1@amdint2.amd.com>
In article <6phgen8ogw.fsf@ampere.mbi.ucla.edu>,
Danny Rice <dwrice@ampere.mbi.ucla.edu> wrote:
>
>I keep getting the "Use of uninitialized value at program.pl line
>XXX." warning, while using the -w switch. The complaint is coming
>from an IF (truth condition). If the (truth condition) evaluates to 0
>I get the warning. I have replaced "truth condition" with simply 0
>and still get the warning. With 1 I get no warning. I know that you
>can uninitialize a scalar by assinging it "" or "0", but this is just
>the "truth condition". What's going on?
I recommend that in the future you post the actual code that the
message refers to -- it helps.
>From perldiag:
Use of uninitialized value
(W) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe
it was a mistake. To suppress this warning assign an
initial value to your variables.
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: Wed, 25 Jun 1997 17:36:04 -0400
From: Gary Ebert <garye@iname.com>
To: Danny Rice <dwrice@ampere.mbi.ucla.edu>
Subject: Re: uninitialized value warning for "truth condition"
Message-Id: <33B18F44.669B@iname.com>
Danny Rice wrote:
>
> I keep getting the "Use of uninitialized value at program.pl line
> XXX." warning, while using the -w switch. The complaint is coming
> from an IF (truth condition). If the (truth condition) evaluates to 0
> I get the warning. I have replaced "truth condition" with simply 0
> and still get the warning. With 1 I get no warning. I know that you
> can uninitialize a scalar by assinging it "" or "0", but this is just
> the "truth condition". What's going on?
>
> --
> Danny W. Rice
> http://www.doe-mbi.ucla.edu/people/dwrice/dwrice.html
Try adding the following to your script
use diagnostics;
for even more of this type of error you can also add
use strict;
If this does not help let me know (I do not think you will need to let
me know)
--
Gary Ebert Operations Administrator
Voice: (301) 428-2115 Mobile Datacom Corporation
Fax: (301) 428-1004 19540 Amaranth Drive
Pager: (800) 490-7478 Germantown, MD 20875-2126
------------------------------
Date: Wed, 25 Jun 1997 17:41:07 -0400
From: Gary Ebert <garye@iname.com>
Subject: Re: Use and code in 2 files
Message-Id: <33B19073.BFA@iname.com>
Gary Ebert wrote:
[snip]
> replace above line with:
> use test; # if test.pm's directory is in the @INC
> use path::to::file:named::test; # if it isn't
OOPS that shoud read
use path::to::file::named::test; # if it isn't
SORRY !!!!!
[snip]
--
Gary Ebert Operations Administrator
Voice: (301) 428-2115 Mobile Datacom Corporation
Fax: (301) 428-1004 19540 Amaranth Drive
Pager: (800) 490-7478 Germantown, MD 20875-2126
------------------------------
Date: Wed, 25 Jun 1997 22:58:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Validating E-Mail addresses and URL's
Message-Id: <ECCt58.AM6@nonexistent.com>
Mark Thompson (mwt@cyberg8t.com) wrote on 1393 September 1993 in
<URL: news:33b04ef4.9187588@news.alt.net>:
++ URL:
++ ['HTTP://'] <VALID_URLDOMAIN> [ '/' <VALID_PATH>]
++
Look at http://www.ny.fnx.com/abigail/Perl/url.html if you
want to check whether an URL validates RFC 1738.
This of course doesn't mean if the document exists or not.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
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 664
*************************************