[15521] in Perl-Users-Digest
Perl-Users Digest, Issue: 2931 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 3 09:05:46 2000
Date: Wed, 3 May 2000 06:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957359112-v9-i2931@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 3 May 2000 Volume: 9 Number: 2931
Today's topics:
*** To retrieve remote files regularly? (remove this part)
Re: *** To retrieve remote files regularly? <andy@i-a.co.uk>
Re: [IMPORTANT] Content-type to download an image! <gellyfish@gellyfish.com>
Re: Authentication scripts etc <gellyfish@gellyfish.com>
Re: Basic Exporter question <gellyfish@gellyfish.com>
Re: bourne 'dot' or csh 'source behavior <gellyfish@gellyfish.com>
Re: CGI: uploading binary files with IIS <gellyfish@gellyfish.com>
Re: convert to tab delimited file. <gellyfish@gellyfish.com>
Re: displaying Images <bough_005NOboSPAM@hotmail.com.invalid>
Re: displaying Images (Eric Bohlman)
ERRATA/CORRIGE: if file already exists then remove... <blah@nospam.com>
Re: Figured it out. <rhomberg@ife.ee.ethz.ch>
free web-based email program <alex@hart.net>
Re: How do I count chars??? <tvancura@tresor.ethz.ch>
if file already exists then remove... <kmojar@bmjgroup.com>
Re: if file already exists then remove... <blah@nospam.com>
Keys of Hash <samay1NOsaSPAM@hotmail.com.invalid>
Re: looking for Parse::Yapp simple example (Bart Lateur)
OO docs / tutorial <rhardicr@ford.com>
Re: OO docs / tutorial (Bart Lateur)
Re: OO docs / tutorial (Randal L. Schwartz)
Re: OO docs / tutorial (Bart Lateur)
Re: Perl CGI Script Crashes on Win2K but not at Command <KidRockYou@yahoo.com>
Re: Perl CGI Script Crashes on Win2K but not at Command <kent@darwin.eeb.uconn.edu>
perl intepreter <pl9a@cs.virginia.edu>
Perl with WebSite 1.1 <mc@backwoods.org>
Re: Permission denied on a read write file under Win98 <vulcan_c2@hotmail.com>
Re: Puzzled - Please help. <gellyfish@gellyfish.com>
Reading and Writing to a file <carter@computer.org>
reg.expr. for correct parentheses? <eedjoes@eed.ericsson.se>
Re: Regular Expression and HTML tags (Bart Lateur)
Re: searching file and performance <billy@arnis-bsl.com>
Re: setting an array in a Struct? <gellyfish@gellyfish.com>
tricking the reg-ex syntax <djberg96@hotmail.com>
tricking the reg-ex syntax <djberg96@hotmail.com>
Re: tricking the reg-ex syntax <rhomberg@ife.ee.ethz.ch>
tricking the regex syntax <djberg96@hotmail.com>
Undocumented size limitations to MLDBM? <durrett@xilinx.com>
Re: Where can I download HotKey.pm module ? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 03 May 2000 20:18:33 +0800
From: I'm a good man <"goodman888"@hongkong.com(remove this part)>
Subject: *** To retrieve remote files regularly?
Message-Id: <8ep5ga$h5n$1@news.ctimail.com>
I need to retrieve some text and image files from a remote site on a
regular interval through FTP (non-anonymous login).
Can I do that with ASP, Perl or PHP? (I prefer PHP)
If yes, how?
If not, what solutions should I take?
Thanks a lot!
--
Regards,
Fung "http://i.am/goodman888/"
------------------------------
Date: Wed, 03 May 2000 13:37:34 +0100
From: Andy Jeffries <andy@i-a.co.uk>
Subject: Re: *** To retrieve remote files regularly?
Message-Id: <39101D8E.97BB003A@i-a.co.uk>
I'm a good man wrote:
> I need to retrieve some text and image files from a remote site on a
> regular interval through FTP (non-anonymous login).
>
> Can I do that with ASP, Perl or PHP? (I prefer PHP)
It feels really strange answering a PHP question on a Perl newsgroup,
but using PHP is easy, something like the following should do it:
$myfile =
fopen("ftp://username:password@mysite.com/images/downloadme.gif", "rb");
if (!$myfile) {
print("cannot retrieve file");
}
else {
$myoutputfile = fopen("myfile_output.gif", "wb");
while (!feof($myfile)) {
$myline=fgetss($myfile, 255);
fprint($myoutputfile, $myfile);
}
fclose($myfile);
fclose($myoutputfile);
}
Hope this gives you a starting point. I would be interested in seeing
the equivalent code in Perl (as I am using Perl more and more, but
haven't had the need for this yet).
--
Andy Jeffries
Head of Web Development
Internet Assist Ltd.
Web : www.i-a.co.uk
------------------------------
Date: 3 May 2000 07:47:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: [IMPORTANT] Content-type to download an image!
Message-Id: <8eoi2l$dd2$1@orpheus.gellyfish.com>
On Tue, 2 May 2000 19:52:31 +0200 Charles Henry wrote:
>> But I can then define any handling behaviour that I want
>> for an 'application/download' in my browser/client
>> software. You cannot know from the server what I am going
>> to do in the browser/client with your stream type.
>
> That's what the line :
>
> print "Content-Disposition: attachment; filename=logo.gif\n\n";
>
> Was made for !!!
>
> Like I said you should do some CGI !!!
>
Maybe you ought to read the specifications more. There is no mention
of a 'Content-Disposition:' header in either the CGI specification or in
RFC1945 that described HTTP/1.0 so I would suggest that you cannot rely
on any such support in a significant proportion of Browers. I would also
be profoundly surprised if any later standard mandated some behaviour
that MUST occur in the presence of such a header.
/J\
--
I'm with you, Marge. Lisa! Get in here. In this house, we obey the laws
of thermodynamics!
--
fortune oscar homer
------------------------------
Date: 2 May 2000 22:07:42 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Authentication scripts etc
Message-Id: <8eng2u$b1h$1@orpheus.gellyfish.com>
On Mon, 1 May 2000 19:45:47 +0100 Damon Goodyear wrote:
>
> PS Just seen a posting from Randal Schwartz (not _the_ Randal Schwartz?
> Gor... me mates will be well impressed. :-))
>
Nah. It was probably just one of those Randal impersonators - we get
loads of them at this time of year after they finish the winter season
in Vegas. They're quite harmless and some of them are even getting quite
good at Perl ;-}
/J\
--
Read your town charter, boy. If food stuff should touch the ground,
said food stuff shall be turned over to the village idiot.? Since I
don't see him around, start shovelling!
--
fortune oscar homer
------------------------------
Date: 3 May 2000 08:06:55 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Basic Exporter question
Message-Id: <8eoj6f$gvf$1@orpheus.gellyfish.com>
On 2 May 2000 13:05:40 GMT Stuart Kendrick wrote:
>
> Two queries:
> (a) Is there a way for me to avoid maintaining *two* lists of
> thirty-some variables? I would like to define this list once. (I
> expect this list to be dynamic during development, and I can see room
> for my usual fat fingers to unsync the "use vars" list and the "use
> base" list.
Look at %EXPORT_TAGS as described in the Exporter documentaion. You
might also run something like :
h2xs -X -n Foo
and then look in the file Foo/Foo.pm to see how *it* does it.
> (b) My test program "test" doesn't know about any of my thirty-some
> variables, despite the "use Foo;" statement at the front. I tried
> using your line of "use base qw( Exporter);" in place of my "use base
> qw ($a $b $c ....);", but it didn't help the situation ... and I
> confess that I don't understand the construct you are employing,
> placing a Module name as an argument to the "use base" pragma.
>
If you have got then in %EXPORT_TAGS like :
...
our %EXPORT_TAGS = ( 'everything' => [ qw($a $b $c ) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'everything'} } );
our @EXPORT = qw();
In your module then in your program you will have something like :
use Foo qw(:everything);
Will cause those variables to imported.
/J\
--
You know Moe, my mom once said something that really stuck with me. She
said, `Homer, you're a big disappointment', and God bless her soul,
she was really onto something.
--
fortune oscar homer
------------------------------
Date: Wed, 03 May 2000 09:13:13 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: bourne 'dot' or csh 'source behavior
Message-Id: <J4SP4.3597$fT4.245413@news.dircon.co.uk>
On Tue, 02 May 2000 17:11:10 -0500, Andrew N. McGuire Wrote:
> Tom Phoenix wrote:
>>
>> On 2 May 2000 shutchis@sherritt-NO_SPAM_PLEASEintl.com wrote:
>>
>> > I have some scripts to run non-interactively (cron) and need to
>> > establish a specific environment. Under sh|ksh I would '. <file>'; in
>> > csh 'source <file>'. How to get the same behaviour within perl?
>> >
>> > Unfortunately, the <file> in question is vendor supplied, ruling out a
>> > perl re-write.
>
> [ snip ]
>
>> One way would be to make a shell script which sources that file, then
>> prints the current working directory, the values of all environment
>> variables, and any other pertinent settings. Run that from perl via
>> backticks and parse its output.
>
> Actually, oddly enough I had to do this today as well.
> Here is what I came up with, hopefully it will be satisfactory.
> This may not be the best way to do it, but it worked for me,
> so any improvements/critisisms are welcome.
>
> #!/usr/bin/perl -w
>
> use strict;
>
> my $config = "/path/to/some/config/file";
> %ENV = ();
> my @shenv = `sh -c ". $config; /usr/bin/env"`;
> chomp @shenv;
> %ENV = map { split /=/ } @shenv;
>
> print map { "$_ => $ENV{$_}\n" } keys %ENV;
>
Maybe this ought to be in the FAQ. I'd pod it and submit it Andrew.
/J\
------------------------------
Date: 2 May 2000 21:59:24 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI: uploading binary files with IIS
Message-Id: <8enfjc$9fn$1@orpheus.gellyfish.com>
On 2 May 2000 16:27:32 GMT mmarini@intesi-lab.com wrote:
> In a previous article, Jonathan Stowe <gellyfish@gellyfish.com> writes:
> ---------
> open(OUTFILE,">$basedir/$fileName")||die "Cant open $basedir/$fileName -
> $!\n";
> binmode OUTFILE;
> while (my $bytesread = read($file, my $buffer, 1024))
> {
> print OUTFILE $buffer;
> }
> close (OUTFILE);
> ---------
> Thanks for your reply but I'm sorry, I tried to put 'binmode' as you wrote
> but... no changes.
> What am I doing wrong?
>
Er. You probably want :
binmode $file;
before the while loop.
/J\
--
Ah, TV respects me. It laughs with me, not at me!
--
fortune oscar homer
------------------------------
Date: 2 May 2000 21:34:50 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: convert to tab delimited file.
Message-Id: <8ene5a$4u1$1@orpheus.gellyfish.com>
In comp.lang.perl.misc Gary Artim <gary@dkstat.com> wrote:
> Makarand Kulkarni wrote:
>
>> > I'm writing some html/cgi/perl code and wonder if anyone has found a
>> > filter program that converts native EXCEL files to tab delimited text
>> > files. Any info would be greatly appreciated. I do know that EXCEL
>> > provides this save option, I'm just looking for a software tool to do
>> > this.
>> >
>>
>> use OLE.pm for perl ( win32).
>> Write your own programs to open the worksheets you need
>> and dump the data as you want it.
>
> Thanks, but, is there a equivalent for doing this in a UNIX environment
> (converting excel to tabDelimited Text).
>
You might find that the module OLE::Storage will help with this. An
alternative might be to use dbiproxy and DBD::ODBC on some Windows machine
and DBD::Proxy on your Unix machine. Of course if you get *really*
desparate you could use 'strings' on the file ;-}
/J\
--
Oh, Lisa, you and your stories: Bart's a vampire, beer kills brain
cells. Now let's go back to that... building... thingie... where our
beds and TV... is.
--
fortune oscar homer
------------------------------
Date: Wed, 03 May 2000 03:26:00 -0700
From: Ian Rogers <bough_005NOboSPAM@hotmail.com.invalid>
Subject: Re: displaying Images
Message-Id: <03632552.dd274743@usw-ex0110-076.remarq.com>
I have placed my gif files in the cgi-bin directory where my
scripts are placed
do you think it has anything to do with the header?
Thanks Ian
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: 3 May 2000 10:47:47 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: displaying Images
Message-Id: <8ep04j$ds5$1@slb1.atl.mindspring.net>
Ian Rogers (bough_005NOboSPAM@hotmail.com.invalid) wrote:
: I have placed my gif files in the cgi-bin directory where my
: scripts are placed
:
: do you think it has anything to do with the header?
Nope. Your HTTP server is configured to treat any URL pointing into your
cgi-bin directory as a request to execute a program rather than to
deliver a file. Since your gif files can't be executed, the server
returns an error response for those requests.
This discussion really belongs in comp.infosystems.www.authoring.cgi.
------------------------------
Date: Wed, 03 May 2000 13:46:41 +0200
From: Marco Natoni <blah@nospam.com>
Subject: ERRATA/CORRIGE: if file already exists then remove...
Message-Id: <391011A1.E0618E09@nospam.com>
> <errata>
> if (-e $filename) unlink $filename;
> </errata>
<corrige>
if (-e $filename) { unlink $filename }
</corrige>
------------------------------
Date: Wed, 03 May 2000 09:44:15 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Figured it out.
Message-Id: <390FD8CF.B0912A16@ife.ee.ethz.ch>
Dan Burch wrote:
>
> This worked
>
> foreach $data_line (@data_line)
> {
> @nbr = split (/,/, $data_line);
> $data_line = join ("", @nbr);
> }
> god I love perl.
Reading all the posts, I find that I have to add a Perl way to remove
all the commas in @data_line:
tr/,//d for @data_line;
(or for 5.004 or older)
for (@data_line) {tr/,//d;}
See the tr operator. For uses $_ as default, and so does tr. Why use an
additional scalar?
- Alex
------------------------------
Date: Wed, 03 May 2000 12:51:56 GMT
From: Alex Hart <alex@hart.net>
Subject: free web-based email program
Message-Id: <3910236F.81322D2C@hart.net>
I don't know how many of these are out there, but I put together my
own web based email program, and it's pretty good. All in perl. This
is my first real perl project, so there are many places it could be sped
up with a little work.
I put in a ton on features like search, address book, folders, an upload
area, etc.
You need your own server to put it on, as well as a POP and SMTP
server. It's very easy to set up.
If anyone is interested in this, you can download it from
http://althepal.com
The README file or the install file explain how to set it up.
Please let me know if you decide to use it. Email me if you have any
questions at alex@hart.net
It is still being worked on, but I use it for all of my email. It works
pretty well and I know of no major bugs.
have fun
- Alex
------------------------------
Date: 3 May 2000 10:32:27 +0100
From: Tobias Vancura <tvancura@tresor.ethz.ch>
Subject: Re: How do I count chars???
Message-Id: <390fe41b@pfaff.ethz.ch>
Well, thank you very much for all the replies. This is
really a very helpfull community.
Here is what I finally distilled from your comments:
-----------
#!/usr/bin/perl -w
use strict;
my $ll = 140; # line length
my $sub;
my @broken;
while (<>) {
$sub = substr($_, 0, $ll);
push(@broken, $sub);
$ll = $ll - length($sub);
last if($ll==0);
}
print (@broken);
--------------------
Thanks again and here is my original post:
Tobias Vancura <tvancura@tresor.ethz.ch> wrote:
: Hello everybody,
: I just started programming Perl (or was it perl) and I
: cannot find a way to split an string into several strings of
: lenght <=160 chars. It were best if word boundaries were
: taken into account as possible break points.
: As you can guess from the 160 chars, I want to sent
: sms-messages from a perl script.
: I am just through "Learning Perl" and could not find
: anything appropriate.
: Thank you very much in advance, yours,
: Tobias
------------------------------
Date: Wed, 03 May 2000 12:38:00 +0100
From: Kourosh A Mojar <kmojar@bmjgroup.com>
Subject: if file already exists then remove...
Message-Id: <39100F98.BDA249D2@bmjgroup.com>
Dear all,
Im inexperienced programmer so please forgive me. I simply want to
remove a file if it already exists. i.e. if test.txt already exists in
folder then remove. Here is what I have done so far
$output = "test\.txt";
if ($output exists) {
# unlink($output) || die "could not delete $output";
}
Any help will be appreciated. Thanking you in advance and for your kind
attention,
Kourosh A Mojar
kmojar@bmjgroup.com
------------------------------
Date: Wed, 03 May 2000 13:43:10 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: if file already exists then remove...
Message-Id: <391010CE.6E5AF8FD@nospam.com>
Hi Kourosh,
Kourosh A Mojar wrote:
> Im inexperienced programmer so please forgive me. I simply want
> to remove a file if it already exists. i.e. if test.txt already
> exists in folder then remove.
<code>
if (-e $filename) unlink $filename;
</code>
Try
$ perldoc -f -e; perldoc -f unlink
(or|and) read the FAQ for more details.
Best regards,
Marco
------------------------------
Date: Wed, 03 May 2000 05:52:56 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Keys of Hash
Message-Id: <0011d2f4.497cd299@usw-ex0104-031.remarq.com>
Hi, I have
$X{a}{b} = 'c';
$X{a}{d} = 'e';
$X{p}{b} = 'd';
$X{p}{r} = 'x';
etc..
I want to get the keys for this Hash in pair
In other words
I need to have the pair
a b
a d
p b
p r
How I can get it??
Or How I should forumulate orginal structure to get the keys..
Thanks
Samay
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 03 May 2000 11:53:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: looking for Parse::Yapp simple example
Message-Id: <391712f3.9235968@news.skynet.be>
Tim Richardson wrote:
>The grammar
>is simple, but I've never used Bison or Yapp. Writing the grammar
>doesn't look too hard, but I don't understand how I put everything
>together. For instance, what does a lexer look like?
Maybe start by doing the Bison tutorial. You need a C compiler (like
GCC) and a Bison package for it. The tutorial itself can be found at
<http://www.ma.adfa.oz.au/Local/Info/bison/bison_toc.html>. My favourite
Lex/Yacc web page is at <http://www.uman.com/lexyacc.shtml>.
Going to Yapp from there shouldn't be such a big leap then (he says NOT
talking from experience).
Re. Lex: that is a program that generates code, that does nothing but
trying out alternative, anchored (at the start) regexes, and returns
mainly the next succesful match. So you don't really need it in Perl: a
relatively simple routine in pure Perl will usually be enough to solve
your Perl-Lex problems.
--
Bart.
------------------------------
Date: Wed, 03 May 2000 10:31:54 +0100
From: Richard H <rhardicr@ford.com>
Subject: OO docs / tutorial
Message-Id: <390FF20A.2E64E761@ford.com>
Hi,
a while ago (couple of months) an additional pod style Perl OO tutorial
came out, in addition to the standard perltoot, obj and bot, I though it
was authored by Randal Schwartz but couldnt find it on stonehenge or
perl.com, anybody know which doc I'm on about and where I can find it,
thanks,
Richard H
------------------------------
Date: Wed, 03 May 2000 10:25:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: OO docs / tutorial
Message-Id: <3911fd9e.3775214@news.skynet.be>
Richard H wrote:
>a while ago (couple of months) an additional pod style Perl OO tutorial
>came out, in addition to the standard perltoot, obj and bot, I though it
>was authored by Randal Schwartz but couldnt find it on stonehenge or
>perl.com, anybody know which doc I'm on about and where I can find it,
>thanks,
AFAIK it's included with the new Perl distribution (5.6). The name is
"perlboot".
I think you can get the docs from CPAN as well.
Er... so why isn't it there? Is this directory of CPAN outdated?
<http://www.cpan.org/doc/manual/html/pod/index.html>
--
Bart.
------------------------------
Date: 03 May 2000 03:35:55 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: OO docs / tutorial
Message-Id: <m1hfcf9b04.fsf@halfdome.holdit.com>
>>>>> "Richard" == Richard H <rhardicr@ford.com> writes:
Richard> a while ago (couple of months) an additional pod style Perl
Richard> OO tutorial came out, in addition to the standard perltoot,
Richard> obj and bot, I though it was authored by Randal Schwartz but
Richard> couldnt find it on stonehenge or perl.com, anybody know which
Richard> doc I'm on about and where I can find it, thanks,
It's in the 5.6 distribution, and if you search via deja.com on
"perlboot", you'll see lots of discussion of it here.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 03 May 2000 10:38:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: OO docs / tutorial
Message-Id: <391300cc.4588654@news.skynet.be>
Bart Lateur wrote:
>The name is "perlboot".
>
>I think you can get the docs from CPAN as well.
>
>Er... so why isn't it there? Is this directory of CPAN outdated?
>
><http://www.cpan.org/doc/manual/html/pod/index.html>
Found it! I did a succesful search on CPAN:
<http://search.cpan.org/doc/GSAR/perl-5.6.0/pod/perlboot.pod>
Somebody prod that overview page, it IS outdated.
So I cc'ed <cpan@perl.org>.
--
Bart.
------------------------------
Date: Wed, 03 May 2000 09:25:28 GMT
From: "John" <KidRockYou@yahoo.com>
Subject: Re: Perl CGI Script Crashes on Win2K but not at Command
Message-Id: <cgSP4.22545$g4.578793@newsread2.prod.itd.earthlink.net>
Thanks for this help Sam. From what you've said and what I learned is that
is the IUSR_ is not a local user, thefore it has no right to the machine.
The problem that I now encounter, is when I give the IUSR_ right's to the
databases, it still doesn't seem to matter.
If I change the the Web Site user I can acomplish this, however, I can only
do so by changing this to Administrator from IUSR_, something that can't be
a good idea.
I'm sure there is a better way to do this, as it would seem that every
anonymous user that comes into my machine will be an Admin.
Anymore help on this subject would be greatly appreciated as I know now that
I'm at the home stretch of my problem.
I do understand this as now not being a perl problem, but when I started
this thread it appeared to me it was, and it seems that someone out here
knows the answer where they can just hit me on the head and say, do this,
and it all starts to work right.
Thanks for everyone's help, and as soon as I learn more about this stuff, I
would love to start contributing rather then just taking.
John
------------------------------
Date: 03 May 2000 06:50:08 -0400
From: Kent Holsinger <kent@darwin.eeb.uconn.edu>
Subject: Re: Perl CGI Script Crashes on Win2K but not at Command
Message-Id: <m03dnznc0v.fsf@darwin.eeb.uconn.edu>
It would also be helpful to include a more complete description of the
problem when you start. What set me off was that your original posting
didn't even include "use CGI".
Kent
--
Kent E. Holsinger kent@darwin.eeb.uconn.edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-3043
-- Storrs, CT 06269-3043
------------------------------
Date: Wed, 03 May 2000 05:00:46 -0400
From: Rick Li <pl9a@cs.virginia.edu>
Subject: perl intepreter
Message-Id: <390FEABE.244EA21D@cs.virginia.edu>
Hi, all!
I am a graduate student and doing some work on security. I need to
record all the Perl library calls a Perl script makes. One way to do
that is to change the Perl interpreter. Whenever it finds the script
call a function in the Perl library, it writes down the name of the
function.
However I am totally lost how to start my work. I don't know much about
Perl. I can't understand the source code of Perl interpreter.
There are tons of materials about how to use Perl, but I can't find any
helpful documentation about how the Perl interpreter works.
Can anyone give me some hints? Thank you very much.
---- Rick ^_^
------------------------------
Date: Wed, 03 May 2000 08:21:05 -0400
From: MC <mc@backwoods.org>
Subject: Perl with WebSite 1.1
Message-Id: <391019B0.6C2B496A@backwoods.org>
Ok Im sure someone knows this one:
Ive been thru this before and I know its simple, but silly me I never write it
down.
What do I need to do to WebSite 1.1 (yea yea i know its antique, but it works)
to make it exectute perl scripts (in any directory)? All it seems to do is try
to send me the file as a download.
As I said ive done this before but have forgotten. I have my mime types mapped
and my directories set. Now im at a loss.
Any help appreciated.
MC
------------------------------
Date: Wed, 03 May 2000 12:42:02 GMT
From: vulcan_c2 <vulcan_c2@hotmail.com>
Subject: Re: Permission denied on a read write file under Win98
Message-Id: <8ep6qn$q89$1@nnrp1.deja.com>
In article <8eoeev$vvh$1@nnrp1.deja.com>,
pmancini@yahoo.com wrote:
> Here is where the code is, I am going to bed and hopefully some
> other night owl will have an answer or it will come to me in a
> dream...
Well looks like the sleep helped. Excel had my result file open and
locked it... "So the next time Monopolist Bill Gates suggest you use
Brand X Windows, just say no..."
Thanks!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 3 May 2000 07:08:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Puzzled - Please help.
Message-Id: <8eofo8$615$1@orpheus.gellyfish.com>
On Tue, 02 May 2000 18:45:07 GMT Bob Cunningham wrote:
> On Mon, 1 May 2000 22:13:43 -0400, tadmc@metronet.com (Tad McClellan)
> said:
>
>>On Tue, 02 May 2000 02:30:25 GMT, Bob Cunningham <sparky@alt-usage-english.org> wrote:
>
>>>I've recently installed Perl 5.6 -- I think.
>
>>Hope the docs got installed too :-)
>
> They did, but your reply has led me to learn a lot about them that I
> needed to know. I run under Windows 98, so a lot of the stuff I find
> in books is not as helpful as it might be if it weren't heavily Unix
> oriented. I had no idea that the POD directory existed, for example,
> but after reading your remarks I did a search of my Perl subdirectory
> and found it. (Other innocents may be interested to learn -- as I was
> -- that 'POD' stands for 'Plain Old Documentation'.)
>
> For online documentation I've mostly used the Perl Manual at
> <http://www.ug.cs.dal.ca/pub/pub_dir/html/perl/perl.html>, and I've
> found especially helpful the Master Index at
> <http://www.ug.cs.dal.ca/pub/pub_dir/html/perl/pl-index.html>.
>
All of the Perl documentation on your disk is available with the command
'perldoc' which gives acess to the POD both in the .pod files and
contained with any installed modules. You might want to start with :
perldoc perl
or
perldoc perltoc
and start from there.
>> cd /somewhere/pod/ # look for "pod/" subdir under @INC dirs
>
>> grep '5\.006' *.pod
>
> Your references to 'grep' as a command-line command and '@INC' are
> typical of the sort of things I find in books. I think they are
> meaningful only to UNIX people, although I know there is a Perl
> function called 'grep'. My knowledge of UNIX is near zero.
>
On a Windows/DOS system you can use the 'advanced' search feature of the
Windows 'Find' tool available from your Start Menu or you can use the
DOS command 'find'. Neither have same pattern matching capabilities as
the Unix 'grep' but might suffice. There is a version of 'grep' implemented
in Perl as part of the Perl Power Tools project (find it somewhere via
<http://www.perl.com>).
>>perldelta.pod (note the very end):
>
> But I was able to extrapolate from your remarks to the Windows
> environment and eventually found perldelta.pod.
>
>>The English module now sets $PERL_VERSION to $^V (a string value) rather
>>than C<$]> (a numeric value).
>
> So, now I understand about '5.006' being used to refer to version 5.6,
> but I have a new puzzlement: When I enter -- running under debug --
> the Perl command 'print $^V' (or 'print "$^V"'), I get a two-character
> response consisting of the symbols for 'club' and 'spade'.
>
Hey you're lucky: in the terminal window on this machine it prints out
*nothing*. This is due to the screen characters available (or not in my
case) for representing the value of $^V which is:
chr(5) . chr(6) . chr(0)
Which just happens to be those characters you describe on A DOS system.
>>(This is a potential incompatibility.
>>Send us a report via perlbug if you are affected by this.)
>
> Maybe they mean me. But I don't know what they mean by
> 'incompatibility'. What things are they saying may be incompatible?
> Windows and UNIX implementations maybe?
I believe that is referring to $PERL_VERSION which is the easily memorable
variable that you you get when you 'use English' which used to be aliased
to $] (which is the old format version number) and is now aliased to
the new one $^V. If you are not using the English module then you probably
dont need to worry about it.
>
> I'm also puzzled, though, by the fact that when I look in the Master
> Index for '$^V', I don't find it, although I do find similar
> constructs like '$^T' and '$^W'. Is the Perl Manual I find on the Web
> not up-to-date, or is there some other reason that I can't find '$^V'
> there?
>
$^V was introduced in 5.6.0 so probably the 'Master Index' hasnt been
updated. If you look at the perlvar document you will find a description
of both this variable and $].
perldoc perlvar
/J\
--
Those whom the gods love grow young.
--
fortune oscar homer
------------------------------
Date: Wed, 26 Apr 2000 14:28:04 -0700
From: "Carter Hamilton" <carter@computer.org>
Subject: Reading and Writing to a file
Message-Id: <8e7ms3$7th1@cliff.xsj.xilinx.com>
I would like to open a text file and append something to the end of certain
lines. Is there any way to do this without copying the information to a new
file? I would like to do something like this:
while (<TEXT>) {
if (/$pattern/) {
print TEXT chomp($_) . $newStuff . "\n";
}
else {
print TEXT $_;
}
}
------------------------------
Date: Wed, 03 May 2000 14:11:30 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: reg.expr. for correct parentheses?
Message-Id: <39101772.943DFB40@eed.ericsson.se>
Hi there,
I'm trying to get a list of all correctly parenthesized expressions from
a string. For example, if I have
$re = "a(b(c,d),e,f,g(h,i(j)),k,l(m,n,o))";
then I want to extract all of the following:
a(b(c,d),e,f,g(h,i(j)),k,l(m,n,o))
b(c,d)
e
f
g(h,i(j))
h
i(j)
j
k
l(m,n,o)
m
n
o
Is that possible with Perl's regular expressions?
--
Cheers
Joern Stein
-----------------------------t--h--e--r--e--i--s--n--o--s--p--o--o--n-
http://www.palmobil.de
------------------------------
Date: Wed, 03 May 2000 10:17:16 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Regular Expression and HTML tags
Message-Id: <390ff1c7.743959@news.skynet.be>
Intergalactic Denizen of Mystery wrote:
>Once again I will mention REX, a regular expression which may be
>found on the web by searching for the terms "shallow parse" and
>"XML". Maybe it is not "simple", but it's excellent for a task
>like stripping tags, and is at least an order of magnitude
>faster than HTML::Parser.
Even when compared to HTML::Parser v.3.x? The core of HTML::Parser has
now been converted into compiled C code, so it ought to run faster than
the old, plain Perl, module.
--
Bart.
------------------------------
Date: Wed, 03 May 2000 11:30:46 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: searching file and performance
Message-Id: <8ep2l6$lpe$1@nnrp1.deja.com>
In article <8eoisu$nm5$1@u30075.rsv.rsv.se>,
mats-larsson@iname.com (Mats Larsson) wrote:
> I am browsing some huge files to find a specific line. When this line is
> located I like to print a number of lines starting with the line just before
> the current one. What would be the best way of doing this?
While you are performing a simple linear search in a file you cannot
improve performance (I mean you cannot improve the complexity of algorithm,
which is O(n). But sure the same algorithm may be coded more or less optimal).
> The obvious way would be to always keep a copy of the previous line but is
> there some other solution to this?
>
IMHO you have at leat two options:
1. Use unix grep/egrep command. Check you system's grep manpage for -A and -B
flags (hope I guess right).
2. Write it yourself in Perl. IMHO you should keep a 'window' of previous
lines, shifting it while reading the file.
Here goes a dirty (but functional) example:
#!/usr/bin/perl -w
use strict;
my $filename = 'some_file';
open FH, $filename or die "cannot open $filename: $!\n";
my $pattern = '<<<put_your_search_pattern_here>>>';
my $window_size = 10;
my @window = ();
my $line = undef;
while ($line = <FH>)
{
chomp $line;
last if $line =~ /$pattern/;
push @window, $line;
shift @window if @window > $window_size;
}
# OK, we are done here, let's display results
if ($line)
{ local $, = "\n"; print @window, $line, "\n" }
else
{ print qq(Pattern "$pattern" not found in file "$filename"\n) }
# that's all
Feel free to add line numbering, to handle multiple matching line, etc...
Good luck.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 03 May 2000 08:49:33 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: setting an array in a Struct?
Message-Id: <xKRP4.3595$fT4.245413@news.dircon.co.uk>
On Wed, 03 May 2000 00:24:08 GMT, Crypto-Boy Wrote:
> In article <MPG.1377bf44e9ed866298a9c7@nntp.hpl.hp.com>,
> Larry Rosler <lr@hpl.hp.com> wrote:
>
>> I cannot find a statement
>>
>> use Class::Struct;
>>
>> in the original post, which would have made the magic manifest. Now
>> that I have read the documentation, I can see what it is about.
>
>
> Ok, Ok, I should have written "use Class::Struct;" in my post. Geeezzz.
What do you mean 'Geeezzz' - I think that was a pretty crucial piece of
information that you failed to supply. Its more by luck than design that
someone actually recognized what you were talking about.
/J\
------------------------------
Date: Tue, 2 May 2000 20:52:57 -0500
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: tricking the reg-ex syntax
Message-Id: <39101f17$0$63041@news.execpc.com>
Hi all,
I'm trying to do the following with operators:
$option = 'i';
$_ =~ /pattern/$option
But Perl doesn't like this. Is there any way to trick it?
Thanks in advance.
Dan
--
In the immortal words of Socrates, "I drank what?"
------------------------------
Date: Tue, 2 May 2000 22:54:28 -0500
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: tricking the reg-ex syntax
Message-Id: <39101f18$0$63041@news.execpc.com>
Hi all,
I'm trying to do the following with operators:
$option = 'i';
$_ =~ /pattern/$option
But Perl doesn't like this. Is there any way to trick it?
Thanks in advance.
Dan
--
In the immortal words of Socrates, "I drank what?"
------------------------------
Date: Wed, 03 May 2000 15:04:32 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: tricking the reg-ex syntax
Message-Id: <391023E0.7F676375@ife.ee.ethz.ch>
Daniel Berger wrote:
> I'm trying to do the following with operators:
>
> $option = 'i';
> $_ =~ /pattern/$option
>
> But Perl doesn't like this. Is there any way to trick it?
check (?imsx) in the perlre manpage, it can be used to embed options in
the search pattern.
- Alex
------------------------------
Date: Wed, 3 May 2000 07:58:04 -0500
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: tricking the regex syntax
Message-Id: <39102079$0$26042@news.execpc.com>
Hi all,
I would like to do the following:
$opt = 'i';
$line =~ /pattern/$opt
Perl doesn't like that (and yes, I've tried different
permutations of quotes, etc).
Is there a way to make this work? Thanks in advance.
Dan
--
In the immortal words of Socrates, "I drank what?"
------------------------------
Date: Mon, 01 May 2000 13:13:06 -0600
From: Derrell Durrett <durrett@xilinx.com>
Subject: Undocumented size limitations to MLDBM?
Message-Id: <390DD742.A82004D1@xilinx.com>
I'm using MLDBM with DB_File and Storable to dump a list of hashes to a
DB_File database file. I do this for a large number of lists (~115),
which have sizes ranging from (probably) empty to ~580Mb. The problem I
am having is that I see errors when processing the largest file(s?). As
best as I can tell, some of the data is missing from the DB_File!
I chose DB_File because I saw nothing in the documentation which
suggested I might encounter problems with the number of records (~73k)
I was expecting.
Has anyone else seen errors of this sort? Am I possibly doing something
stupid that just hasn't occurred to me? I can't find anything like this
in either searches of the Deja.com archives or in any relevant
documentation, and I wouldn't have thought that ~42M of data (the size
of the flat file that holds the same info) would blow up to 580Mb or
that it would be a problem for DB_File to handle.
Any insights, comments, or suggestions greatly appreciated...
Derrell
--
Derrell Durrett Xilinx, Inc. Software Integration
Boulder, Colorado
303.544.5498
------------------------------
Date: 2 May 2000 21:51:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where can I download HotKey.pm module ?
Message-Id: <8enf41$7vl$1@orpheus.gellyfish.com>
On Tue, 02 May 2000 16:50:57 GMT Aurelien wrote:
> Hello !
>
> I have seen in perlfaq8 that the HotKey.pm module is very interesting and
> I'd like to download it. It is present in the faq but I 'd prefer to have
> it with a makefile like other CPAN modules.
>
> Someone can give me an URL where I can download it please ? Thanks.
>
If you have perlfaq8 then you already *have* the module as it is
presented as an example in that document. The whole code of the module
is there you just have to create a file called HotKey.pm and cut and paste
it in there and copy the file to somewhere in @INC .
/J\
--
Mmmm, sacrilicious.
--
fortune oscar homer
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 2931
**************************************