[12271] in Perl-Users-Digest
Perl-Users Digest, Issue: 5870 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 3 09:21:12 1999
Date: Thu, 3 Jun 99 06:00:28 -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 Thu, 3 Jun 1999 Volume: 8 Number: 5870
Today's topics:
Re: 500 Error Help Please [My first time posting here.. <sstarre@my-deja.com>
Re: A Newbie needs HELP! <jdporter@min.net>
ANSWER: Re: uninitialized value? what am i doing wrong? <office@asc.nl>
Re: Any Perl certification program? (Chris Nandor)
Re: beginner <jdporter@min.net>
Can anyone tell me what this command is? reddogg1471@my-deja.com
Re: Can't load module DBI, dynamic loading not availabl <dirkse@my-deja.com>
Re: Can't load module DBI, dynamic loading not availabl <dirkse@my-deja.com>
Re: CGI parameter passing with GET question <gellyfish@gellyfish.com>
Concatenating variable names stupon@my-deja.com
Concatenating variable names stupon@my-deja.com
damn F@#$(*)@ unix (*%$#&!* pipes <outlaw_torn@mailexcite.com>
Re: damn F@#$(*)@ unix (*%$#&!* pipes <gellyfish@gellyfish.com>
Detect the existence of a subroutine w/o calling it <jon.connell@arm.com>
Re: Determining height and with of uploaded Graphic fil <rhrh@hotmail.com>
Re: Determining height and with of uploaded Graphic fil (Larry Rosler)
Re: empty line <sstarre@my-deja.com>
File Reading problem... <madvin@dds.nl>
Re: File Reading problem... <madvin@dds.nl>
Re: Getting around the refresh button <gellyfish@gellyfish.com>
Re: HELP: Regular Expressions <sstarre@my-deja.com>
Re: How do you print a file backwards by line? <jdporter@min.net>
Re: How do you print a file backwards by line? <varnavas@iname.com>
Multi-Inclusive Pattern Match kgentes@gentek.net
Re: need an anti-leech script <hasant@trabas.co.id>
ORACLE_HOME set var edejauser@my-deja.com
PERL FREELANCERS: WANT TO MAKE A QUICK $500? salbarcar@my-deja.com
Re: Perl script keeps terminating <gellyfish@gellyfish.com>
Re: Perl script keeps terminating (kevin)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Jun 1999 12:13:13 GMT
From: S Starre <sstarre@my-deja.com>
Subject: Re: 500 Error Help Please [My first time posting here... forgive me if this has already been asked]
Message-Id: <7j374l$i1o$1@nnrp1.deja.com>
Hi there:
You should post CGI questions to the cgi newsgroup as this really isn't
Perlish. Having said that, I've was previously directed to:
http://www.cpan.org/doc/FAQs/cgi/perl-cgi-faq.html
and I've invested many well-spent hours reading that page. You would be
well-advised to do so as well.
Cheers,
S
In article <7j2e6a$aee$1@nnrp1.deja.com>,
spartanic1123@my-deja.com wrote:
> Hello, I have an account on Hypermart, and I am pretty new to CGI. I
> have created a script and I attempt to run it and I get this message:
>
> exec of [URL of script] failed, reason: No such file or directory
> (errno = 2)
> [Tue Jun 1 22:00:42 1999] access to [URL of script] failed for [My
> IP], reason: Premature end of script headers
>
> I know the permissions are right, and I'm pretty sure that the code is
> right, but what does this "No such file or directory" mean? I can't
> figure this out. Any help would be appreciated. Thanks.
>
> Spartanic
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
--
Code not Perl Before Wine..
-S Starre 1999
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 16:28:59 GMT
From: John Porter <jdporter@min.net>
Subject: Re: A Newbie needs HELP!
Message-Id: <7j3m40$nbt$1@nnrp1.deja.com>
In article <7j3dlh$5buk$1@newssvr04-int.news.prodigy.com>,
"JJ" <pathfinder@innocent.com> wrote:
> However, I've come to realize that to accomplish certain things
> in HTML, you really have to use a script like Perl.
Um, Perl isn't a script, it's a language. But I know what you mean.
> So I fully intend to begin learning Perl
Excellent decision!
> What I want to do is to arrange all the listings on the page
alphabetically
> by (in this case) the name of the auction.
> I've
> got about 300 HTML files arranged exactly like this one (and many of
them
> much longer), so you can see why I don't want to do it manually!
Do you have all that data in a database, or some kind of data file,
other than the html files themselves? How were these html files
generated in the first place?
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 3 Jun 1999 14:28:23 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: ANSWER: Re: uninitialized value? what am i doing wrong?
Message-Id: <7j5sfp$l4k$1@zonnetje.NL.net>
yaaaaaahooooooooooooooooooooooooooooooooooooo!!!!!!!!!!
ok ok , i found the answer , and NOT in a perldoc :)
to check if a variable is defined :
print "Car exists !\n" if defined $car;
to 'undefine' a variable :
undef $car;
:)
i'm so happyyyyyyyyyyyyy i could dieeeeeeeee :)
cul8r
buZz
Bastiaan S van den Berg heeft geschreven in bericht
<7j5c2l$agl$1@zonnetje.NL.net>...
>Use of uninitialized value at verwerk.cgi line 99.
>Use of uninitialized value at verwerk.cgi line 100.
>Use of uninitialized value at verwerk.cgi line 101.
>
>
>that's all i get back from my majorly simple perl program
>
>i 'initialize' the scalars with :
>
>$prijslijst_ap=$forms{"prijslijst_ap"};
>$prijslijst_dell=$forms{"prijslijst_dell"};
>$prijslijst_hp=$forms{"prijslijst_hp"};
>$prijslijst_fp=$forms{"prijslijst_fp"};
>
>and then i use them with :
>
>if ($prijslijst_ap ne "") {print "Ik wil een prijslijst van Account
>Plus\n";}
>if ($prijslijst_dell ne "") {print "Ik wil een prijslijst van Dell\n";}
>if ($prijslijst_hp ne "") {print "Ik wil een prijslijst van Hewlett
>Packard\n";}
>if ($prijslijst_fp ne "") {print "Ik wil een prijslijst van F-Prot\n";}
>
>but then i get the errors you see at the top ..
>
>does anyone have an idea what i'm doing wrong?
>
>i'm gone.. going to get some coke :)
>
>cul8r
>buZz
>
>
------------------------------
Date: Thu, 03 Jun 1999 12:02:59 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Any Perl certification program?
Message-Id: <pudge-0306990803030001@192.168.0.77>
In article <3754A662.D7C6C91E@cs.uh.edu>, Zhang Yangbing
<ybzhang@cs.uh.edu> wrote:
# Hi, there:
#
# I know Perl two years ago and try to get a Perl certification,
# so
# I can convince my future employer that I really know something about
# Perl,
# anyone knows there is some Perl certification program? thanks.
Certification is a waste of time, money, and energy. There is only one
way to prove to your employer that you know Perl, and that is to write
Perl. Certification only clouds the issue, turning away competent people
without it and bringing in incompetent people with it.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 02 Jun 1999 14:03:55 GMT
From: John Porter <jdporter@min.net>
Subject: Re: beginner
Message-Id: <7j3dk5$k6m$1@nnrp1.deja.com>
In article <375470E5.6B01A4B9@unity.ncsu.edu>,
Emily Brock Latham <eblatham@unity.ncsu.edu> wrote:
>
> I have just been getting my feet wet with perl.
Huzzah!
> And I am writing a script that is executing the following line:
> exec 'more','avail.dat';
> and another line:
> exec ("grep $username all.dat");
> but each of these clears the screen before outputting the data. Is
> there any way to keep it from doing this?
This is not a perl problem. It is probably being caused by the shell
you run to execute those commands; there might be a command in your
.profile that clears the screen. Perhaps a better approach would be
to use Perl to do those things directly, rather than invoke external
programs to do them.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 07:09:26 GMT
From: reddogg1471@my-deja.com
Subject: Can anyone tell me what this command is?
Message-Id: <7j2lb2$cbc$1@nnrp1.deja.com>
Can anyone tell me where I can find documentation on on this:
GROK!THIS!
I've run across this in scripts before and the attached files are
always encoded somehow. I can't find documentation on this anywhere.
Thanks
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 16:20:27 GMT
From: fred dirkse <dirkse@my-deja.com>
Subject: Re: Can't load module DBI, dynamic loading not available in this perl.
Message-Id: <7j3lk1$n6m$1@nnrp1.deja.com>
On HP-UX static perl builds, I use the DBD::Oracle README.help method
For platforms which require static linking. You'll need to build
DBI & DBD statically linked and then link it into a perl binary:
make realclean (if run before, best to delete & untar)
perl Makefile.PL LINKTYPE=static
make
make perl (makes a perl binary in current dir)
make test FULLPERL=./perl (run tests using the new perl binary)
make -f Makefile.aperl inst_perl MAP_TARGET=perl (install new perl)
make install (install new module)
--
just another squirrel hacker, fred
--
just another squirrel hacker, fred
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 16:54:46 GMT
From: fred dirkse <dirkse@my-deja.com>
Subject: Re: Can't load module DBI, dynamic loading not available in this perl.
Message-Id: <7j3nkg$nvf$1@nnrp1.deja.com>
Sorry, preview looked OK
make realclean
perl Makefile.PL LINKTYPE=static
make
make perl
make test FULLPERL=./perl
make -f Makefile.aperl inst_perl MAP_TARGET=perl
make install
--
just another squirrel hacker, fred
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Jun 1999 12:40:06 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI parameter passing with GET question
Message-Id: <37566996@newsread3.dircon.co.uk>
toddyip@my-deja.com wrote:
> I am a newbie in writing Perl and now I have a problem a writing a
> simple CGI.
>
> I want to pass a string to a CGI program with GET method and then test
> the string with following lines. As I am using ActivePerl in Win95,
> there is no need to type something like #!c:/perl/bin/perl.exe
>
> ----
> print "Content-type:text/html\n\n";
>
> print $ENV{'QUERY_STRING'};
> ----
>
> When I type "http://home/cgi-bin/test_input.cgi?a=1" in the command
> line of browser, it just works fine.
>
> However, when I use
>
> ----
> print <form action=\"http://home/cgi-bin/test_input.cgi?a=1\"\"
> method=\"GET\">";
> print "<input type=\"submit\" name=\"Submit\" value=\"Confirm\">";
> print "</form>";
> ----
>
> It just give me submit="Confirm" but not a="1".
>
> Could anyone help me solve this?
>
Yes. use CGI.pm
or ask in the comp.infosystems.www.authoring.cgi
or look in the CGI FAQ:
<http://www.webthing.com/tutorials/cgifaq.html>
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 02 Jun 1999 10:15:44 GMT
From: stupon@my-deja.com
Subject: Concatenating variable names
Message-Id: <7j308b$g64$1@nnrp1.deja.com>
I was trying to get the following to work:
===================
$i = 1;
$value_{$i}=5; // This is where the problem lies
print($value_1);
===================
It prints nothing, where as I was hoping for 5.
It looks kindof pointless like this, but basically
it would be in a for loop, and would make things
much easier if it worked this way.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 10:15:44 GMT
From: stupon@my-deja.com
Subject: Concatenating variable names
Message-Id: <7j308d$g65$1@nnrp1.deja.com>
I was trying to get the following to work:
===================
$i = 1;
$value_{$i}=5; // This is where the problem lies
print($value_1);
===================
It prints nothing, where as I was hoping for 5.
It looks kindof pointless like this, but basically
it would be in a for loop, and would make things
much easier if it worked this way.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 03:32:04 GMT
From: outlaw_torn <outlaw_torn@mailexcite.com>
Subject: damn F@#$(*)@ unix (*%$#&!* pipes
Message-Id: <7j28jk$8ru$1@nnrp1.deja.com>
Hi all
I've been getting very pissed off lately about the number of broken
pipes I'm receiving when I run my perl scripts. So i was wondering if
anyone could help me. I need to find out as much as I can about broken
pipes. What would cause a program to return a broken pipe error on one
execution and then run perfectly fine the next time (with the exact same
input). It is really pissing me off. My script doesn't use any forking
or pipes, so I'm completely at a loss. If you have any solutions to my
problems or if you know of any general resources about unix / perl and
broken pipes whether they be texts, web sites or FAQs, please reply.
I'm very desperate for a solution.
Thanks heaps in advance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Jun 1999 13:32:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: damn F@#$(*)@ unix (*%$#&!* pipes
Message-Id: <375675d7@newsread3.dircon.co.uk>
In comp.lang.perl.misc outlaw_torn <outlaw_torn@mailexcite.com> wrote:
> Hi all
>
> I've been getting very pissed off lately about the number of broken
> pipes I'm receiving when I run my perl scripts. So i was wondering if
> anyone could help me. I need to find out as much as I can about broken
> pipes. What would cause a program to return a broken pipe error on one
> execution and then run perfectly fine the next time (with the exact same
> input). It is really pissing me off. My script doesn't use any forking
> or pipes, so I'm completely at a loss. If you have any solutions to my
> problems or if you know of any general resources about unix / perl and
> broken pipes whether they be texts, web sites or FAQs, please reply.
> I'm very desperate for a solution.
>
It might have been helpful if you posted the smallest script you can
that still exhibits the behaviour.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Thu, 03 Jun 1999 11:35:18 +0100
From: Jon Connell <jon.connell@arm.com>
Subject: Detect the existence of a subroutine w/o calling it
Message-Id: <37565A66.96FAFF5@arm.com>
Is there any way of finding out whether a subroutine exists before
actually calling the subroutine?
Why? Consider the sequence of operations ...
1) Read a user-defined some-perl-code.pl which should include a
subroutine.
2) Do some time-consuming stuff.
3) Call the user subroutine (which does done destructive work).
It would be good to bail out at 1) when performing sanity checks
on the user-defined code.
Jon.
--
Mosher's Law of Software Engineering:
Don't worry if it doesn't work right. If everything did,
you'd be out of a job.
________________________________________________________________
Jon Connell Senior Software Engineer
EDA Business Unit
Email Jon.Connell@arm.com ARM Ltd
Direct Office: +33 1223 400540 90 Fulbourn Rd
Office Switch: +44 1223 400400 Cambridge
Office Fax : +44 1223 400410 CB1 9JN, UK
ARM EDA support - http://www.arm.com/DevSupp/EDA/
________________________________________________________________
------------------------------
Date: Thu, 03 Jun 1999 12:38:04 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Determining height and with of uploaded Graphic files
Message-Id: <3756691C.D45BF1E1@hotmail.com>
mraffin@cisclub.acad.emich.edu wrote:
>
> I need to determine the height and width of graphic files that users
> upload (via browser) to my site. Is this possible?
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Yes, look at the Image::Size module from CPAN,
Richard H
------------------------------
Date: Thu, 3 Jun 1999 05:46:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Determining height and with of uploaded Graphic files
Message-Id: <MPG.11c018f8b6f758e8989b5a@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7j0tnc$7ko$1@nnrp1.deja.com> on Tue, 01 Jun 1999 15:20:16
GMT, mraffin@cisclub.acad.emich.edu <mraffin@cisclub.acad.emich.edu>
says...
> I need to determine the height and width of graphic files that users
> upload (via browser) to my site. Is this possible?
Use the CPAN module Image::Size.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 02 Jun 1999 12:00:01 GMT
From: S Starre <sstarre@my-deja.com>
Subject: Re: empty line
Message-Id: <7j36bv$hq1$1@nnrp1.deja.com>
An MT line could be detected by many regexes (an infinite number to be
precise). Choose one that gives you the appropriate amount of detection?
/^$/
/^\s*$/
Buena Suerte,
S
In article <928313571.25592.0.nnrp-06.c2de1237@news.demon.co.uk>,
"Tony Kenny" <tony@emailcyberscape.net> wrote:
> HELO
>
> I wouls probably use "\n" as you rightly guessed. You may want to
consider
> wether there will ALWAYS be that empty line. Could you use something
else
> to distinguish the questions? Maybe Q1: Q2: ?
>
> If the format of this file WILL always have the blank line then I
would
> maybe read the whole file in and split it into an array thus:
>
> #read whole file into a single variable
>
> (@questions) = split /\n\n/,$filecontents;
>
> Then you should have all your questions in individual elements of the
array.
>
> I've not tested this, hope it works for you,
>
> Tony
>
>
--
Code not Perl Before Wine..
-S Starre 1999
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Jun 1999 11:21:25 GMT
From: Vincent Ridderikhoff <madvin@dds.nl>
Subject: File Reading problem...
Message-Id: <37566535.4B37332@dds.nl>
Hi,
I need to read a line from a file, from that line I need to put
everything that is before the ; in a variable $USER and everything after
the ; in the variable $MAIL.
Sins I'm new at Perl, I know how to read a line from a file and how to
chop a variable, but know I want to divide it. I know I could just say
to put the whole line in the two variables and than chop the $USER at
the ; and use a repeat statement or so to delete the first characters of
the $MAIL, but I want to know if there is a cleaner way?
Thanks in advance,
Vincent Ridderikhoff.
------------------------------
Date: 3 Jun 1999 12:11:10 GMT
From: Vincent Ridderikhoff <madvin@dds.nl>
Subject: Re: File Reading problem...
Message-Id: <375670DA.5E16A71B@dds.nl>
After searching trough some sources and trying a bit I found the solution,
thanks anyway...
Greetz Vincent...
Vincent Ridderikhoff schreef:
> Hi,
>
> I need to read a line from a file, from that line I need to put
> everything that is before the ; in a variable $USER and everything after
> the ; in the variable $MAIL.
> Sins I'm new at Perl, I know how to read a line from a file and how to
> chop a variable, but know I want to divide it. I know I could just say
> to put the whole line in the two variables and than chop the $USER at
> the ; and use a repeat statement or so to delete the first characters of
> the $MAIL, but I want to know if there is a cleaner way?
>
> Thanks in advance,
>
> Vincent Ridderikhoff.
------------------------------
Date: 3 Jun 1999 12:49:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Getting around the refresh button
Message-Id: <37566bd1@newsread3.dircon.co.uk>
motyk@my-deja.com wrote:
>
> Is there a way to redirect the user to the UPDATED html document
> without having to tell the user to reload the page? i.e., is there a
> way to tell a browser "don't read this doc from cache but read it from
> the server again"?
>
If this is possible then you should be asking in a group that is interested
in browsers and HTML documents.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Wed, 02 Jun 1999 12:24:21 GMT
From: S Starre <sstarre@my-deja.com>
Subject: Re: HELP: Regular Expressions
Message-Id: <7j37pf$i7l$1@nnrp1.deja.com>
Hi there..
To force the regex to consider the entire line, use ^,$, such as
/^[a-zA-Z][\w-.]+$/
Also where is the '_' in the regex?
-S
In article <7j1sg9$530$1@nnrp1.deja.com>,
dgmdan <dgmdan@md-sites.com> wrote:
> I'm trying to create a script that takes $newnick and checks to see if
> it meets the requirements:
> a. the first character can be *only* a letter
> b. other than the first character, it can contain letters, numbers,
> dashes, periods, and underscores
>
> If $newnick doesn't meet the requirements, I want the script to run
the
> sub "error". This is what I have:
>
> if ($newnick !~ /[a-zA-Z][\w-.]+/) { &error; }
>
> However, it appears as though when $newnick has a letter next to any
of
> the other characters, it doesn't run newnick. For example, if
$newnick
> is "a1!" it would see "a1" and it would not run the sub, even though
the
> "!" is there.
>
> How do I make it require that the entire string meet the requirements,
> not just any segment of it?
>
> - dgmdan | www.md-sites.com
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
--
Code not Perl Before Wine..
-S Starre 1999
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 13:46:58 GMT
From: John Porter <jdporter@min.net>
Subject: Re: How do you print a file backwards by line?
Message-Id: <7j3ckf$jr3$1@nnrp1.deja.com>
In article <MPG.11be5dc0540f5f30989b53@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
>
> In article <3754A229.24C1FD81@incaic.engr.sgi.com> on Tue, 01 Jun 1999
> 20:16:57 -0700, Edwin Salgado <inca@incaic.engr.sgi.com> says...
> > Is it possible to print a file backwards line by line?
>
> Yes.
> One way is to read the entire file into memory (assuming it fits), and
> reverse it:
>
> print FILEB reverse <FILEA>;
Or even better (;-) --
sub tac {
local $_;
while(<>){
(\&{(caller 0)[3]})->();
print;
}
}
tac();
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 14:11:33 GMT
From: Frank Varnavas <varnavas@iname.com>
To: inca@incaic.engr.sgi.com
Subject: Re: How do you print a file backwards by line?
Message-Id: <7j3e2d$kd0$1@nnrp1.deja.com>
In article <3754A229.24C1FD81@incaic.engr.sgi.com>,
Edwin Salgado <inca@incaic.engr.sgi.com> wrote:
> Hello,
>
> Is it possible to print a file backwards line by line?
>
This works for me.
Good Luck
Frank V.
#!/ubs/mach/bin/perl5.004
#
# $Id: backwards.pl,v 1.2 1998/09/25 19:08:36 varnavas Exp $
# $Source: /u/ubs/misc-tools/RCS/backwards.pl,v $
#
# Author: Frank Varnavas
#
require 'getopts.pl';
$opt_s = 8 * 1024;
$usage = "
USAGE: backwards [-h] [-s MaxSize] filename
-s MaxSize : maximum record size allowed. Default $opt_s
filename : file to process
backwards will display the specified file in reverse order. Internally
it will use different methods depending on if the file is <= 1 megs.
";
&Getopts( 'hs:' ) || $opt_h || die "use -h for help.\n";
( $opt_h || (@ARGV< 1)) && die $usage;
my($filename) = shift;
my($handle) = time;
open($handle, $filename ) || die "Can't open ", $filename, ". $!\n";
if (-s $filename < 1000000 ){
print reverse <$handle>;
exit;
}
my($nextpos) = -1;
my($nextbytes) = -1;
my($lastbytes) = 0;
my($maxrecsize) = $opt_s;
my($partbuf) = '';
my(@records) = ();
while(1){
unless( @records ){
my($buf);
# first time. Position to end of file
if( $nextbytes == -1 ){
seek($handle, 0, 2) || die "seek to end failed. $!\n";
$nextpos = tell($handle);
}
# determine how many bytes we can read to last read point
$nextbytes = $nextpos <= $maxrecsize ? $nextpos : $maxrecsize;
# already finished
exit(0) if ( $nextbytes == 0 );
# seek back to start of this block
seek($handle, -($nextbytes + $lastbytes), 1) || die "seek failure.
$!\n";
# record start of this read point
$nextpos = tell($handle);
# read next block
sysread( $handle, $buf, $nextbytes ) ||
die "sysread failure for offset ", $nextpos,
" reading ", $nextbytes, " bytes. $!\n";
$lastbytes = $nextbytes;
$buf .= $partbuf;
$partbuf = '';
@records = split($/, $buf);
# unless if at start of file, pop the first record
$partbuf = shift(@records) if( $nextpos );
}
print pop( @records ), "\n";
}
--
frank v.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 15:47:20 GMT
From: kgentes@gentek.net
Subject: Multi-Inclusive Pattern Match
Message-Id: <7j3jm5$meh$1@nnrp1.deja.com>
Perl-ers:
thanks to this group for the many helpful sets of info
that I find here. I recently utilized a FAQ posting
from Tom C. to help me generate a pattern match
sub routine that allows me to test for a list
of patterns in a single string. The example I
saw did an "or" of the pattern list, while I
need to do an "and" of the patterns against
the string. I little re-write and I had something
that worked. Hope this is helpful to others as
well. You should be able to copy the MatchesAll
routine and use it as is in your own modules.
(again the original sample code for this came
from a FAQ posting from Tom Christiansen- thanks!)
Kim Gentes
# Note that this is NOT case sensitive.
# to add case sensitivity, just change
# the line with the "qr" operator to
# include the "i" at the end of the
# pattern match (after the last "/").
use 5.005;
$TRUE = 1;
$FALSE = 0;
# this example program looks for
# a line that includes ALL of these popular
# state abbreviations.
@popstates = qw(CO ON MI WI MN);
while (defined($line = <>)) {
print $line if &MatchesAll($line, @popstates);
}
exit;
# sometimes I want to every item in a list of
# patterns be found in a single string.
#
sub MatchesAll {
my ($line, @requireditems) = @_;
@reqpats = map { qr/\b$_\b/ } @requireditems;
$AllMatched = $TRUE;
for $patobj (@reqpats) {
next if $line =~ /$patobj/;
$AllMatched = $FALSE;
last;
}
return ($AllMatched);
}
1;
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 2 Jun 1999 11:37:19 +0700 (JAVT)
From: Hasanuddin Tamir <hasant@trabas.co.id>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: need an anti-leech script
Message-Id: <Pine.LNX.3.96.990602113254.4228C-100000@borg.intern.trabas.co.id>
On 25 May 1999, Tom Christiansen wrote:
tchrist] Date: 25 May 1999 07:24:21 -0700
tchrist] From: Tom Christiansen <tchrist@mox.perl.com>
tchrist] To: comp.lang.perl.misc@list.deja.com
tchrist] Subject: Re: need an anti-leech script
tchrist] Reply-To: comp.lang.perl.misc@list.deja.com
tchrist] Organization: Perl Consulting and Training
tchrist]
tchrist] [courtesy cc of this posting mailed to cited author]
tchrist]
tchrist] In comp.lang.perl.misc, Henjo <henjo@deadlock.et.tudelft.nl> writes:
tchrist] :I'm constantly losing bandwidth because other people are linking directly
tchrist] :to my files.
tchrist] :Can anyone give me a script which prevents this?
tchrist]
tchrist] Remove the files:
tchrist]
tchrist] perl -e 'unlink @ARGV' file1.html file2.html file3.thml
tchrist]
tchrist] If you don't want people accessing them, don't put them up!
But not everything we put on the web is just for anyone.
Tom has given a simple perl way, I would rather suggest
to find out how your web server can deal with that.
-hasan-
+================================================================+
Hasanuddin Tamir <hasant@trabas.co.id>
TRABAS Technical Dept. PT Meitraco Bahana Sejahtera
IT Solution Provider http://www.trabas.co.id/
Surya Sumantri Blok B1 No. 35 Phone: +62-22-216660
Setrasari Mall Bandung 40146 Fax : +62-22-2007633
+================================================================+
SORRY: I ignore most of attachments but plain text type
+================================================================+
"There was a time we had the trust,
and that always was enough."
--TOTO (I Will Remember)
------------------------------
Date: Wed, 02 Jun 1999 16:39:27 GMT
From: edejauser@my-deja.com
Subject: ORACLE_HOME set var
Message-Id: <7j3mnu$njt$1@nnrp1.deja.com>
I have a web application that is written in Perl that accesses an Oracle
database. The environment is: Solaris 2.6 and Netscape Entreprise Server
The error message is:
ORACLE_HOME environment variable not set!
The implicit webuser and a global profile have:
export ORACLE_HOME
and is used properly by all ServerSideJavaScript(Livewire) applications.
The Perl code runs well when is executed from personal Unix account:
export ORACLE_HOME
is placed inside the personal .profile under this account
Running it at the command line uses this already set shell variable, but
from web application does not.
What would you recommend to solve this problem?
Thanks for your help,
Dan
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 02 Jun 1999 15:50:41 GMT
From: salbarcar@my-deja.com
Subject: PERL FREELANCERS: WANT TO MAKE A QUICK $500?
Message-Id: <7j3jsd$mhb$1@nnrp1.deja.com>
We have a calendar that we're trying to modify. It utilizes an SQL
database. All that we need it to do is search by a DATE RANGE and RETURN
RESULTS IN BATCHES OF 25. Right now it only searches one month at
a time.
My familiarity with Perl suggests that this is an easy job. Maybe 12?
hours of work. Our bid is $500.
Please e-mail me at speralta@awwa.org for further details. Only e-mail
responses will be answered. In other words, I don't come to this group
often so if you want to get a hold of me, E-MAIL ME.
Gracias.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Jun 1999 12:55:36 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl script keeps terminating
Message-Id: <37566d38@newsread3.dircon.co.uk>
kevin <kevin@nospam.co.uk> wrote:
> My perl script has been running fine
> until recently when it appears
> to auto-terminate within 2-5
> mins of of commencing.
>
> Any know if this is likely to be
> a code/server problem?
>
How can we tell? 'auto-terminate' is not a very usefull piece
of diagnostic information. What errors does it show, what does
your program do when it works and what might have happened recently
to cause it to happen - these are all questions you should be asking
yourself.
> I suspect because it was previously
> OK it must be the server?
If you suspect it is something to do with the server then perhaps
you might be better off asking in a group about the server.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Thu, 03 Jun 1999 12:57:35 GMT
From: kevin@nospam.co.uk (kevin)
Subject: Re: Perl script keeps terminating
Message-Id: <37577aa6.21790684@news.free-online.net>
On 3 Jun 1999 12:55:36 +0100, an opinion was expressed by Jonathan
Stowe <gellyfish@gellyfish.com> stating:
>kevin <kevin@nospam.co.uk> wrote:
>> My perl script has been running fine
>> until recently when it appears
>> to auto-terminate within 2-5
>> mins of of commencing.
>>
>> Any know if this is likely to be
>> a code/server problem?
>>
>
>How can we tell? 'auto-terminate' is not a very usefull piece
<snip>
Well it is. Because that is all that happens.
If you do a ps you see it for a set amount of time
and then 'bingo' it's gone.
I just wondered if anyone else has experienced
a similar problem. The fact that i suspect it
may be a server problem does not preclude it from being
code related does it?
kevin
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5870
**************************************