[8498] in Perl-Users-Digest
Perl-Users Digest, Issue: 2115 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 17 09:08:23 1998
Date: Tue, 17 Mar 98 06:00:58 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 17 Mar 1998 Volume: 8 Number: 2115
Today's topics:
Re: A matter of timing (Joergen W. Lang)
Announce: PDF-1.05 perl Library <antro@technologist.com>
Re: Are there translated user messages available? (Robert F. Harrison)
Evaluating $IN(xxx)-string <Kurt@samnet2.ou.dk>
file age, the continuing story <Beljaars@fys.ruu.nl>
Finding a key thanks to a value in a hash (ATOS)
Re: Finding a key thanks to a value in a hash <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Help with regx extracting URLS from HTML pages, ple (David Waring)
Help with useless script <nsequeira@vest.com>
Help! Where can i download Perl Software packet? lihong@public1.guangzhou.gd.cn
Re: Is there a "Newsgroup" for Newbies to Perl? (Robert F. Harrison)
Re: LDAP interface <qdtcall@esb.ericsson.se>
Re: need perl script to read utmp files [Not Perl] (Robert F. Harrison)
parsing perl <rob@NOSPAMintr.net>
perl5_00402 needs > 50MB on my Win95 system:-( Any idea (Bjoern Guenzel)
Re: perl5_00402 needs > 50MB on my Win95 system:-( Any (Jim Michael)
searching a file in Perl <G.W.Lewis@cs.cf.ac.uk>
searching a file in Perl <G.W.Lewis@cs.cf.ac.uk>
Re: Speed of sort routine vs. one-by-one compare (123 (Bart Lateur)
suid woes..... (Mario Antonioletti)
trying to rename files in perl <soul@explorer.com>
Re: trying to rename files in perl <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: trying to rename files in perl <soul@explorer.com>
What does it mean?? <mfolkard@uk.superscape.com>
Re: What does it mean?? <ckc@dmi.dk>
Re: Why this one doesn't work ? (Hunter Johnson)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Mar 1998 12:47:43 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: A matter of timing
Message-Id: <1d61c87.wa4k6lvgm5f6N@host014-206.seicom.net>
Andy Tompkins <aet@aryth.webplanets.com> wrote:
> > I'm trying to find a way to delay my program for less than a second.
#!/usr/bin/perl -w
sleep(10/5); # (divide 10 by 5) seconds
print "Good morning !";
...works on my system, maybe
sleep(1/50);
works as well. I'm not sure as I have no means of measurement for this
resolution.
Hope this helps,
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: Tue, 17 Mar 1998 13:30:03 +0100
From: Antonio Rosella <antro@technologist.com>
Subject: Announce: PDF-1.05 perl Library
Message-Id: <350E6CCB.41C6@technologist.com>
New Release: 1.05
Name DSLI Description Info
----------- ---- -------------------------------------------- -----
PDF bdpO Access information in a PDF file ANTRO
The PDF library is a proposed library for access the information
contained inside a PDF file. PDF stands for Portable Document Format and
is a standard proposed by Adobe ( See http://www.adobe.com/ for more
details ) .
Install "as usual" with:
perl Makefile.PL
make
make install
Then, you can try the scripts in the example directory that tests
if a file is a PDF ( not looking at the .pdf extension :-), the PDF
version used to write them, their number of pages and the various
Info ( Author, Creation date, etc. ).
NEWS:
The library can now handle correctly an Info Dictionary with
multiline strings.
AVAILABILITY:
The library is available at
<http://www.geocities.com/CapeCanaveral/Hangar/4794/>
and at all CPAN mirror
Enjoy
Antonio "Antro" Rosella
--
____ __ _ ___ ____ ____ Antonio "Antro" Rosella
|--| | \| | |--< [__] antro@technologist.com
Member of ANFACE anface@yahoo.com anface@geocities.com
http://www.geocities.com/CapeCanaveral/Hangar/4794/
------------------------------
Date: 17 Mar 98 11:18:33 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: Are there translated user messages available?
Message-Id: <slrn6gsmvk.hop.harrison@localhost.localdomain>
On Mon, 16 Mar 1998 13:00:22 -0800, A. V.
<aviTAKEOUTne@TAKEOUTeng.sun.com> wrote:
> I've been trying to get any sort of information on Perl library
> user messages. Can anyone give me a pointer? I need to know:
perldoc perldiag
It's a start. It's an explanation of the standard Perl messages
generated on errors. For each library (do you mean module?) I don't
think there is a standard location for user messages.
#Use -w once for every program.
use strict; #as well
Since you are at Sun, it shouldn't be hard to find someone to write a
Java program to grep the source code for all the modules though as I
seem to recall all the source is available.
--
rfh harrison@pixi.com
------------------------------
Date: Tue, 17 Mar 1998 14:39:45 +0100
From: Kurt Bilde <Kurt@samnet2.ou.dk>
Subject: Evaluating $IN(xxx)-string
Message-Id: <350E7D21.AC8998AA@samnet2.ou.dk>
Hi !
I have two questions related to the $IN(Variable)-function:
1) how do I upcase the letters ?
2) how do I search for number (0-9) and return a true or false value
indicating number found?
-Kurt
------------------------------
Date: Tue, 17 Mar 1998 12:33:43 GMT
From: Haaino Beljaars <Beljaars@fys.ruu.nl>
Subject: file age, the continuing story
Message-Id: <350E6DA6.6A726028@fys.ruu.nl>
Hi,
I currently have found a way (thanks to Greg Bacon) to delete all files
from the user 'guest':
find2perl / -user guest -mtime +10 -eval unlink | perl
The problem now is, the it leaves behind a 'tree' full of empty
directories and not empty directories.
How can I delete all empty directories too?
Haaino Beljaars
------------------------------
Date: Tue, 17 Mar 1998 11:43:52 +0100
From: cfockeu@atos-group.com (ATOS)
Subject: Finding a key thanks to a value in a hash
Message-Id: <MPG.f7872173cfba864989680@news.axime.com>
Hello,
I'm wondering how I can find a key by its value in a hash ???
Ex:
$hash{'key1'} = 'value1';
...
if I got 'value1', how can I get the key
I don't want to create a second hash (data are huge)
I don't want to look each value in the hash :
Ex : foreach $scalar (values(%hash)) {
if ($scalar = $the_value_I_have) {
# I've found the key
...
}
}
because it's to long
May I use Reference ????
Thanks a lot,
Cedric
PS : keys and values in the hash are unique
------------------------------
Date: 17 Mar 1998 12:11:33 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Finding a key thanks to a value in a hash
Message-Id: <7xvhtdmv16.fsf@beavis.vcpc.univie.ac.at>
Re: Finding a key thanks to a value in a hash, ATOS
<cfockeu@atos-group.com> said:
ATOS> Hello, I'm wondering how I can find a key by its value
ATOS> in a hash ??? Ex: $hash{'key1'} = 'value1'; ... if I
ATOS> got 'value1', how can I get the key
You can't rely on a unique answer to this, different keys
can have the same value.
You need to iterate over the keys, do a lookup of the value
and return the key(s) that match(es).
ATOS> don't want to look each value in the hash : Ex :
Break out of the loop as soon as you get the first match.
foreach $k (keys %hash) {
if ($hash{$k} eq/== $required_value) {
return $k;
}
}
or some other suitable loop breaker depending on where you
use it.
ATOS> PS : keys and values in the hash are unique
Nice special case.
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"
------------------------------
Date: 17 Mar 1998 09:28:36 GMT
From: dwaring@nwsr.com (David Waring)
Subject: Re: Help with regx extracting URLS from HTML pages, plese.
Message-Id: <dwaring-1703980130190001@blv-lx102-ip43.nwnexus.net>
I really recommend that you try to understand regex, they are incredibly
powerful and if you want to do any real web work you should understand
them. yes they are ugly but once you start to understand them you will
love them and understand that there is a reason they are ugly (you just
can't have that much power in a simple format). Below I give an example
of a way to pull the link and title from an <a href>tag. I have not used
LWP much but I think that it should be able to handle this for you. But
that does not mean you should not learn to love regex:
$test='<a href="/link/to/page.html">the title</a>';
for ($test){
($link,$title)=/href[\s="]*(.*?)\s*"\s*>(.*?)<\/a/;
print "link=$link title=$title\n";
}
a few things to note. All the \s's are there to take care of potential
white space. you could even throw in some more to be really safe.You are
doing the match on $_ and the things that are matched in the () are the
things that are asigned to $link and $test. You could also refer to them
as $1 abd $2 as below.
$test='<a href="/link/to/page.html">the title</a>';
$test=~/href[\s="]*(.*?)\s*"\s*>(.*?)<\/a/g;
$link=$1;
$title=$2;
print "link=$link title=$title\n";
or combined using
($link,$title)=($1,$2);
the examples above do not take into account the fact that there could be
more than one link in your $test. You have to take care of this
possiblility. There are several ways to do this. You could split your
line on < so that there is only one tag to look at
@lines=split(/</,$test);
for (@lines){
...
}
or you could use a while statement and a substitution instead of a match
like
while ($test=~s/href[\s="]*(.*?)\s*"\s*>(.*?)<\/a//){
($link,$title)=($1,$2);
print "link=$link title=$title\n";
}
this finds a link grabs the info and deletes it (substitues it with
nothing) and continues to look for more matches.
I hope this is helpful. I suggest you study regex from either the camel
or the llama. If you want to learn Perl you really must have both.
David
In article <6ekifj$dod@drn.newsguy.com>, Chad wrote:
> Hi,
>
> I'll make this sort and sweet. I need help extracting links from HTML
> documents, link by link ( line by line, etc ) so I can replace them with a tag
> infront of the HREF.
>
> I tried to use LWP and HTML::LinkExtor, i could get it to extract all
the links
> once it read the whole file, but what I need is this, i guess:
>
> ($link,$title) = regx; I'm not real good with regx so if someone could help I
> would really appriciate it.
>
> ($link,$title) = *<*href*=*"*LINK*"*>*TITLE*</a>
> ^ ^
> | --- might be here, might not
> * for white spce.
>
> could someone help, I know I'm retarded.
>
> -chad
------------------------------
Date: Tue, 17 Mar 1998 01:30:28 -0800
From: Nathan Sequeira <nsequeira@vest.com>
Subject: Help with useless script
Message-Id: <350E42B3.D5779F20@vest.com>
Hello, all. I have a Perl script that is currently useless to me, as
there are apparently characters that need to be escaped and possibly
other errors. I'm including it at the end of this message.
This script works with CyberCash (an e-commerce solution) to settle all
transactions at a certain time of day. It was on the tech support
section of the CyberCash site, but with the disclaimer (see below) that
it doesn't work. Anyway, I don't know a lick of Perl (and I don't have
time to learn right now, unfortuntately). So I'm presenting this in
hopes that someone will be able to figure out what is wrong with this
script, as the problems are supposed to be not specific to CyberCash but
general in nature.
Thanks in advance.
--
Nathan Sequeira
Vest Technologies
415-986-8378
=================================================
Description of the Problem:
>From an ISP:
Wrote this for a customer who wants to ensure that he doesn't forget to
close his batch before 4PM PST (CardService Int'l Requirement).
*note: You'll need to edit the article to use HTML escape codes
for hharacters in the Perl Script, and perhaps a few others.
===========================================================================
#!/usr/local/bin/perl
# Notes
# this program originated from CyberCash technical support
# I have extended it to query all marked transactions
# a) die if can't get marked txns
# b) die if 0 marked txns
# c) batch-commit all marked txns
# portions of this file are the unpublished work of
#
# Check Perl version
#
require 5.001;
#
# Require some libraries
#
use CCLib qw(SetServer sendmserver urldecode);
#
# Constants to find the merchant payment server
#
effff1e8ayment = ( 'host' = '#host#',
'port' = #port#,
'secret' = '#secret#');
&SetServer(effff1e8ayment);
# buglet--sendmserver() chokes on null inquiry arguments, even
# though the SMPS 1.2 API lists all arguments for the batch-prep
# command as optional
# caveat this may be related to modifications I made to the
# CClib.pm library to use the Win32Internet package; this behavior
# should be replicated with a "clean distribution" CClib.pm
# start with a batch-prep; got to know what you're allowed to batch
result = &sendmserver('batch-prep','');
#
# just dump results to stdout.
# you should process them...
# to allow results to affect operation of your fulfillment...
#
# so I will
#
foreach (keys(result)) {
print " $_ == $result{$_}\n";
}
#
# bulk of additions here
#
die unless ($result{'MStatus'} =~ /^success/);
$n = 0;
foreach (sort keys result) {
next unless /^a\d+$/;
effff1e8airs = urldecode($result{$_});
$n++;
$num = $_;
$num =~ s/^a//;
# push the order-id and txn-type
push(@arg,"order-id-$n",$pairs{'order-id'});
push(@arg,"txn-type-$n",$pairs{'txn-type'});
# you could also add the amount-$n field here if your fulfillment
# process reduces the actual capture amount (backorders, &c.)
}
die unless ($num 0);
#
# NOW we have a useful batch-commit!
#
result = &sendmserver('batch-commit',
'num-txns', $num,
@arg);
#
# And NOW you can also do processing based on the result of your
# batch in case of capture errors or other exceptions
#
foreach (keys(result)) {
print " $_ == $result{$_}\n";
}
------------------------------
Date: Tue, 17 Mar 1998 06:14:10 -0600
From: lihong@public1.guangzhou.gd.cn
Subject: Help! Where can i download Perl Software packet?
Message-Id: <6elpar$1pk$1@nnrp1.dejanews.com>
I am a new fans of Perl. I find it very powerful in CGI programming.
I have a perl programing environment in my office on the workstation.
However, I still want to continue the exploration on Perl in the evening
when I sit in front my PC (Pentium 166 MMX,32MRAM). It there anybody
here know where to download Perl for PC? Any help would be appreciated.
Leon Li
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 17 Mar 98 10:47:14 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <slrn6gsl4p.hop.harrison@localhost.localdomain>
On Sat, 14 Mar 1998 22:21:24 -0500, I R A Aggie <fl_aggie@thepentagon.com>
wrote:
>
> These newbies (for the most part) aren't children. Most know how to
> read, many have college courses under their belts.
Is there an Ebonics::Syntax module available so I don't have to learn
standard Perl? I did check CPAN and FAQ but didn't see anything
available.
I think there's more than enought evidence for a class action suit to
be filed against Larry as author and Tom C. as a conspirator in and of
(but not Randal simply because) a language that discriminates
against those who don't think one should have to be a programmer to
program.
I think Larry should use his much talked about linguistic and
programming skills to write a language that anyone can put up cool web
pages with without having to go through the trouble of learning to say
something or even having something to say.
Indeed, I'm pissed because he designed Perl without thinking of doing
'some cool CGI' beforehand. If he's so smart how come he didn't know
we'd want to say nothing loudly?
How dare he give something away free, with instructions, not to
mention coercing many people into aiding and abetting without
rendering it harmless first.
--
rfh harrison@pixi.com
------------------------------
Date: 17 Mar 1998 12:11:28 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: LDAP interface
Message-Id: <isen017esf.fsf@godzilla.kiere.ericsson.se>
"Norman Bunn" <norman.bunn@mci.com> writes:
> Has anyone used LDAP with PERL? If so, how?
Yes. The Netscape LDAP stuff and Net::LDAPapi from CPAN. I think the
README for the module contains a pointer to where to get the Netscape libs.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 17 Mar 98 10:56:27 GMT
From: harrison@pixi.com (Robert F. Harrison)
Subject: Re: need perl script to read utmp files [Not Perl]
Message-Id: <slrn6gslm3.hop.harrison@localhost.localdomain>
On 17 Mar 1998 06:37:54 GMT, Ma Xin <maxin@iscs.nus.edu.sg> wrote:
> I'm looking for a perl script to read the utmp files(including /etc/utmp, /etc/wtmp, etc) in unix. I think it can be read using pack, unpack function in perl but I'm not sure what format the utmp files use. anyone?
Not a Perl or perl question:
man utmp
^^^^^^^^
Under Linux->RedHat you'd learn this:
The file is a sequence of entries with the following
structure declared in the include file:
#define UT_UNKNOWN 0
#define RUN_LVL 1
#define BOOT_TIME 2
#define NEW_TIME 3
#define OLD_TIME 4
#define INIT_PROCESS 5
#define LOGIN_PROCESS 6
#define USER_PROCESS 7
#define DEAD_PROCESS 8
#define UT_LINESIZE 12
#define UT_NAMESIZE 8
#define UT_HOSTSIZE 16
struct utmp {
short ut_type; /* type of login */
pid_t ut_pid; /* pid of process */
char ut_line[UT_LINESIZE]; /* device name of tty - "/dev/" */
char ut_id[2]; /* init id or abbrev. ttyname */
time_t ut_time; /* login time */
char ut_user[UT_NAMESIZE]; /* user name */
char ut_host[UT_HOSTSIZE]; /* host name for remote login */
long ut_addr; /* IP addr of remote host */
};
I'm sorry to anyone I offended by suggesting anything whatsoever.
--
rfh harrison@pixi.com
------------------------------
Date: Tue, 17 Mar 1998 07:12:24 -0500
From: Rob Collins <rob@NOSPAMintr.net>
Subject: parsing perl
Message-Id: <350E68A7.EC2E2593@NOSPAMintr.net>
I was wondering if anyone could direct me to a really good resource on
Perl's syntax? I am looking for some rules by which I can evaluate a
file and break it down into blocks, and break each block into
statements.
------------------------------
Date: Tue, 17 Mar 1998 10:27:27 GMT
From: guenzel.p1@usa.net (Bjoern Guenzel)
Subject: perl5_00402 needs > 50MB on my Win95 system:-( Any ideas?
Message-Id: <890130207.8786.1.nnrp-03.c1ed20e5@news.demon.co.uk>
Unpacking the perl5_00402-bindist04-bc.zip package (size 5.88MB)
reduces my available disk space by 50MB when I unpack it, although the
resulting directory is said to have only the size of 16.x MB :-(
I guess this must be because of the notorious disk-partition problem
(every file uses at least 16K or something like that, and the perl
directory contains >2000 files).
If there are any possibilities to get around that problem, I would be
glad to hear, as I can't afford those 50MB at the moment. In the
meantime I use Actiware Perl5_3 or something, which uses moderate
4MB (but lacks some modules, like CGI.pm).
Many thanks in advance for any help!
Bjoern
------------------------------
Date: Tue, 17 Mar 1998 11:35:08 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: perl5_00402 needs > 50MB on my Win95 system:-( Any ideas?
Message-Id: <genepoolEpyo6K.KvE@netcom.com>
Bjoern Guenzel (guenzel.p1@usa.net) wrote:
: Unpacking the perl5_00402-bindist04-bc.zip package (size 5.88MB)
: reduces my available disk space by 50MB when I unpack it, although the
: resulting directory is said to have only the size of 16.x MB :-(
: I guess this must be because of the notorious disk-partition problem
: (every file uses at least 16K or something like that, and the perl
: directory contains >2000 files).
Sector allocation granularity. I think the newer FAT filesystem,
whatever it is called, might help. Or compress the drive. Or zip
the directories you aren't using at present. Or upgrade to Linux.
Cheers,
Jim
------------------------------
Date: Tue, 17 Mar 1998 13:29:25 -0800
From: Gerald <G.W.Lewis@cs.cf.ac.uk>
Subject: searching a file in Perl
Message-Id: <350EEB35.5528@cs.cf.ac.uk>
Im currently working on an online catalogue and i am having trouble
getting to grips with searching a fle is it possible.
i would be gratefull of some help
------------------------------
Date: Tue, 17 Mar 1998 13:29:37 -0800
From: Gerald <G.W.Lewis@cs.cf.ac.uk>
Subject: searching a file in Perl
Message-Id: <350EEB41.458B@cs.cf.ac.uk>
Im currently working on an online catalogue and i am having trouble
getting to grips with searching a fle is it possible.
i would be gratefull of some help
------------------------------
Date: Tue, 17 Mar 1998 11:41:08 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <350e6097.9152372@news.tornado.be>
Doesn't anybody pay any attention?
> substr($index, $j<<2 , 4) = pack("N",$seek);
This must be
substr($index, $j<<2 , 0) = pack("N",$seek);
or you'll overwrite an existing index instead of inserting a new one.
Bart.
------------------------------
Date: Tue, 17 Mar 1998 08:43:11 GMT
From: mario@epcc.ed.ac.uk (Mario Antonioletti)
Subject: suid woes.....
Message-Id: <EpyG80.A9p.0.staffin.dcs.ed.ac.uk@dcs.ed.ac.uk>
Hi,
I guess this must be a realtively common problem. I have looked at the
perlsec man page, the perl 5 book and a couple of other sources and not
found a solution. Any help would thus be appreciated.
I am running a perl (5.004) CGI script on a solaris (5.5.1). I am also using
taint perl (perl -T). Suppose the script is called myscript.pl. I set the
suid and sgid bits as follows: 'chmod 06755 myscript.pl'. In the script I
have:
$mydir="/some/directory/to/be/created";
($<,$>) = ($>,$<);
$ret=mkdir("$dirname",0755);
($<,$>) = ($>,$<);
where the "/some/directory/to/be/" already exists in my home space and
I wish to create the "created" bit. When I run this under my own user
id all works fine. However when I run it under a different user id the
$ret comes out with a 0 and $! comes out with "permission denied". I
call @user = getpwuid($<); in between the '($<,$>) = ($>,$<);' and the
mkdir statement and it shows I have changed the user id to my own user
id yet I still can't create the directory. Why? I am missing something
pretty fundamental here - to make matters worse I got it to work when I
first did it and then I broke it and I have not been able to fix it
since. Any ideas? I know that there are other ways to do it but I want
to understand what is going wrong here.
Thanks in advance for any help, tips and commiserations,
Mario
--
-------------------------------------------------------------------------
| Mario Antonioletti:EPCC,JCMB,The King's Buildings,Edinburgh EH9 3JZ. |
| Tel:0131 650 5026:mario@epcc.ed.ac.uk:http://www.epcc.ed.ac.uk/~mario/|
-------------------------------------------------------------------------
------------------------------
Date: 17 Mar 1998 09:30:54 GMT
From: <soul@explorer.com>
Subject: trying to rename files in perl
Message-Id: <6elfse$g4g@news3.euro.net>
here's the source code*:
open (FILE, ">/htdocs/testfile.txt");
print FILE "testing\n\n";
close (FILE);
rename( "/htdocs/testfile.txt","testfile2.txt" ) || die ($!);
--------
hi, posted a while ago with renaming problems on win32 perl.
i have since run the script from the perl command line and the rename
executes as intended, though when called with identical parameters from
a browser, $! always returns a "file not found" error.
even a simple test script* with hardcoded filenames produces the same
results, correct renaming from the command line, and file not found when
called from a browser.
any assistance appreciated!
regards,
Christopher Paul
------------------------------
Date: 17 Mar 1998 10:40:22 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: trying to rename files in perl
Message-Id: <7xogz5lkop.fsf@beavis.vcpc.univie.ac.at>
Re: trying to rename files in perl, soul <soul@explorer.com>
said:
soul> open (FILE, ">/htdocs/testfile.txt");
You should be checking the status of the open.
soul> rename( "/htdocs/testfile.txt","testfile2.txt" ) || die ($!);
soul> i have since run the script from the perl command line
soul> and the rename executes as intended, though when
soul> called with identical parameters from a browser, $!
soul> always returns a "file not found" error.
Does your web server really have its document space in your
filesystem's root?
soul> even a simple test script* with hardcoded filenames
soul> produces the same results, correct renaming from the
soul> command line, and file not found when called from a
soul> browser.
See the CGI FAQ
http://www.boutell.com/
You are not your web server.
hth
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"
------------------------------
Date: 17 Mar 1998 10:25:09 GMT
From: <soul@explorer.com>
Subject: Re: trying to rename files in perl
Message-Id: <6elj25$i0h@news3.euro.net>
>soul> even a simple test script* with hardcoded filenames
>soul> produces the same results, correct renaming from the
>soul> command line, and file not found when called from a
>soul> browser.
>You are not your web server.
OK, sounds realistic, can't find anywhere in IIS2 that lets me
require a login, but that's a question for another newsgroup...
>Does your web server really have its document space in your
>filesystem's root?
it's my local development webserver, and has no web ip address.
thanking you.....
------------------------------
Date: Tue, 17 Mar 1998 09:48:13 -0000
From: "Matt Folkard" <mfolkard@uk.superscape.com>
Subject: What does it mean??
Message-Id: <350e46dd.0@news.uk.superscape.com>
I've got a simple question (I think), I just need someone to tell me *what*
this code does!! It's supposed to be filtering files, but I think whoever
sent it to me is having a laugh...
$_ =~ /s(^_\w\-\.]+)&/
It's got me stumped, but I suppose it's cos I'm a comparative newbie.
I'd appreciate any help!
------------------------------
Date: 17 Mar 1998 11:48:25 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: What does it mean??
Message-Id: <wvpiupd1tl2.fsf@pratt.ejoper.dmi.min.dk>
"Matt Folkard" <mfolkard@uk.superscape.com> writes:
> I've got a simple question (I think), I just need someone to tell me *what*
> this code does!! It's supposed to be filtering files, but I think whoever
> sent it to me is having a laugh...
>
> $_ =~ /s(^_\w\-\.]+)&/
>
> It's got me stumped, but I suppose it's cos I'm a comparative newbie.
It matches stuff on the form (the 'a' could be any of 'a'-'z', '0'-'9'
or '_'):
s^_a-.]+&
I suspect a '[' is missing. If the line read:
/s([^_\w\-\.]+)&/
it would match an s, followed by something neither an underscore, nor
a word character, a hyphen or a dot, followed by an ampersand. Strange
indeed.
My best guess is the code you received was somehow munged.
Regards,
Kvan.
--
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- | unattempted is impossible.'
Lokal 544 |
I do not speak for DMI, just me. | - Lord Mhoram, Son of Variol.
------------------------------
Date: 17 Mar 1998 13:40:15 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: Why this one doesn't work ?
Message-Id: <6elufv$ofr@mailgate.lexis-nexis.com>
In article <6ekd3v$7u2$1@nnrp1.dejanews.com>, <indhiraa@hotmail.com> wrote:
> I have a PERL program whose first 3 lines are like this:
> #!/bin/sh
> # this line will be comment for PERL \
> exec perl "$0" $@"
> print "hello..\n";
> My intention is to avoid hard-coding the path to the Perl
> interpreter. but this script continuously execs and never goes
> beyond that.
That's because "exec perl" is a valid perl statement, which gets
executed each time "exec perl" is called. Yes, you've got infinite
recursion.
Try starting with
#!perl
if it's important to avoid hard-coding the path.
Hunter
--
J. Hunter Johnson | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com | costly servanthood are worth millions of
(937) 865-6800 x5385 | true words harshly spoken."
Lexis-Nexis, Dayton, OH | -- Ron Sider
------------------------------
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 2115
**************************************