[7548] in Perl-Users-Digest
Perl-Users Digest, Issue: 1174 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 14 11:09:39 1997
Date: Tue, 14 Oct 97 08:00:24 -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 Tue, 14 Oct 1997 Volume: 8 Number: 1174
Today's topics:
ANNOUNCE: IndexMaker 1.0: an index.html maker from PDF <pivari@geocities.com>
Re: Automated subscription with .htaccess <jaydee@worsdall.demon.co.uk>
Re: Checking for a file <bholzman@mail.earthlink.net>
Re: Help with MacPerl help (Chris Nandor)
Re: How to extract substrings out of a line? <bholzman@mail.earthlink.net>
HTML parser for Perl FOUR! <Falcon@darkwave.org.uk>
Re: HTML parser for Perl FOUR! (Tad McClellan)
Re: Launch Applications from Macperl (Chris Nandor)
Memory problem - PERL / Windows NT. (Berhin Jean-Francois)
Re: Module for dealing with INN spools. (Brendan O'Dea)
most efficient way to find the LAST line number in a fi (Krishan Purahoo)
One line word count? (Pete Ashdown)
Re: One line word count? (Tad McClellan)
Re: Out of memory error? <Brian_shields.0192063@nt.com>
Re: Perl Compiler (Patrick)
Perl on IIS 3.0 han7159@cs.nyu.edu
Perl system() call never returns (Solaris 2.5.1, Perl 5 (Bruce Hahne)
Re: printf ("%-${n}s %4d %-$bl s\n", $names, ($k+1), $s (Andrew M. Langmead)
Re: printf ("%-${n}s %4d %-$bl s\n", $names, ($k+1), $s (Andrew M. Langmead)
Re: PTY object for perl <gbarr@ti.com>
REGULAR EXPRESSION: Search & Replace <carpente@execpc.com>
Re: REGULAR EXPRESSION: Search & Replace (Lars Gregersen (c908239))
Search: Reference Book (Christophe ODDO)
Re: Search: Reference Book (Tad McClellan)
Re: Search: Reference Book <camerond@mail.uca.edu>
Re: Server-Push and MS IE <ghowland@hotlava.com>
split(/$dirsep/) problem ($dirsep = "\\") (Simon Oosthoek)
Re: split(/$dirsep/) problem ($dirsep = "\\") (Tad McClellan)
Re: split(/$dirsep/) problem ($dirsep = "\\") (Toutatis)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 14 Oct 1997 08:53:29 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: IndexMaker 1.0: an index.html maker from PDF files
Message-Id: <34433309.237C@geocities.com>
Hi,
I'm glad to announce the version 1.0 of IndexMaker a perl script to make
an index.html file from PDF files.
At the moment, it uses the /Author fild and the first /Title fild in
every matched PDF files.
It should work with PERL 4 and 5.
This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469
Enjoy it!
Send me your suggestions.
--
_/_/_/_/ _/_/_/ Fabrizio Pivari
_/ _/ _/ mailto:pivari@hotmail.com
_/_/_/ _/_/_/ mailto:pivari@geocities.com
_/ _/ http://www.geocities.com/CapeCanaveral/Lab/3469/
_/ _/
------------------------------
Date: Tue, 14 Oct 1997 15:16:55 +0100
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: Automated subscription with .htaccess
Message-Id: <ORS+UEAX73Q0Ew4W@worsdall.demon.co.uk>
In article <3436C3B8.49E3@livjm.ac.uk>, ECSSPEAR@livjm.ac.uk writes
>Does anyone know of any scripts that will automate the subscription of
>new users using .htaccess?
>
I would say this would be a highly dangerous thing to do. If users can
subscribe automatically that implies they have write access to
.htaccess, which means that some clever people can redirect say your
index.html/stm/stml/htm page to a site of their choosing.
Even if you run a program I would suggest that before it runs a human
checks the subscription data first.
I could be wrong?
--
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk WEB site:- http://www.shadow.org.uk
------------------------------
Date: Tue, 14 Oct 1997 08:40:54 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
Subject: Re: Checking for a file
Message-Id: <34436856.E73472B7@mail.earthlink.net>
Doug Seay wrote:
>
> Randal Schwartz wrote:
> >
> > >>>>> "John" == John Grimm <jgrimm@wireedm.com> writes:
> >
> > John> How can I check to see if a file is there or not?
> >
> > Try to remove it with unlink. If the result is 0, it wasn't there.
> > If the result is 1, it's not there now.
> >
> > :-)
>
> As is this solution doesn't work for directories (not part of the
> original question). For that to work right, you have to be running as
> root with the -U option.
>
> - doug
You'd better hope no neoperlite with root access takes this thread
seriously... ;-)
------------------------------
Date: Tue, 14 Oct 1997 10:35:49 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Help with MacPerl help
Message-Id: <pudge-ya02408000R1410971035490001@news.idt.net>
In article <dmerberg-1310972028540001@d12.dial-2.ltn.ma.ultra.net>,
dmerberg@genetics.com (David Merberg) wrote:
# I am trying to run MacPerl on a 68K macintosh running system 7.53. My
# browser is Netscape 3.01. When I try to use MacPerl's online help,
# MacPerl feeds netscape an URL that looks something like this:
#
# pod:///Macintosh%20HD/applications/PD%20software/MacPerl%205%20/pod/perl.pod
#
# But Netscape doesn't know what to do with an URL that starts with pod:///.
#
# I've tried to use the Internet Config utility that comes with MacPerl, but
# I still can't get it to work.
You need to set, in Internet Config's Helper Apps section, "Shuck" as the
helper for "pod". Shuck is a POD viewer that comes with MacPerl.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Programming for the Rest of Us ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Tue, 14 Oct 1997 08:51:43 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: John Robson <as646@FreeNet.Carleton.CA>
Subject: Re: How to extract substrings out of a line?
Message-Id: <34436ADF.3CF44904@mail.earthlink.net>
[posted & mailed]
John Robson wrote:
>
> $line = "testing: 7/100 45/100 30/50"
>
> Would like to extract 7, 45 and 30 from $line and store them in the array
> @mynumbers. Why doesn't this work ? How to do this ?
>
> if ( $line =~ (/[0-9]+\//) )
> {
> push(@mynumbers, $1);
> }
If you want to use the pattern variables $1, $2, ..., you have to
specify in your pattern using parenthesis the pieces you want to store.
Check perlre. Also, if you want to find all the matches, you have to do
a global match, like this:
while ($line =~ m#([0-9]+)/#g) { # Using '#' instead of '/' to
push (@mynumbers, $1); # delimit pattern.
}
Of course, since a global match in list context actually returns a list
of everything it matches, you could more easily do this:
push(@mynumbers,$line=~m#[0-9]+(?=/)#g);
Note that here, since the entire string which matches will be returned,
if I included '/' in the pattern normally, my numbers would have '/'
after them. Since I want to match numbers with a '/' after them, but
not match the '/', I use a lookahead assertion: '(?=/)'. Check perlre
for more details...
HTH,
Benjamin Holzman
------------------------------
Date: Tue, 14 Oct 1997 11:28:40 +0100
From: -=Falcon=- <Falcon@darkwave.org.uk>
Subject: HTML parser for Perl FOUR!
Message-Id: <34434958.2311@darkwave.org.uk>
In answer to my previous posts, people told me about CGI.pm
This is only (as far as I can see) around for Perl 5.
Alas Perl 5 isnt an option so far (due to problems with old scripts
using chomp calls which 5 doesnt apparently handle).
So, if *you* know of a perl 4 routine/library/add-on that simply
removes RETURN chars (i.e %0D%0A in a URL QUERY_STRING), and/or any
other crap so it basically amounts to a one line string of chars,
PLEASE let me know...(I dont check news much, so please e-mail a copy
to Falcon@darkwave.org.uk)
Peter Truman
--
.---. .----------- Peter James Truman
/ \ __ / ------ -=Falcon=-
/ / \( -`-, -----
////// '~ ( --- Falcon@darkwave.org.uk
//// / // : ; --- http://www.falcon.darkwave.org.uk/
// / / /) / --
/ //..\\
==========UU====UU===========================================================
'//||\\` I wish my heart was taken, but I could never let it
go
''``
------------------------------
Date: Tue, 14 Oct 1997 07:35:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: HTML parser for Perl FOUR!
Message-Id: <huov16.iq.ln@localhost>
-=Falcon=- (Falcon@darkwave.org.uk) wrote:
: In answer to my previous posts, people told me about CGI.pm
: This is only (as far as I can see) around for Perl 5.
: Alas Perl 5 isnt an option so far (due to problems with old scripts
: using chomp calls which 5 doesnt apparently handle).
Uhh. You have that backwards.
Perl 5 knows chomp()
Perl 4 does not know chomp()
So I guess there is some other reason you must use a perl version
that was superceded years ago?
: So, if *you* know of a perl 4 routine/library/add-on that simply
Sorry, I won't even consider thinking in perl 4 anymore.
You're on your own (well, there might actually be a couple dozen
perl 4 programmers left in the world, but there are thousands and
thousand of perl 5 programmers who might help you, if they could,
but they can't, because they are part of the contemporary world ;-)
: (I dont check news much, so please e-mail a copy
: to Falcon@darkwave.org.uk)
I don't think so.
--------------------------------------------------------------------------
Subject: How to find the right place to post (FAQ)
Date: 11 Jun 1997 17:01:37 -0400
Followup-To: news.newusers.questions
Expires: 9 Jul 1997 21:01:30 GMT
Summary: This article gives some general hints to help you find an
appropriate place to post on a given topic, and gives pointers
to some available resources. A few other new-user topics are
also addressed, mostly through pointers to other FAQs.
[The most recent version of this document is posted periodically in
several newsgroups, including news.newusers.questions, news.groups, and
news.announce.newusers. It can also obtained by anonymous FTP as
ftp://rtfm.mit.edu/pub/usenet/news.answers/finding-groups/general. If
you do not have access to anonymous FTP, you can retrieve it by
sending email to mail-server@rtfm.mit.edu with the command "send
usenet/news.answers/finding-groups/general" in the message.]
[ ... snip ... ]
3) Any article to a newsgroup you do not read
If you do not read a newsgroup, you cannot know what the subject of the
newsgroup is, what the standards of behavior are, what the frequently
discussed topics are. Usenet does not exist to give you a free research
tool. It is also considered incredibly rude to post a question to a
^^^^^^^^^^^^^^^^^^^^^^^^^^
newsgroup you do not read, and ask for replies in e-mail - by doing so,
you are telling the people you want to answer your question that their
issues are not important to you.
--------------------------------------------------------------------------
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 14 Oct 1997 10:25:45 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Launch Applications from Macperl
Message-Id: <pudge-ya02408000R1410971025450001@news.idt.net>
In article <schinder-0910972015240001@schinder.clark.net>,
schinder@leprss.gsfc.nasa.gov wrote:
# In article <343C63EA.3158@cinci.infi.net>, cmuth@enquirer.com wrote:
#
# } Hello,
# }
# } It would be greatly appreciated if someone could tell me how to simply
# } launch an application from MacPerl. I tried:
# }
# } open(AFILE,"| ".$OpenThisFile) || die "couldn't do it";
#
# Unless you're using the MPW tool and Toolserver, this doesn't have a
# chance in hell of working. Pipes don't work under MacOS.
#
# The easiest way to launch another application is by using AppleScript:
#
# MacPerl::DoAppleScript(<<END);
# launch application "foobar"
# END
I have a new module in testing called Mac::Launch::Apps which uses the
Mac::Processes and module to launch an app by a given app ID (the unique
four-char code every Mac app has).
It should be on CPAN in about a week.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Programming for the Rest of Us ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Tue, 14 Oct 1997 13:16:15 GMT
From: berhin@fpms.ac.be (Berhin Jean-Francois)
Subject: Memory problem - PERL / Windows NT.
Message-Id: <34436f94.22847412@news.umh.ac.be>
I've this problem with Perl - Windows NT 4.0 & 3.51 + odb :
When i try to make a connection with micrsoft odbc (access, ...) :
OleMainThreadWndName : perl.exe : application error
The instruction at "0x04a5cd84" referenced memory at "0x00000003c".
The memory could not be "written"
What's the problem ?
I've Perl on another PC with NT 4.0 and i've no problem ...
Thank's.
Please, reply by e-mail at : berhin@fpms.ac.be
------------------------------
Date: 14 Oct 1997 10:54:07 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: Module for dealing with INN spools.
Message-Id: <61vj0f$si5$1@diablo.compusol.com.au>
In article <876388426.468854@cabal>,
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> wrote:
>In <eli$9710081351@qz.little-neck.ny.us> Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:
>
>>? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> wrote:
>>> Has any one created a perl module for accessing newspools?
>
>[...]
>
>>What do you want to do with the newsspool?
>
>Given a message-id I would like to get the vaule of veriouse headers in
>that post.
[snip]
>More importnetly to me is the interface the the history file. However
>these appear to be normal dbz files that perl can handel via ties. In
>addtion there is some example code for them. It looks like I will have a
>bit of work to do.
[snip]
While you could use the DBZ_File module, if you only intend to access
a handful of messages at a time, it may be simpler just to use INN's
grephistory program (which maps message ids to article paths):
my $grephistory = glob '~news/bin/grephistory';
sub fetch_headers ($)
{
my $id = shift;
my $art;
if (open HIST, '-|')
{
$art = <HIST>;
close HIST;
}
else
{
exec $grephistory, '-e', $id;
}
return unless $art and open ART, $art;
local $/ = '';
$_ = <ART>;
close ART;
chomp;
map { /^([^:]+):\s*(.*)/ } split /\n/;
}
Is a small function which returns the headers of an article as a hash
given the message-id.
my %h = fetch_headers '876388426.468854@cabal';
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: 14 Oct 1997 14:20:12 GMT
From: kpur@jet.uk (Krishan Purahoo)
Subject: most efficient way to find the LAST line number in a file
Message-Id: <61vv2s$8sn$1@flex.news.pipex.net>
What is the most efficient method to get the LAST line number
of a file, in perl (no system call).
Reading the file in an array seems to be quite slow
Can I use seek for this?
TIA
krishan
krishan.purahoo@jet.uk
------------------------------
Date: 14 Oct 1997 03:56:22 -0600
From: pashdown@slack.xmission.com (Pete Ashdown)
Subject: One line word count?
Message-Id: <61vfk6$73r@slack.xmission.com>
I'm trying to figure out a single statement method of counting instances of
a word in a line. I've been using split (with the word as a separator),
but I don't believe it is entirely accurate all the time.
--
"By pressing the spacebar you will kill yourself" - Self Deliverance Software
Pete Ashdown pashdown@xmission.com Salt Lake City, Utah
XMission Internet Access - Data: 801 990 0900 - Voice: 801 539 0852
------------------------------
Date: Tue, 14 Oct 1997 07:14:17 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: One line word count?
Message-Id: <pmnv16.cn.ln@localhost>
Pete Ashdown (pashdown@slack.xmission.com) wrote:
: I'm trying to figure out a single statement method of counting instances of
Why a single statement?
here's one anyway:
$wordcount = /(\w+)/g;
: a word in a line. I've been using split (with the word as a separator),
^^^^^^
That depends on what definition you'd like to use for a 'word'.
Are these words?
WWW
home-brew
123
perl thinks the first and third are words and the second is not a word...
: but I don't believe it is entirely accurate all the time.
Perl FAQ, part 6:
"How do I process each word on each line?"
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 14 Oct 1997 09:21:25 -0400
From: brian shields <Brian_shields.0192063@nt.com>
Subject: Re: Out of memory error?
Message-Id: <344371D5.58E0@nt.com>
Jong,
I made the change to the program and believe it or not, it finished.
It ended up only using 28MB. A bit more than I would expect, but at
least it finished normally. Thanks for the advice. It would be
interesting to know why localizing variables with "my" would so
drastically change the programs memory usage???
Brian
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Jong wrote:
>
> brian shields wrote:
> >
> > Greetings,
>
> Hi,
>
> I ususally fill up our 1 GB memory 500mhz Dec Alpha
> machine in the lab with a program which can use
> only 10mb memory.
>
> This happens when I use hashes without using
> local or my (this means, I continuously
> add keys and values making huge hashes while
> I have to reset at a regular interval.)
>
> The other way to do this is when it is not
> easy to reset with local or my. I often
> use soft reference and sometimes it is
> difficult to restrict with my etc.
>
> eg) ${"hash_name"}{"$key"}=$value;
>
> As the hash name changes continously, you can
> create very large number of hashes etc.
>
> Anyway, my guess is you are not restricting
> your hashes or arrays. If you say push(@array, xx);
> and do not dump @array at the right place, you
> will get too big an array.
>
------------------------------
Date: Tue, 14 Oct 1997 22:45:33 GMT
From: webmaster @ fictional.net (Patrick)
Subject: Re: Perl Compiler
Message-Id: <61vt7k$np5$2@news.NL.net>
perl2exe
Search with yahoo or something.
Telemaco <tsestini@ais.it> wrote:
>Hi,
>I want to know (if exists) where I can take a "true" Perl compiler for
>MS-DOS.
>I want to mean a Perl compiler that creates an executable file (.EXE)
>Thank in advance
> Telemaco
------------------------------
Date: Tue, 14 Oct 1997 09:37:18 -0600
From: han7159@cs.nyu.edu
Subject: Perl on IIS 3.0
Message-Id: <876839101.30995@dejanews.com>
Hi,
I use IIS 3.0 on NT 4.0 sever. I made Perl CGI running fine but I
have two problems using PerlScript.
1. PerlScript in HTML does not respond anything. Here's the sample
code.
<script language="PerlScript">
$window->document->write("PerlScript says: Hello, world!");
</script>
This is a part of helloworld example included in PerlSei310.exe
2. Active server page (.asp) was not running. I set the virtual
directory permission as "execute" but it gives me "http 1.0 403 Access
forbidden.." error message.
I need to find a solution for PerlScript in Active Server Page. Does
anyone have some information?
Thank you.
Young-Min
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 14 Oct 1997 10:12:03 GMT
From: hahne@netcom.com (Bruce Hahne)
Subject: Perl system() call never returns (Solaris 2.5.1, Perl 5.004_03)
Message-Id: <hahneEI1Do3.3qn@netcom.com>
Sorry if this question comes up often, but I've checked FAQs and spent some
time browsing the dejanews archives for help with this lockup problem to no
avail.
Context:
Perl5.004_03
Solaris 5.5.1 for x86 with Sun's recommended security patches.
"uname -v" says "Generic_103641-12".
Problem: calls to Perl's system() command intermittently fail to return for
some system() calls, and always fail to return for other types of system()
calls. I have been unable to pinpoint any pattern regarding when a call
will wedge and and when it won't.
When system() fails to return, the Perl process spins forever and burns
CPU. Running "uptime" shows a load level which climbs to 1.0. When the
wedge condition occurs, ps does not show the child process running; more on
this later.
The lockup problem always shows up for a particular, and rather simple,
script I've writte. The Perl code I'm running looks something like this:
if($CHECKPOINTS) { print stderr "Checkpoint 1\n"; }
$cmd = "$MYCOMMAND -t -m $filename1 -o=$filename2";
system($cmd);
if($CHECKPOINTS) { print stderr "Checkpoint 2\n"; }
The program never prints the Checkpoint 2 message.
When $MYCOMMAND is run from the shell command line, it works and exits properly.
I ran truss on the Perl program to see what's going on. The output suggests
an infinite loop forever catching SIGCLD, but I'm no Unix signal guru so I
don't know where to point the blame. I'll attach an extract from the truss
run below.
Is this problem due most likely to:
- A Perl 5.004_03 bug?
- A Solaris 5.5.1 bug in signal handling (or other?)
- Me not writing good Perl code somehow?
And can anyone suggest a workaround or a fix? Has this problem come up
before?
Here's the truss extract. We can see my "Checkpoint 1" message followed
by the child starting up with a fork.
---------------------------------------------------------------------------
write(2, " C h e c k p o i n t 1".., 13) = 13
fork() = 26124
sigaction(SIGINT, 0x08047AE4, 0x08047BB0) = 0
sigaction(SIGQUIT, 0x08047AD8, 0x08047B90) = 0
Received signal #18, SIGCLD, in waitid() [caught]
siginfo: SIGCLD CLD_EXITED pid=26124 status=0x0000
waitid(P_PID, 26124, 0x08047A94, WEXITED|WTRAPPED) Err#91 ERESTART
sigaction(SIGCLD, 0x080476E4, 0x08047738) = 0
setcontext(0x080477F8)
Received signal #18, SIGCLD [caught]
sigaction(SIGCLD, 0x08047764, 0x080477B8) = 0
setcontext(0x08047878)
Received signal #18, SIGCLD [caught]
sigaction(SIGCLD, 0x08047764, 0x080477B8) = 0
setcontext(0x08047878)
Received signal #18, SIGCLD [caught]
sigaction(SIGCLD, 0x08047764, 0x080477B8) = 0
setcontext(0x08047878)
Received signal #18, SIGCLD [caught]
[repeat the above 3-line sequence forever; program spins, burning CPU.
Perl system() call never returns, though ps suggests that the child
process has indeed completed.]
---------------------------------------------------------------------------
Thanks in advance for any help folks can offer! I'd be happy to post a
summary if there's interest.
Yours,
Bruce Hahne
Access Internet Solutions Inc.
hahne@netcom.com Web: www.aisol.net
------------------------------
Date: Tue, 14 Oct 1997 13:44:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: printf ("%-${n}s %4d %-$bl s\n", $names, ($k+1), $seq);
Message-Id: <EI1nI3.185@world.std.com>
Jong <jong@mrc-lmb.cam.ac.uk> writes:
>It used to work fine with perl5.003,
>("%-${n}s")
Works here:
/usr/tmp/aml>cat testme.pl
cat testme.pl
#!/usr/bin/perl -w
$var = "x" x 10;
$n = 20;
printf("%-${n}s",$var);
/usr/tmp/aml>perl5.003 -v
perl5.003 -v
This is perl, version 5.003 with EMBED
built under irix at Jul 3 1996 12:52:37
+ 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.
/usr/tmp/aml>perl5.003 testme.pl
perl5.003 testme.pl
xxxxxxxxxx /usr/tmp/aml>
/usr/tmp/aml>perl5.004 -v
perl5.004 -v
This is perl, version 5.004_01
Copyright 1987-1997, 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.
/usr/tmp/aml>perl5.004 testme.pl
perl5.004 testme.pl
xxxxxxxxxx /usr/tmp/aml>
/usr/tmp/aml>
>NOw with perl5.004, it does not work.
>I guess perl5.004 tried to be more secure and does not
>allow symbolic refer??
That isn't a symbolic reference. Its a simple scalar being interpreted
in a double quoted string. A symbolic reference would have a variable
inside the curly braces.
("%-${$n}s")
--
Andrew Langmead
------------------------------
Date: Tue, 14 Oct 1997 14:15:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: printf ("%-${n}s %4d %-$bl s\n", $names, ($k+1), $seq);
Message-Id: <EI1ox2.1pM@world.std.com>
Jong <jong@mrc-lmb.cam.ac.uk> writes:
>It used to work fine with perl5.003,
>("%-${n}s")
Works here:
/usr/tmp/aml>cat testme.pl
cat testme.pl
#!/usr/bin/perl -w
$var = "x" x 10;
$n = 20;
printf("%-${n}s",$var);
/usr/tmp/aml>perl5.003 -v
perl5.003 -v
This is perl, version 5.003 with EMBED
built under irix at Jul 3 1996 12:52:37
+ 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.
/usr/tmp/aml>perl5.003 testme.pl
perl5.003 testme.pl
xxxxxxxxxx /usr/tmp/aml>
/usr/tmp/aml>perl5.004 -v
perl5.004 -v
This is perl, version 5.004_01
Copyright 1987-1997, 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.
/usr/tmp/aml>perl5.004 testme.pl
perl5.004 testme.pl
xxxxxxxxxx /usr/tmp/aml>
/usr/tmp/aml>
>NOw with perl5.004, it does not work.
>I guess perl5.004 tried to be more secure and does not
>allow symbolic refer??
That isn't a symbolic reference. Its a simple scalar being
interpolated in a double quoted string. A symbolic reference would
have a variable inside the curly braces.
("%-${$n}s")
There are some differences between the evaluation of the s?printf
functions between 5.003 and 5.004. 5.004 handles more of the
conversion itself rather than handing to the native C library call. I
think the reasons were for security, but it also gave a greater
consistancy between platforms. This should be handled by the new
native format string parsing though. Both will process the
interpolation in the double quoted string before processing the format
string.
--
Andrew Langmead
------------------------------
Date: Tue, 14 Oct 1997 07:34:35 -0500
From: Graham Barr <gbarr@ti.com>
To: Karl Hakimian <hakimian@eecs.wsu.edu>
Subject: Re: PTY object for perl
Message-Id: <344366DB.933668E6@ti.com>
Karl Hakimian wrote:
>
> A project I've been working on uses PTYs and after an unsuccessful
> search for a PTY module for perl I decided to write one. (I did find the
> Ptty module, but I could not get it to compile on my machine and what I
> wanted could be done entirely in perl.)
There is a pty module for perl called IO::Pty which you will find in the
IO_Tty distribution on CPAN. However it is based on the Ptty
module by Nick Ing-Simmons.
Please try this module and if it does not compile then let me
know. If you do not notify people of problems you find then
they may never get fixed.
The distribution can be found at
http://www.perl.com/CPAN/authors/id/GBARR/IO-Tty-0.02.tar.gz
Graham.
--
Originality is the ability to conceal your source.
------------------------------
Date: Tue, 14 Oct 1997 06:36:14 -0500
From: Vinny Carpenter <carpente@execpc.com>
Subject: REGULAR EXPRESSION: Search & Replace
Message-Id: <3443592E.3A34D488@execpc.com>
hi guys.. I have a question that I'm hoping someone can answer. Using
Perl on a Linux box. Here's what I would like this script to do:
Run through a text file. Find all lines that are ALL CAPS and add
something to them. For example: If it encounters something like this:
Before:
ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU..
After:
<H3>ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ..</H3>
There will be several other lines in that file that have mixed case that
should be ignored. I've tried the following to no avail
/usr/local/bin/perl -pi.bak -e 's/^.*?~[A-Z]~.*$/<\/H2>/i' vin.html
and many other variations, but I'm not getting there. Any ideas??
Thanks in advance.
--Vinny
------------------------------
Date: 14 Oct 1997 14:17:26 GMT
From: matlg@bohr.gbar.dtu.dk (Lars Gregersen (c908239))
Subject: Re: REGULAR EXPRESSION: Search & Replace
Message-Id: <61vutm$3ah$1@news.uni-c.dk>
Vinny Carpenter (carpente@execpc.com) wrote:
: Run through a text file. Find all lines that are ALL CAPS and add
: something to them. For example: If it encounters something like this:
: Before:
: ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU..
: After:
: <H3>ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ..</H3>
: There will be several other lines in that file that have mixed case that
: should be ignored. I've tried the following to no avail
: /usr/local/bin/perl -pi.bak -e 's/^.*?~[A-Z]~.*$/<\/H2>/i' vin.html
: and many other variations, but I'm not getting there. Any ideas??
: Thanks in advance.
Hi!
Your 'i' at the end would really spoil things for you even if the rest did work
so get rid of that.
Also you are just checking for a single upper case character with [A-Z].
You are missing the space character with that class, too. So [A-Z ]+ would
be much better.
Then we just need to anchor the reg.exp. properly and to correct the
mistake in the replace expression. A solution for your reg.exp. might be:
$s1 = 'THIS IS A TEST';
$s1 =~ s/^([A-Z ]+)$/<h1>$1<\/h1>/;
print "$s1\n";
I don't know what your '.*?' is supposed to do in your expression, but if it
meant to allow and replace whitespace at either side of the upper case text
you might get away with
$s2 = ' THIS IS A TEST ';
$s2 =~ s/^\s*([A-Z ]*[A-Z])\s*$/<h1>$1<\/h1>/;
print "$s2\n";
I hope this helps. Otherwise there is help in the perlre manpage.
-------------------------------------------
Lars Gregersen
Department of Chemical Engineering
Technical University of Denmark
E-mail: lg@kt.dtu.dk
Homepage: http://www.gbar.dtu.dk/~matlg/
------------------------------
Date: Tue, 14 Oct 1997 12:04:35 GMT
From: 2002@calva.net (Christophe ODDO)
Subject: Search: Reference Book
Message-Id: <34435fcd.492041@news.calvacom.fr>
Hi group,
I'm searching for an "ultimate and definitive" Perl reference book
(CGI use) and I'm an absolute beginner...
Can anyone (please no editor, no author) tell me the title of a very
good, complete and clear book about Perl?
(If needed, my workstation: PC, W95)
Thank you for answers!!
Christophe
Marseille, France
------------------------------
Date: Tue, 14 Oct 1997 06:28:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Search: Reference Book
Message-Id: <71lv16.ui.ln@localhost>
Christophe ODDO (2002@calva.net) wrote:
: Hi group,
: I'm searching for an "ultimate and definitive" Perl reference book
: (CGI use) and I'm an absolute beginner...
The ultimate and definitive Perl reference is not a book at all.
It is free!
It comes with every proper perl distribution!
It is the man pages (Plain Old Documentation) ;-)
The Camel (aka "Programming Perl") is the most authoritative
reference book.
A reference book will likely not be enough for an "absolute beginner"
though.
What do you mean by that?
Do you mean "I have never programmed before"?
Do you mean "I am a programmer, but I've never done Perl or CGI
programs before"?
: Can anyone (please no editor, no author) tell me the title of a very
: good, complete and clear book about Perl?
The Llama (aka "Learning Perl") is a good introduction to Perl.
Both the Llama and the Camel are published by O'Reilly http://www.ora.com
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 14 Oct 1997 09:32:53 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Search: Reference Book
Message-Id: <34438294.5BB61FC2@mail.uca.edu>
Christophe ODDO wrote:
> Hi group,
>
> I'm searching for an "ultimate and definitive" Perl reference book
> (CGI use) and I'm an absolute beginner...
> Can anyone (please no editor, no author) tell me the title of a very
> good, complete and clear book about Perl?
> (If needed, my workstation: PC, W95)
>
> Thank you for answers!!
>
> Christophe
> Marseille, France
IMHO, you don't _really_ want "an 'ultimate and definitive' Perl
reference book" if you're just beginning, but womething to teach you the
language. Others will point you to "Learning Perl" by Schwartz, but I
would like to direct you to "Learning Perl on Win32 Systems" by
Schwartz, Olsen, and Christiansen, which is directed straight to WinNT
and Win95 systems and just came out in August (both books are published
by O'Reilly & Assoc). I'm going through it now, and it is VERY good.
There are more advanced books out there (e.g., "Programming Perl"), but
they are not for beginners. BTW, LP is often called "the llama book"
around here and LPWS "the gecko book" because of the animal drawings on
their covers.
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: Tue, 14 Oct 1997 15:16:19 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Server-Push and MS IE
Message-Id: <34437EB3.DF3@hotlava.com>
Jeremy D. Zawodny wrote:
>
> [cc'd automagically to original author]
>
> On 10 Oct 1997 23:14:43 GMT, "Matthias Hellmund"
> <matthias.hellmund@nienburg-weser.de> wrote:
>
> >I'd like to have some chat-lines as a datastream via Server-Push. I know,
> >that there is no new-page-clear with MS IE, but why are lines not printed
> >out line by line with pauses like with Netscape?!?
>
> Netscape is a company, Navigator is their flagship product. You
> wouldn't say "Microsoft" when you meant "Excel", would you?
He might, if he had just typed 'microsoft' in order to run it. And so
would I.
So, perhaps you should be asking "Why the hell do Netscape name their
executables after the company?"
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 14 Oct 1997 10:23:52 GMT
From: s.oosthoek@student.utwente.nl (Simon Oosthoek)
Subject: split(/$dirsep/) problem ($dirsep = "\\")
Message-Id: <61vh7o$qc9$1@pandora.cs.utwente.nl>
Hi,
I seem to be stuck with a splitting problem:
$dirsep = "\\";
$path = "C:\foo\bar\blip";
@path = split (/$dirsep/, $path);
when I run this:
/\/: trailing \ in regexp at test.pl line 3.
Context: I'm working on a script to process lists of files with a path
structure and I intend it to work on different OS's (mainly MSWin32 and
linux).
A solution to this might be to convert the \\ to some other character,
but I've got a feeling that this is a more interesting problem. There
should be a way to split on a variable, regardless if it contains an
escape character, right?
any suggestions welcome,
Simon.
PS, please CC by e-mail (but don't forget to post as well ;-)
------------------------------
Date: Tue, 14 Oct 1997 07:25:13 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: split(/$dirsep/) problem ($dirsep = "\\")
Message-Id: <9bov16.ap.ln@localhost>
Simon Oosthoek (s.oosthoek@student.utwente.nl) wrote:
: I seem to be stuck with a splitting problem:
: $dirsep = "\\";
print "$dirsep\n"; this prints a single backslash
: $path = "C:\foo\bar\blip";
^^
That is interpreted as a form feed character. You probably don't
have a form feed character in your filename...
: @path = split (/$dirsep/, $path);
: when I run this:
: /\/: trailing \ in regexp at test.pl line 3.
Backslashes are the escape char in patterns too. You need to escape
the escape if you want to match a literal one:
$dirsep = '\\\\'; # $dirsep gets two backslashes
$path = 'C:\foo\bar\blip'; # no interpolation please (single quotes)
foreach ( split (/$dirsep/, $path))
{print "$_\n"}
: PS, please CC by e-mail (but don't forget to post as well ;-)
Don't forget to check the newsgroup where you asked the question ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Oct 1997 14:05:49 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: split(/$dirsep/) problem ($dirsep = "\\")
Message-Id: <toutatis-ya023180001410971605490001@news.euro.net>
In article <61vh7o$qc9$1@pandora.cs.utwente.nl>,
s.oosthoek@student.utwente.nl (Simon Oosthoek) wrote:
> I seem to be stuck with a splitting problem:
>
> $dirsep = "\\";
> $path = "C:\foo\bar\blip";
> @path = split (/$dirsep/, $path);
>
> when I run this:
> /\/: trailing \ in regexp at test.pl line 3.
If you examine the error message, you should see the problem:
Split wants '\\' as delimiter, so $delimiter must be "\\\\".
Also you must put your path in single quotes (or escape all '\'s).
--
Toutatis
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1174
**************************************