[8572] in Perl-Users-Digest
Perl-Users Digest, Issue: 2189 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 26 17:07:49 1998
Date: Thu, 26 Mar 98 14:00:29 -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 Thu, 26 Mar 1998 Volume: 8 Number: 2189
Today's topics:
Re: "Premature End of Script Headers" (Frans la Cour)
Re: An offer to buy a script (A Watcher)
ANNOUNCE: Authen::Prot v1.06 <paulg@twics.com>
ANNOUNCE: Logfile::Rotate 0.12 <paulg@twics.com>
ANNOUNCE: MiniVend 3.07 - free international shopping c <mike@ns.minivend.com>
Re: Dealing with the special chars in the file name (Andrew M. Langmead)
Re: Dealing with the special chars in the file name <mike@unival.com>
Error on WINDOWS95 machine <dennis.kowalski@daytonoh.ncr.com>
RE: extract columns from a line (Ed Avis)
I'll try again... <jay.blaise@clear.net.nz>
Re: MS Explorer shows extra chars from CGI program (Webmaster Jim)
Re: Need sorting routine in Perl (Gabor)
Re: Need sorting routine in Perl (Michael J Gebis)
Odd dereferencing behavior (Sean McAfee)
Re: Odd dereferencing behavior (Brian Jepson)
Re: Odd-Numbered Array to Hash (Craig Berry)
Re: Perl on Win95 - CMD32 - File Length Restriction ? (Tye McQueen)
Re: Perl5 DBLIB RPC <mpeppler@mbay.net>
Re: PROPOSAL: The Perl Dictionary (Joergen W. Lang)
Re: Q about CPAN Date module (Stan Horwitz)
Re: regular expression <cberry@cinenet.net>
Re: removing eval from a loop <jstern@world.northgrum.com>
Storable problems on Solaris 2.5.1 & 2.6, related to pR <vandevegt@lucent.com>
test -pls ignore (R Bradley)
ts: why have "push" and "unshift"? tsatan@hotmail.com
Re: ts: why have "push" and "unshift"? (Jason Gloudon)
Re: ts: why have "push" and "unshift"? (Mike Stok)
Re: what is wrong with being a novice ?? (Tye McQueen)
Re: what is wrong with being a novice ?? (Georg Bauer)
WinAT Scheduling of perl scripts mlayten@maerskdata-usa.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Mar 1998 17:01:33 GMT
From: flc@danbbs.dk (Frans la Cour)
Subject: Re: "Premature End of Script Headers"
Message-Id: <6fe1g3$mt3$1@news1.global-one.dk>
The Apache FAQ suggests to turn of buffering of output:
$| = 1; #Turn output buffering off
print "content-type: text/html\n\n" #print header
$| = 0; #Turn buffering back on to enhance performance
.. print whatever.....
check the Apache FAQ at http://www.apache.org/
Frans
In article <01bd53b8$a8048bc0$a26c42ce@zaika>, "Alex Lane" <alexlane@ghg.net>
wrote:
>I tried your idea, adding
>
>print $!;
>
>which returned a message to the effect that the file (which was there)
>could not be found.
>
>What gives?
>
>Cheers...
------------------------------
Date: Thu, 26 Mar 1998 21:19:46 GMT
From: dodge@aloha.net (A Watcher)
Subject: Re: An offer to buy a script
Message-Id: <3526c62c.3286979@news.aloha.net>
Hi,
In an effort to reinforce the security of transactions at my site, I
posted a request for code. The original author of the script used
on the site, Rick Torzynski, at http://www.lobo.net/~rtweb/ has
provided an elegant solution where all the information I need, is
provided on the customers confirmation, and my copy of the
transaction. This solution better than the original concept.
I appreciate the response received from my original post and want to
thank all who contacted and helped me. I even got code to embed into
my script, for free! The intimidation factor of this idea may make
visitors feel that they have lost some privacy which in turn, may
affect sales at the site which are already poor. So, I have gone with
what I think is - a better solution.
This is a very helpful newsgroup.
Again,
Thank You So Much.
On Sun, 22 Mar 1998 08:42:07 GMT, in comp.lang.perl.misc you wrote:
>Hi,
>
>I need a script that runs on a unix server that will function in the
>major browsers (ver. 3.xx of Netscape and MS IE) that will reflect the
>address, date and time of a visitor to my site. This utility to be
>placed on several pages to inform the visitor that the visit is
>logged. The script to be embedded into a perl 5 file that is already
>running a shopping cart program and printing to the pages produced by
>the existing script. The output should also be printed to a log file
>that I can access that is separate to my regular log file. This log
>file should be flexible where if deleted or damaged will self generate
>as well as append new data. The print to page to help deter
>potential, problem transactions.
>
>Something like:
>
>Welcome 206.173.225.180
>[21/Jan/1998:23:39:50 -0800]
>Your visit has been logged.
>
>If you have such a script running, give me the url to check it out
>and how much you want for it.
>
>You can check the running script at:
Much Mahalo,
John
The more I know, the more I know -- I don't know.
{:>)=
http://www.spiced.com
------------------------------
Date: 26 Mar 1998 19:20:42 GMT
From: Paul Gampe <paulg@twics.com>
Subject: ANNOUNCE: Authen::Prot v1.06
Message-Id: <6fe9qa$ivi$1@news1.teleport.com>
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
Authen::Prot adpO The SecureWare Security Database API PAULG
RELEASE:
Version: 1.06
NAME
Authen::Prot - Perl extension for accessing protected password database
SYNOPSIS
use Authen::Prot;
Authen::Prot::setprpwent();
$pw = Authen::Prot->getprpwent();
$pw = Authen::Prot->getprpwuid(0);
$pw = Authen::Prot->getprpwnam('daemon');
print "$pw->ufld_fd_name\n";
$pw->ufld_fd_slogin(time);
$pw->putprpwnam();
$crypt = Authen::Prot::bigcrypt('test', 'test');
Authen::Prot::endprpwent();
DESCRIPTION
The Authen::Prot module provides access to the protected password
database via the getprpwent, getprpwuid, getprpwnam, getprpwaid,
setprpwent, endprpwent, and putprpwnam system calls available on those
Unix systems using the Protected Password database written by
SecureWare Inc. (c)..
INSTALL
perl Makefile.PL
make
make install
CHANGES
Added code to handle sco's unsigned short and skip void*
Adding method for acceptable_password function, available on both hp and
sco.
Name change from Prot to Authen::Prot as suggested by modules@perl.org
Added documentation
AVAILABILITY
http://www.twics.com/~paulg/modules/
and shortly at all CPAN mirrors
COPYRIGHT
See the man page.
Enjoy and thanks for all the feedback, Paul.
--------------------------------------------------------------------------
mailto:paulg@twics.com phoneto:81-3-3351-5977 faxto:81-3-3353-6096
The students learn that effective action arises out of silence and a clear
sense of being. In this they find a source of peace. They discover that
the person who is down-to-earth can do what needs doing more effectively
than the person who is merely busy. - Lao Tzu's "Tao Te Ching" 500BC
--------------------------------------------------------------------------
------------------------------
Date: 26 Mar 1998 19:20:11 GMT
From: Paul Gampe <paulg@twics.com>
Subject: ANNOUNCE: Logfile::Rotate 0.12
Message-Id: <6fe9pb$ivd$1@news1.teleport.com>
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
Logfile::Rotate adpO Perl module to rotate logfiles PAULG
RELEASE:
Version: 0.12
NAME
Logfile::Rotate - Perl module to rotate logfiles.
SYNOPSIS
use Logfile::Rotate;
my $log = new Logfile::Rotate( File => '/var/adm/syslog',
Gzip => 'no' );
$log->rotate();
INSTALL
perl Makefile.PL
make
make install
CHANGES
Added reference to Changes file for credits to contributions.
Switched from File::Copy::copy to File::Copy::move for rotating the
old logfiles, to preserve permissions and reduce disk space
consumption. File::Copy::move will try to do a rename. Suggested by:
webmaster <webdata@web-datavision.com>
and "Mike Arms (6531)" <marms@sass1633.csua35.sandia.gov>.
Added code to copy the current log file permissions to first
incremental. Code and concept by: "Mike Arms (6531)"
<marms@sass1633.csua35.sandia.gov>.
Added an argument Signal so that you can get a callback function
executed as soon as the rotation is complete. Code and ideas
contributed by: "M. S. Sriram" <sriram@research.bell-labs.com>,
and Mike Frohme <frohme@memphis.edu>
AVAILABILITY
http://www.twics.com/~paulg/modules/
and at all CPAN mirrors
COPYRIGHT
See the man page.
Enjoy and thanks for all the feedback, Paul.
--------------------------------------------------------------------------
mailto:paulg@twics.com phoneto:81-3-3351-5977 faxto:81-3-3353-6096
The students learn that effective action arises out of silence and a clear
sense of being. In this they find a source of peace. They discover that
the person who is down-to-earth can do what needs doing more effectively
than the person who is merely busy. - Lao Tzu's "Tao Te Ching" 500BC
--------------------------------------------------------------------------
------------------------------
Date: 26 Mar 1998 19:19:37 GMT
From: Mike Heins <mike@ns.minivend.com>
Subject: ANNOUNCE: MiniVend 3.07 - free international shopping cart
Message-Id: <6fe9o9$iuo$1@news1.teleport.com>
Keywords: shopping cart basket trolley free catalog minivend
M I N I V E N D
MiniVend is a full-featured electronic catalog system (commonly known
as a shopping cart) with online ordering capability. It is designed to
provide an interface complete with SSL security and full database
support.
MiniVend is freely-redistributable under the GNU General Public
License -- you can download it via FTP.
MiniVend 3.0 Features
* Users maintain a "shopping cart" for ordered items
* Multiple independent or shared catalogs allow one server
to run many storefronts or a "mall"
* SSL support means secure and practical credit card ordering
* PGP support for secure off-site mailing of orders
* Integrated support for CyberCash(tm)
* Catalogs can be of almost unlimited size with excellent
performance
* Multi-server mode for very high capacity on systems with
sufficient memory
* Complete addressable database support with virtually
unlimited rows and columns
* Complete SQL support including ODBC
* Fully internationalized including currency, sorting
and language
* Powerful search capability
* Embedded Perl and conditional HTML allow complex and
flexible catalog pages to be completely built from
the database
* Many, many, other features
# MiniVend V3.07
#
# Copyright 1996-1998 by Michael J. Heins <mikeh@minivend.com>
#
# Based on Vend 0.2
# Copyright 1995 by Andrew M. Wilcox
#
# Portions from Vend 0.3
# Copyright 1995,1996 by Andrew M. Wilcox
#
# This program is free software; most users can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation.
A V A I L A B I L I T Y
A N D
C O M P A T I B I L I T Y
MiniVend has been well-tested on Solaris 2, Linux, Windows 95/NT,
SunOS, OSF/Alpha, HP/UX, IRIX, BSDI, FreeBSD, SCO, and other UNIX
operating systems. It should work on almost any UNIX with a RELEASE
version of Perl 5.004 or higher that passes the Perl 'make test' 100%.
Please let the author know if you have successfully run MiniVend on
any additional platforms -- patches would be appreciated.
The author is very interested in learning your problems with MiniVend,
and is always interested in improving the documentation. (He isn't much
interested in BEING your documentation, though, unless you pay well and
promptly.) Please send comments, well-researched questions, kudos,
and complaints to:
mikeh@minivend.com
------------------------------
Date: Thu, 26 Mar 1998 20:48:15 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Dealing with the special chars in the file name
Message-Id: <EqG1sF.JL4@world.std.com>
tipirneni@yahoo.com writes:
> $, (, ), & and % that are changing the file names by replacing the
>$<name> and %<name> by null or the & and ( are giving "sh: syntax errors".
> Is there a elegant way to deal with this problem ?
>note: the file is not read directly, it is read through a lex filter, so the
>exact way is like
> open XXX, "my_lex_filter \"$filename\"|";
In the perlipc man page, there is an example of using the special "-|"
argument to open() to avoid calling /bin/sh. Minus the error checking,
it would be something like:
open XXX, "-|" or exec "your_lex_filter", $filename;
The open() sets up a pipe between the parent and child. The child then
calls "exec" with a list calls the program directly with the list as
the argument list. No intervening shell, so no shell metacharacters
are interpreted.
I guess you could also escape the metacharacters in the filename
before passing it to open():
# list of metacharacters from perl's do_exec function
$filename =~ s/([\$&*(){}\[\]'";\\|?<>~`\n])/\\$1/g;
open XXX, "your_lex_filter \"$filename\" |" or die;
--
Andrew Langmead
------------------------------
Date: Thu, 26 Mar 1998 13:14:31 -0800
From: Mike Hitchcock <mike@unival.com>
Subject: Re: Dealing with the special chars in the file name
Message-Id: <351AC537.435CB295@unival.com>
Andrew M. Langmead wrote:
> I guess you could also escape the metacharacters in the filename
> before passing it to open():
>
> # list of metacharacters from perl's do_exec function
> $filename =~ s/([\$&*(){}\[\]'";\\|?<>~`\n])/\\$1/g;
> open XXX, "your_lex_filter \"$filename\" |" or die;
quotemeta [quotemeta EXPR]
This function returns the value of EXPR (or $_
if not specified) with all non-alphanumeric characters
backslashed. This is the internal function
implementing the \Q escape in interpolative
contexts (including double-quoted strings,
backticks, and patterns).
>From the camel book, page 201
--
Mike Hitchcock
mike@unival.com
hitchcock@earthling.net
------------------------------
Date: Thu, 26 Mar 1998 15:42:37 -0500
From: Dennis Kowalski <dennis.kowalski@daytonoh.ncr.com>
Subject: Error on WINDOWS95 machine
Message-Id: <351ABDBD.2E29@daytonoh.ncr.com>
This pertains to the WIN32 environment
I have several users using WINDOWS95 workstations with drives from a NT
4.0 server mapped to their machine.
They execute perl and perl scripts off of the server.
Everyone works fine except one user who gets an error anytime a perl
script does a system command.
for example
system("del filex");
The error he gets is
ERROR: can not create cmd file
it doesn't seem to matter what the command to be system'ed is.
I am sure it has something to do with his WINDOWS95 setup but I do not
know what it could be.
Has anyone else running on a WINDOWS95 machine had this problem.
I am running Activeware build 315.
Thanks
------------------------------
Date: Thu, 26 Mar 1998 20:50:39 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: RE: extract columns from a line
Message-Id: <351a9dae.94061813@news-direct>
A while ago, I asked:
"how do I extract columns from a line, with their position?"
The best solution I got (from dj@home.actlab.utexas.edu) was:
while (<>)
{
$i = 0;
s/(\s*)(\w+)/$i += length($1); print "$i:$2\n"; $i +=
length($2);/gex;
}
--
Ed Avis
------------------------------
Date: Fri, 27 Mar 1998 09:10:33 +1200
From: Jay and/or Blaise <jay.blaise@clear.net.nz>
Subject: I'll try again...
Message-Id: <351AC449.1EC4467A@clear.net.nz>
Anybody successfully installed the win32 version of Perl?
I'm having a couple of problems that I could use some help with.
I have read the FAQ, the manual, the readme etc etc.
Cheers
Jay
--
Web Development: http://www.ipnz.com
Weblinks: http://www.ipnz.com/weblinks
Web Design:-:Web Hosting:-:Domain Registrations
------------------------------
Date: Thu, 26 Mar 1998 15:51:21 -0500
From: "Jim Spath (Webmaster Jim)" <jspath@mail.bcpl.lib.md.us>
Subject: Re: MS Explorer shows extra chars from CGI program
Message-Id: <Pine.SOL.3.96.980326154859.20087B-100000@mail.bcpl.lib.md.us>
On Wed, 25 Mar 1998, Jim Spath (Webmaster Jim) wrote:
> I'm getting extra characters at the beginning and ending of html pages
> Perl is: 5.004_57
> CGI is: 2.36
Never mind! I updated the server to wn-1.19.7 and it wnet away.
Something to do with "chunks" MSIE doesn't handle properly...
Sorry for the noise.
------
<http://www.cs.indiana.edu/picons/db/users/us/md/lib/bcpl/jspath/face.xbm>
Marvin the Paranoid Android says:
Come on then; let's get this over with as soon as possible.
------------------------------
Date: 26 Mar 1998 20:35:35 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Need sorting routine in Perl
Message-Id: <slrn6hlf37.ear.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Amar Subramanian <amar@iss-gmbh.de> wrote :
# Gabor wrote:
# >
# > In comp.lang.perl.misc, Didiek <didiek@intouch.co.id> wrote :
# > # Hi,
# > #
# > # Does anyone know how or where can I get a sample perl script for sorting
# > # numbers. I plan to build a link list and display them in a top referrer
# > # order basis. Just like top50 or top100 or whatever.
# >
# > What's wrong with the built in 'sort'?
# >
# i don't think there is an opportunity to use sort with a linked list, or
# is there any ? if ther is one please let me know.
Why on earth would you want to use a linked list? You can use an
array in perl like a linked list if you will. Linked lists are
unnecessary for the most part even in C, in my opinion.
#
# regards amar
------------------------------
Date: 26 Mar 1998 20:23:08 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Need sorting routine in Perl
Message-Id: <6fedfc$7kt@mozo.cc.purdue.edu>
Didiek <didiek@intouch.co.id> writes:
}Does anyone know how or where can I get a sample perl script for sorting
}numbers. I plan to build a link list and display them in a top referrer
}order basis. Just like top50 or top100 or whatever.
}Any information would be very appreciated.
This works:
#!/usr/bin/perl5 -w
sub is_sorted {
my($x,@list)=@_;
my($e);
if($#list==-1){return 1;}
foreach $e (@list) {
if($e>=$x) {
$x=$e;
} else {
return 0;
}
}
return 1;
}
sub fast_sort {
my(@list)=@_;
my($left,$right);
while(!is_sorted(@list)) {
print "list: ",join(" ",@list),"\n";
$left=rand($#list+1);
$right=rand($#list+1);
if($right>$left){ #XXX
if($list[$left]>$list[$right]) { #XXX
($list[$right],$list[$left])=($list[$left],$list[$right]);
}
}
}
return @list;
}
#Example sort
@list=(10,9,8,7,1,2,3,4,800,123,234,987,3.14159,223,-9,9,1,8,2,7.3,6,4,5.5,4.6,3.7,2.8,1.9);
print join(" ",fast_sort(@list)),"\n";
#Hm, I wonder if fast_sort uses the optimal 'algorithm'?
#It _IS_ much faster than when I left of the lines marked #XXX
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Thu, 26 Mar 1998 20:55:35 GMT
From: mcafee@gorf.rs.itd.umich.edu (Sean McAfee)
Subject: Odd dereferencing behavior
Message-Id: <bhzS.2276$SV6.8957460@news.itd.umich.edu>
Observe this script:
----------------------------------------------------------------------
$a = "test";
$b = bless \$a;
sub foo {
my $str = ${shift};
print "$str\n";
}
$b->foo;
----------------------------------------------------------------------
This script prints a single newline--not what I want. If, however, I
change the first line of subroutine foo to this:
my $str = ${shift;};
...I get "test" printed to my terminal, as expected. Every other variation
I've tried (${shift @_}, ${my $x = shift}, etc) works correctly; only
the simplest, ${shift}, doesn't.
My question can be summed up in one word: Huh?
--
Sean McAfee | GS d->-- s+++: a25 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 26 Mar 1998 21:15:09 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: Odd dereferencing behavior
Message-Id: <slrn6hlh9t.1ft.bjepson@gelvis.ids.net>
In article <bhzS.2276$SV6.8957460@news.itd.umich.edu>, Sean McAfee wrote:
>Observe this script:
>
>----------------------------------------------------------------------
>$a = "test";
>$b = bless \$a;
>
>sub foo {
> my $str = ${shift};
> print "$str\n";
>}
>
>$b->foo;
>----------------------------------------------------------------------
>
>This script prints a single newline--not what I want.
>
[...]
What did you get when you tried it with -w? I got the following:
Ambiguous use of ${shift} resolved to $shift at /tmp/foo line 5.
Name "main::shift" used only once: possible typo at /tmp/foo line 5.
Use of uninitialized value at /tmp/foo line 6.
You probably want to be saying:
my $str = ${ shift() };
Hope this helps,
--
Brian Jepson * (bjepson@ids.net) * http://users.ids.net/~bjepson
------------------------------
Date: 26 Mar 1998 18:47:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Odd-Numbered Array to Hash
Message-Id: <6fe7se$8ib$3@marina.cinenet.net>
Art Cohen (upsetter@shore.net) wrote:
: I have a list with an odd number of elements... let's say it looks like
: this:
:
: @data = ("name", "Art", "phone");
:
: I want to convert this to a hash %data where $data{'name'} eq "Art" and
: $data{'phone'} eq "", however, simply saying
:
: %data = @data;
:
: doesn't work... the last field ("phone") simply gets thrown into the bit
: bucket. Is there any way to avoid this?
push @data, undef if @data % 2;
%data = @data;
I've used undef rather than an empty string for the missing value so you
can distinguish missing from 'supplied but blank' values -- in case that
ever matters.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 26 Mar 1998 11:55:26 -0600
From: tye@fiinix.metronet.com (Tye McQueen)
Subject: Re: Perl on Win95 - CMD32 - File Length Restriction ?
Message-Id: <6fe4qe$ar9@fiinix.metronet.com>
philippe <oesch@bluewin.ch> writes:
) just how do i configure command.com on winnt 4.03 to accept ctrl-z as
) the eof marker, anyways? while being in perl typing ctrl-z just prints
) to the screen and does ***not*** shove my script in the interpreter...
)
) what am i missing?
Enter (or Return). CTRL-Z does mark end of file but it
doesn't get read until you finish the input line.
Tye
------------------------------
Date: Thu, 26 Mar 1998 13:18:49 -0800
From: Michael Peppler <mpeppler@mbay.net>
Subject: Re: Perl5 DBLIB RPC
Message-Id: <351AC639.4AA2@mbay.net>
Ken Chesak wrote:
>
> I need an example of executing an RPC(stored procedure) with 1 input
> parameter and 1 output parameter. I know the basic calls are dbrpcinit,
> dbrpcparam, dbrpcsend, dbresults. The RPC is only called once so a
> little overhead is not an issue. Can this be done without using all 4
> calls mentioned above.
>
> I am running Perl5.004_01, using the DBLIB calls version 2.04 on HP
> Unix.
You can use straight SQL and the dbcmd/dbsqlexec/dbresults loop:
$dbh->dbcmd("declare @foo int\n");
$dbh->dbcmd("exec my_proc $param, @foo output\n");
$dbh->dbsqlexec; $dbh->dbresults;
if($dbh->DBROWS) { # if the stored proc returned any rows
while(@dat = $dbh) {
# do something with any returned rows?
}
@ret = $dbh->dbretdata;
$ret[0] is the OUTPUT param
Michael
PS - you should upgrade your sybperl installation. 2.04 wasn't the most
stable of releases. The current release is 2.09.
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
------------------------------
Date: Thu, 26 Mar 1998 22:33:32 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <1d6iot6.tr2i8s1l7dlt8N@host025-206.seicom.net>
yet a few more...
perldoc - your surgeon of first choice to cure your Perl problems
perldiag - what perldoc thinks is your Perl problem
perlop - what your program needs when the perldiag is very bad
perltoot - see perlguts
perlstyle - e.g. perlties
perlbot - see perlmod
podiguos - Perl is, somehow
cheers,
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: 26 Mar 1998 20:54:51 GMT
From: stan@thunder.temple.edu (Stan Horwitz)
Subject: Re: Q about CPAN Date module
Message-Id: <6fefar$5im$1@cronkite.ocis.temple.edu>
Stan Horwitz (stan@thunder.temple.edu) wrote:
: Thanks to the folks in this group, I was recently introduced to Sullivan
: Beck's Date module, which I installed yesterday after downloading it from
: the CPAN Web site. The reason why I installed this Date module package is
: so I can set up a Perl script that iterates once for each date between two
: dates. For example, if I have "03/30/98" and "04/02/98" as my start and
: end dates, respectively, I want to process "03/30/98", "03/31/98",
: "04/01/98", and "04/02/98". I am a novice Perl programmer, but it seems to
: me that the logical thing to do is to use the &Date_GetNext function to
: begin with the start date and keep looping until the program reaches the
: end date.
Please disregard my posting. I was able to get the job done using the
DateCalc module. I still don't know what I did wrong with the Date_GetNext
module, but its a moot point now.
Thanks just the same.
------------------------------
Date: Thu, 26 Mar 1998 12:23:27 -0800
From: Craig Berry <cberry@cinenet.net>
To: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: regular expression
Message-Id: <Pine.GSO.3.95.980326121946.3295C-100000@hollywood.cinenet.net>
On Fri, 27 Mar 1998, ? the platypus {aka David Formosa} wrote:
> > (NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw) wrote:
> >: just a simple question: how can I write a perl script to identify
> >: all strings of 0's and 1's that do not contain the substring 011 ?
>
> >The single-regex way to test one string for your condition is
>
> > /^(?!.*011)[01]+$/
>
> Or without negative lookups.
>
> /^1*(0|10)*[01]?$/
Or slightly optimized to avoid alternation:
/^1*(1?0)*[01]?$/
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Thu, 26 Mar 1998 19:32:41 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: removing eval from a loop
Message-Id: <351AAD59.FC9B7C29@world.northgrum.com>
John Lukas wrote:
>
> Jim -
>
> Thanks for your reply. If I may, a couple followup questions:
>
> > The bad news: BLOCK eval is not flexible enough for your needs. It
> > requires that "the code to be executed doesn't vary." (See perlfunc.)
>
> I don't think that I understand. The code (within the eval) doesn't
> vary,
> at least for any given invocation of the program.
Suppose $field contains your list of fields. E.g.,
my $field = "$f1,$f2,$f3,...";
If you EXPR(ession)-eval a string containing $field, Perl expands
$field into its value (assuming you are using a double-quotish
string) before compiling the code. If you BLOCK-eval a block containing
$field, Perl compiles code containing the un-expanded variable $field
instead.
> [...]
> > @hash{@ARatts} = split /${delim}/, $_;
>
> OK, I understand that. Then, to reference the carodnr field, I use
> $hash{carodnr}, correct?
Yes.
> At least this seems to work the way I expect.
Because it's correct. :-)
>
> > print "@hash{@ARatts}\n";
>
> This I could not get to work. It puts spaces between fields, rather than
> the desired "$," (in this case, a pipe).
Variable `$,' defines the string placed between successive operands
to `print'. You want variable `$"', which defines the string that
separates
consecutive elements when a stringized array is expanded.
In other words:
@a = (0,1);
print $a[0], $a[1]; # Prints "0", then $, then "1"
print "@a"; # Prints "0", then $", then "1"
See perlvar re/ these (and any) predefined Perl variables.
But I'm glad you didn't know this because it prompted you
to make a most instructive mistake.
> I tried:
>
> print @hash{@ARatts} . "\n";
>
> which I thought would be the same as:
>
> print $hash{carodnr}, $hash{field}, $hash{order}, $hash{actdate},
> $hash{value} . "\n";
>
> (which is the effect I want) but instead, it acted like:
>
> print $hash{value} . "\n";
>
> (that is, it printed the value of the last field, unfortunately named
> "value")
> which I don't understand.
A construct like @hash{@Aratts} is a "hash slice." It often acts much
like a list. However, the `.' operator causes Perl to evaluate the
hash slice in a scalar context rather than in the expected list context.
In this case, that means Perl behaves as if you had used the last
element
in the list, which is $hash{value}.
What you want is to join up all the elements in the slice and follow
them with a newline. You want to use `$,' to separate the elements.
Ok:
$" = $,
print "@hash{@ARAtts}\n";
I recommend a review of 'Context' in perldata.
Hope this helps.
--
Jim Stern -- Views here are my own, not my employer's. (Hawthorne, CA)
------------------------------
Date: Thu, 26 Mar 1998 15:24:07 -0600
From: Jim VandeVegt <vandevegt@lucent.com>
Subject: Storable problems on Solaris 2.5.1 & 2.6, related to pRPC.
Message-Id: <351AC777.F824214F@lucent.com>
I just installed Storable-0.5@4 hoping it would solve my pRPC problem,
but it has not. Storable compiled clean on Sun hardware running
Solaris 2.5.1 and Solaris 2.6, with perl 5.00404.
I am using Jochen Wiedmann's pRPC and pNET packages to (attempt) remote
network connections.
The error I am receiving is "Not a scalar string at
.../Storable/thaw.al, line 13, at pClient.pm line 304. I've tracked
this error message to Storable.xs line 208 inside the MBUF_LOAD macro.
This macro is being called by the mretrieve function at line 1761.
This error is consistent in that when it shows up, it shows up during
the RPC connect phase. When it happens, and which side gives the error,
is erratic. There are at least three scenarios I have encountered.
1. I run pNETagent, and I have a small script which connects to a
database, does one query, and exits. This works fine.
2. Same pNETagent and database as in #1, this time the client is a
little more involved and is a CGI script, and I receive the error on the
CLIENT.
3. I have server and client scripts, quite small (as posted here in a
different message about a week ago), which are scaled down versions of
the examples in Jochen's pRPC documentation. I receive the error
message on the SERVER.
What's the definition of a "scalar string" in this context?
Where is the code for SvPOK, which appears to be deciding whether it's a
scalar string or not (in Storable.xs). I can't find it in Storable; is
it part of perl?
Any points or test scripts would be greatly appreciated.
--
Jim VandeVegt
vandevegt@lucent.com
------------------------------
Date: 26 Mar 1998 21:05:49 GMT
From: rick@rentec.com (R Bradley)
Subject: test -pls ignore
Message-Id: <6fefvd$jvn$1@puma.rentec.com>
this is a test of our local propagation
--
--
"This just came over the wires: A tornado hit Camden, New Jersey.
It did $20 million worth of improvements." -- Milton Berle
Rick Bradley -- Renaissance Technologies Corp. -- (516) 444-7000
------------------------------
Date: 26 Mar 1998 21:47:39 GMT
From: tsatan@hotmail.com
Subject: ts: why have "push" and "unshift"?
Message-Id: <6feidr$js7$1@orthanc.reference.com>
Jarkko Hietaniemi <jhi@alpha.hut.fi> wrote:
> The assignment versions do each an unnecessary copy (and a list
> creation). push() and unshift() operate the array in-place which
> is much faster.
[sorry, lynx doesn't give me much room to quote]
Thanks Jarkko and Mike Stok for the speedy responses!
One follow-up question: any ideas why the perl compiler doesn't
optimize "@arr = ($x, @arr)" into "unshift @arr, $x"?
Or am I the only perlson who would do something like that? ;-)
Here's a PerlTip: put striped output in your HTML tables like this:
my @colors = ("#cccccc", "#ccccff"); my $i = 0;
for (@your_data) {
print qq(<tr bgcolor="$colors[$i]"><td>$_</td></tr>);
$i= !$i; } # anyone have a better way?
--------------------------------------------------------------------
Posted using Reference.COM http://WWW.Reference.COM
FREE Usenet and Mailing list archive, directory and clipping service
--------------------------------------------------------------------
------------------------------
Date: Thu, 26 Mar 1998 20:20:48 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: ts: why have "push" and "unshift"?
Message-Id: <slrn6hle2e.s26.jgloudon@manitoba.bbn.com>
tsatan@hotmail.com <tsatan@hotmail.com> wrote:
>Why does perl have the "push" and "unshift" functions?
>Consider an array: @nums = (1, 2, 3);
>Then: push @nums, 4; is the same as @nums= (@nums, 4);
> and: unshift @nums, 0; is the same as @nums= (0, @nums);
>I know perl's motto is "There's more than one way to do it",
>but these two functions seem especially unnecessary. Are they
>more efficient? Or am I missing a case where the second solution
>would fail?
Well for one thing,
@nums = (@nums,4) requires creating an entire temporary array,
an operation which may take say number_of_elements_in(@num) * x seconds,
whereas push can often do the same thing in x second(s).
--
Jason Gloudon
------------------------------
Date: 26 Mar 1998 18:54:25 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ts: why have "push" and "unshift"?
Message-Id: <6fe891$qp5@news-central.tiac.net>
In article <6fe9um$g30$1@orthanc.reference.com>, <tsatan@hotmail.com> wrote:
>Why does perl have the "push" and "unshift" functions?
>Consider an array: @nums = (1, 2, 3);
>Then: push @nums, 4; is the same as @nums= (@nums, 4);
> and: unshift @nums, 0; is the same as @nums= (0, @nums);
>I know perl's motto is "There's more than one way to do it",
>but these two functions seem especially unnecessary. Are they
>more efficient? Or am I missing a case where the second solution
>would fail?
You can do it a third way with splice too :-)
One thing I can think of is that with splice, shift, unshift etc. perl can
operate on its internal lists, but @nums= (0, @nums) looks just like an
assignment to perl so it may do more work than necessary. Try this:
#!/usr/local/bin/perl -w
use Benchmark;
$count = 1000;
@nums = $count x (1);
print "unshift\n";
@nums = ();
timethis ($count, 'unshift @nums, 1');
print "assign\n";
@nums = ();
timethis ($count, '@nums = (1 ,@nums)');
__END__
Then try it with a count of 10000 or 100000 and see what happens :-)
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@colltech.com | Collective Technologies (work)
------------------------------
Date: 26 Mar 1998 11:42:44 -0600
From: tye@fiinix.metronet.com (Tye McQueen)
Subject: Re: what is wrong with being a novice ??
Message-Id: <6fe42k$7ka@fiinix.metronet.com>
gb@hugo.westfalen.de (Georg Bauer) writes:
) DRS <simpsond@tig.com.au> wrote:
)
) > What is wrong with it is that the vast majority of people - especially
) > newbies - are not using UNIX.
)
) Ok. What's wrong with perldoc perlfaq?
1) It will use "more" on a lot of newbie's systems which
(if from Microsoft) doesn't support searching.
2) For the same reasons, it often won't let you scroll backward.
3) It doesn't support jumping between different documents
when you run into a cross-reference that looks interesting.
4) It doesn't support printing the part you just selected.
5) It doesn't do the neat highlighting and changing fonts to
make the keywords easier to tell from the text.
6) It doesn't let you jump right to www.perl.com or www.perl.org
or other web resources that aren't included with the standard
perl distribution.
7) It doesn't let you "bookmark" the parts you keep needing to
go back to because it just doesn't quite make sense yet.
But it has advantages over *.html docs as well. I just think
the flood of FAQs from Microsoft customers justifies making
the HTML docs more visible by default on Microsoft platforms.
See several recent posts from me for more on this.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Thu, 26 Mar 1998 19:28:17 GMT
From: gb@hugo.westfalen.de (Georg Bauer)
Subject: Re: what is wrong with being a novice ??
Message-Id: <1d6if7l.m8ulc8ghtpydN@hugo.westfalen.de>
Hi!
> converters. I have the ActiveState distribution on Win95, and *damned*
> if I can find perldoc, pod2*, or any such thing.
Ok, I should have said "in all complete Perl implementations" :-)
The ActiveState is hopelessly broken, IMO. I prefer the core
distribution, especially when you try to build extensions from CPAN. And
ActiveState is still 5.003, while 5.004 is out quite some time. And the
core distribution includes all that nice Win32-stuff, too. And, of
course, perldoc and *.pod.
bye, Georg
--
http://www.westfalen.de/hugo/
------------------------------
Date: Thu, 26 Mar 1998 15:19:49 -0600
From: mlayten@maerskdata-usa.com
Subject: WinAT Scheduling of perl scripts
Message-Id: <6fegl5$7jj$1@nnrp1.dejanews.com>
Yes I've checked the FAQs, yes I've searched the DejaNews archives and found
only an unresolved post in German which I had translated.
That said, does anyone know of any quirks of running a Perl script with the
WinAT scheduler under Windows NT? I'm successfully running two other jobs
with WinAT, but the command "c:\perl\bin\perl c:\perl\bin\Create.pl" is not
creating the appropiate file output (the same command works when typed at the
c: level of the command prompt).
Any ideas?
Also, I'm running into serious hard drive limitations on my "production"
machine. What is the minimum NT install of Perl to run a script?
(Programming, debugging, etc done on another machine)
-Melinda Layten
Paid to do perl for 3 months 3 years ago, now just another perl hack
mdumll@maersk.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
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 2189
**************************************