[6319] in Perl-Users-Digest
Perl-Users Digest, Issue: 940 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 13 14:27:48 1997
Date: Thu, 13 Feb 97 11:01:05 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 13 Feb 1997 Volume: 7 Number: 940
Today's topics:
[Q] Finding matching line based on surrounding lines (Eric D. Carter)
Alternative to sort using perl for V.Large file? (Fairey Simon)
ANNOUNCE: CDB_File 0.5 available (Tim Goodwin)
Cataloging an Archive? amas@lhr-sys.dhl.com
Counting values within a file <darrylc@eznet.com>
Does Perl free SV's created in an XSUB? <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
Re: get a string from a line (Brooks Davis)
Re: getting STDERR from `backtick_exec` <seay@absyss.fr>
HELP ME To UPLOAD files... <mai96lgo@rzaix340.rz.uni-leipzig.de>
Re: HELP ME To UPLOAD files... (Nathan V. Patwardhan)
Re: How to Determine operating system type? <fawcett@nynexst.com>
Re: how to e-mail the content of a associate arry? <nmljn@wombat.staff.ichange.com>
Re: howto match newlines? <jander@jander.com>
libwww installation problems under SCO V <jeffs@pop3.silverplatter.com>
Re: log10 <jerrym@ibmoto.com>
Need code to read IBM numerics under UNIX <stetzer@alpha2.csd.uwm.edu>
Re: Need to convert from Date to Work Week.... How can <nmljn@wombat.staff.ichange.com>
Nenscript type print module for Perl? (Albert W. Dorrington)
Re: NT4 & MISN & Perl 5.0=yikes! <julian@jknight.demon.co.uk>
Re: Parseing path from uploaded file (Chris Schleicher)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Feb 1997 16:42:29 GMT
From: ecarter@a-lincoln.hnet.uci.edu (Eric D. Carter)
Subject: [Q] Finding matching line based on surrounding lines
Message-Id: <5dvg9l$2s4@news.service.uci.edu>
I have a (hopefully) simple question. Here's the run down:
I have a text file processed by a script using the diamond operator.
(while (<>) .. )
As it's being read I look for specific info based on if/elsif statements.
(if /pattern/ {} .. elsif /pattern2/ {})
Well, now after I've created this I need to grab a specific line
but I need to take into account the surrounding lines.
Example:
while (<>) {
if /Name:(.*)/ {
$name = $1;
}
elsif /Number:(.*) {
$number = $1;
}
}
The line I'm looking for follows the format:
- <12/34/56>
where the numbers can be any date. The problem is that
I need to know whether the pattern matched is under the
name or number or whatever.
Any suggestions? I've read what I could find (man pages,
the o'reilly books, web pages) but I'm still stumped. Maybe
I'm looking in the wrong place.
If anyone has suggestions it would be GREATLY appreciated.
I'm thinking I could use some sort of "look-ahead" routine
but my attempts have failed miserably.
Please send responses to me directly if possible - ecarter@uci.edu
Thanks in advance,
Eric D. Carter
------------------------------
Date: Thu, 13 Feb 1997 17:29:00 -0000
From: S.Fairey@datasci.co.uk (Fairey Simon)
Subject: Alternative to sort using perl for V.Large file?
Message-Id: <cGBapDataScienceslDATASCIEXCH010004631D@farnnt15.datasciences>
Hi,
I have to sort a large file ( typically 1M lines and about 120MB in size
). At
present I am using the following system call to sort the file on a
particular
field:
sort -k1.75,1.84 file > sorted_file
I know perl is good with text files but I couldn't think of a
faster/better way
to do it in perl..( I dont have the RAM to swallow the whole file )...
If anyone has any suggestions or ideas they would be most welcome.
Simon
------------------------------
Date: 13 Feb 1997 16:22:28 GMT
From: tim@pipex.net (Tim Goodwin)
Subject: ANNOUNCE: CDB_File 0.5 available
Message-Id: <5dvf44$22v$1@nadine.teleport.com>
Dan Bernstein's cdb package is Yet Another in the DBM (DB, GDBM, etc.)
family of associative array databases. The interesting twist is that,
once a cdb (constant database) has been created, it is not possible to
modify it. This restriction brings considerable savings in both space
and time compared to other members of the DBM family. cdb is ideal for
databases which are read many more times than they are written, such as
password databases. For more information about cdb, see
http://pobox.com/~djb/cdb.html
CDB_File 0.5 is a Perl interface to cdb, allowing a Perl associative
array to be tied to a cdb file. The module also includes a subroutine
to create a new cdb file from an existing associative array. The
complete and unmodified release 0.55 of cdb is included with the
CDB_File package.
CDB_File-0.5.tar.gz is available now from CPAN. It is considered an
alpha release. Please contact me, Tim Goodwin <tim@uunet.pipex.com>,
with any problems, questions, or suggestions.
Thanks are due to Jos Backus for his help and encouragement, and of
course to Dan Bernstein for creating cdb.
Tim.
--
Tim Goodwin | "A language needs both intestines and guts." -- Larry Wall
------------------------------
Date: Thu, 13 Feb 1997 10:21:15 -0600
From: amas@lhr-sys.dhl.com
To: amas@lhr-sys.dhl.com
Subject: Cataloging an Archive?
Message-Id: <855850464.6920@dejanews.com>
I am wanting to create an archive that will store a collection of
directories that each have an assortment of files, along with an
index file. The index file would contain a description of the
contents of the directory. Each line of the file would have a field,
where the first element is the field name and the second element the
field data:
Field Name<TAB>Field Data
e.g. Author<TAB>Doe, John
>From time to time, the indexing system would be run and create two
indexes, one would be a complete index of everything in the archive
and the other would be a tree of pages (similar to Yahoo) that would
organise everything according to subject.
If anyone has a script that would achieve what I am trying to do I
would very much appreciate it.
The archive that I would like to build up is no secret. The archive
would be a sort of repository for algorithms (explanations and sample
code). In order to reduce the administration required for such a
project I need to automate as much as possible the tasks. I also
mention this because I would need someone to host such a project.
Thanks for any help
Andre-John
N.B. This has nothing to do with my work
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 13 Feb 1997 09:12:56 +0000
From: Darryl Caldwell <darrylc@eznet.com>
Subject: Counting values within a file
Message-Id: <3302DB18.426B@eznet.com>
I would like to learn how to count multiple occurences of
text within a
file.
If a file contains:
camel
iguana
penguin
cat
penguin
cheetah
camel
I would like to append text underneath this that says:
Total
=============
camel 2
iguana 1
penguin 2
cat 1
cheetah 1
In the real world I could use this to count which files
received the
most amount of hit in a web server log file. I've written a
perl script
that parses a log file and would like to proceed with this
next step.
Any tips, references, etc., would be appreciated. TIA.
Darryl
------------------------------
Date: Thu, 13 Feb 1997 10:51:38 -0500
From: Tim Lewis <tcl@caesun.msd.ray.com.CLIP.THIS.PART>
Subject: Does Perl free SV's created in an XSUB?
Message-Id: <3303388A.1AA8@caesun.msd.ray.com.CLIP.THIS.PART>
I've been creating some XSUB's for a C library, and I have a question
about variables created in the XSUB. The man pages perlxs, perlguts,
etc. didn't make this very clear, and there doesn't seem to be a whole
lot in the FAQ about it.
In my XSUB I create a hash, fill it, and return a reference to the hash
on the argument stack.
My code is similar to the following:
void
OneNTwo(o, t)
char* o
char* t
PPCODE:
SV *one;
SV *two;
HV *HV_rtn;
HV_rtn = newHV();
one = newSVpv(o, 0);
two = newSVpv(t, 0);
hv_store(HV_rtn, "ONE", 3, one, 0);
hv_store(HV_rtn, "TWO", 3, two, 0);
XPUSHs(sv_2mortal(newRV((SV *)HV_rtn)));
The function gets called like this from Perl:
$hash_ref = OneNTwo("One", "Two");
The reference that I created is declared mortal, because it's going to
get copied into the $hash_ref variable on return from the function
call. However, I can't declare the actual hash values as mortal,
because then you won't be able to access them from Perl, right?
(they'll have gone out of scope).
Sooo, my question is:
What happens to the SV's and HV that I created when the reference goes
out of scope? In other words, if I call the function again, what
happens to the hash that the XSUB created. Does Perl think of it as an
anonymous hash and deallocate it after the reference no longer points to
it, or is it one big memory leak that I have to take care of myself? If
so, how do I do that?
- Tim Lewis
------------------------------
Date: 13 Feb 1997 17:20:52 GMT
From: brdavis@orion.ac.hmc.edu (Brooks Davis)
Subject: Re: get a string from a line
Message-Id: <5dvihk$mpo$1@cinenews.claremont.edu>
Fredrik Lindberg (flg@vhojd.skovde.se) wrote:
: >>>> Stefan Wimmer wrote
: > I tried to work with regular expressions like that:
: >
: > $buffer =~ m/\<h2\>string\<\\h2\>/is;
: >
: > but there is no way.
:
: You need to surround the text you want to catch with
: paranthesis, like this:
:
: $buffer =~ m/\<h2\>(string)\<\\h2\>/i;
: $string = $1; # $1 contains first paranthesized expression
:
: Of course "string" would be an regexp and not a literal.
:
: Check out the man page perlre for more information on
: regular expressions in perl.
Since those look like HTML tags, it also would help it the end tags were
right. The line would be:
$buffer =~ m/\<h2\>(string)\<\/h2\>/i;
^ / not \
-- Brooks
--
Brooks Davis +------------------------------------------------+
brdavis@hmc.edu | "_Slackware_ [Linux] is the MacOS of UNIXes." |
Harvey Mudd College | -- Richard Garnish |
340 E. Foothill Blvd. | on alt.sysadmin.recovery |
Claremont, CA 91711 +------------------------------------------------+
------------------------------
Date: Thu, 13 Feb 1997 16:45:01 +0000
From: Douglas SEAY <seay@absyss.fr>
To: "Daniel M. DiPasquo" <dipasquo@tc.cornell.edu>
Subject: Re: getting STDERR from `backtick_exec`
Message-Id: <3303450D.701C@absyss.fr>
Daniel M. DiPasquo wrote:
>
> Is there a way to grab the STERR of a command exec'd in backticks? For
> example:
>
> $output = `touch /some/place/i/dont/have/permissions/file`
>
> $output should be "touch: ... cannot create", which is usually sent
> along STDERR and seemingly not captured
>
> Thanks,
>
> Dan
That is more of a shell question than a perl question.
$output = `touch /some/place/i/dont/have/permissions/file 2>&1
1>/dev/null`;
For this one in particular, you could just check the return code
instead of parsing the output.
doug seay
seay@absyss.fr
------------------------------
Date: Thu, 13 Feb 1997 17:00:41 +0100
From: Ekin Sokmen <mai96lgo@rzaix340.rz.uni-leipzig.de>
Subject: HELP ME To UPLOAD files...
Message-Id: <33033AA9.424C@rzaix340.rz.uni-leipzig.de>
Hi,
I want to let users upload file from their Browser (Netscape 2.0 ||
>2.0)
to my server.
I'am searching for a CGI-Perl script handling multipart/form-data.
thanks.
bye.
Ekin.
------------------------------
Date: 13 Feb 1997 16:20:56 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: HELP ME To UPLOAD files...
Message-Id: <5dvf18$111@fridge-nf0.shore.net>
Ekin Sokmen (mai96lgo@rzaix340.rz.uni-leipzig.de) wrote:
: I want to let users upload file from their Browser (Netscape 2.0 ||
: >2.0) to my server.
Woah oh. Sounds like yet-another misdirected CGI question. Where in
the description of this group (or in the Perl language documentation)
do you see any reference to "uploading, browsers, or other web things?"
You don't, because Perl != CGI.
: I'am searching for a CGI-Perl script handling multipart/form-data.
I suppose that your careful research didn't lead you to the number of
fine, Perl5 modules that are readily available through CPAN? Get CGI.pm
from http://www.perl.com/perl, read the documentation and follow-up to
comp.infosystems.www.authoring.cgi.
--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"
------------------------------
Date: 12 Feb 1997 08:13:39 -0500
From: Tom Fawcett <fawcett@nynexst.com>
Subject: Re: How to Determine operating system type?
Message-Id: <8jafpadv5o.fsf@nynexst.com>
tadmc@flash.net (Tad McClellan) writes:
> Kin Cho (kin@sampras.isi.com) wrote:
> : Is there a builtin subroutine or a package call for this?
>
> Yes, but it is operating system dependent ;-)
>
> uname -a (for Unix)
Doesn't have to be.
perl -e 'use Config; print $Config{"osname"}'
------------------------------
Date: 13 Feb 1997 11:05:30 -0500
From: nelson <nmljn@wombat.staff.ichange.com>
Subject: Re: how to e-mail the content of a associate arry?
Message-Id: <w10eneky9md.fsf@wombat.staff.ichange.com>
5u16wangz@vms.csd.mu.edu (Zhitao Wang) writes:
> I am new to perl. Now I got to e-mail the content of a associate
> arry to somebody, could somebody give me some instruction on how to
> do that please?
Let me guess. The associative array is %FORM or something like that,
and you're trying to get the results from an HTML form emailed to
someone.
As your first exercise in perl, go to
http://www.perl.com/CPAN/modules/by-module/ and download the MailTools
module. Then get your sysadmin to install it correctly.
For help with associative arrays in general, see perlsyn(1). For the
most help you can get see Programming Perl, 2nd Edition, also known as
The Blue Camel.
Here is the documentation from Mail::Send, just one of the many
helpful modules in MailTools:
NAME
Mail::Send - Simple electronic mail interface
SYNOPSIS
use Mail::Send;
$msg = new Mail::Send;
$msg = new Mail::Send Subject=>'example subject', To=>'timbo';
$msg->to('user@host');
$msg->subject('user@host');
$msg->cc('user@host');
$msg->bcc('someone@else');
$msg->set($header, @values);
$msg->add($header, @values);
$msg->delete($header);
# Launch mailer and set headers. The filehandle returned
# by open() is an instance of the Mail::Mailer class.
$fh = $msg->open;
print $fh "Body of message";
$fh->close; # complete the message and send it
$fh->cancel; # not yet implemented
DESCRIPTION
SEE ALSO
Mail::Mailer
AUTHORS
Tim Bunce <Tim.Bunce@ig.co.uk>, with a kick start from
Graham Barr <bodg@tiuk.ti.com>. With contributions by Gerard
Hickey <hickey@ctron.com> For support please contact
comp.lang.perl.misc.
Cheers,
Laird
--
<laird.nelson@netsinc.com> perl FAQ: http://www.perl.com/perl/faq Perl manual:
http://www.perl.com/CPAN/doc/manual/html/frames.html. If CGI/web appears in
your comp.lang.perl.* post, see news:comp.infosystems.www.authoring.cgi. CGI
stands for Common Gateway *Interface*, not Language or Program or Script.
Consolidated perl reference page: http://www.amherst.edu/~ljnelson/perl.html
------------------------------
Date: 13 Feb 1997 12:32:45 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: howto match newlines?
Message-Id: <ohdoy5ky.fsf@jander.com>
chrender@rbg.informatik.th-darmstadt.de (Christoph Ender) writes:
>
>
> Hi!
>
> There has been a discussion about stripping text between <a> and </a>
> including newlines some time ago. I've practically the same problem,
> but none of the solutions seems to work for me.
>
> File to change contains:
> ------------------------------------------------------------------------
> printf(
>
>
> "text");
> ------------------------------------------------------------------------
> I'm looking for an expression that will cut out anything between '(' and
> the first '"', including the newlines and spaces, so that the above
> input will result in printf("text");
>
> The expression
> 's#(printf\()\s*("text"\);)#$1$2#'
> works perfectly on
> printf( "text");
>
> Then I tried to extend it in several ways to get rid of the newlines:
> 's#(printf\()\s*("text"\);)#$1$2#s'
> 's#(printf\().*("text"\);)#$1$2#s'
> 's#(printf\().*?("text"\);)#$1$2#sg'
> 's#(printf\()(.|\n)*("text"\);)#$1$2#'
>
> All the lines above don't change anything, no expression will match. I
> think the problem is quite basic, but what am I doing wrong?
Your first example works fine for me:
===========================================
#!/usr/bin/perl -w
$_ = <<EOD;
printf(
"text");
EOD
s|(printf\()\s*("text"\);)|$1$2|;
print "$_\n";
===========================================
Produces:
===========================================
printf("text");
===========================================
--
Jim Anderson jander@jander.com
PGP Public Key Fingerprint: 0A 1C BB 0A 65 E4 0F CD
4C 40 B1 0A 9A 32 68 44
------------------------------
Date: Thu, 13 Feb 1997 12:31:01 -0500
From: Jeff Seifer <jeffs@pop3.silverplatter.com>
Subject: libwww installation problems under SCO V
Message-Id: <33034FD5.586DA6B@pop3.silverplatter.com>
I posted a message a few weeks back regarding installation problems
of libwww under Linux. I got great feedback from people and got it
installed and working.
I am now trying to put the perl script I created on a SCO V box and am
having trouble installing libwww on that machine.
I installed gcc (v 2.7-95q4), perl (version 5.003 with EMBED, built
under sco_sv at Feb 11 1997 15:59:46,+ suidperl security patch) and then
tried to install libwww.
libwww install:
===============
Socket 1.3 (installed fine)
IO 1.14 - errors during install. It looks like it can't find
libraries it needs, but I am not sure which ones or
where it's looking! The following is the error I got:
gcc -c -w0 -U M_XENIX -DNO_PROTOTYPE -D_NO_PROTO -O
-DVERSION=\"1.14\" -DXS_VERSION=\"1.14\"
-I/opt/lib/perl5/i386-sco_sv/5.003/CORE IO.c
gcc: unrecognized option `-w0'
Running Mkbootstrap for IO ()
chmod 644 IO.bs
LD_RUN_PATH="" ld -o blib/arch/auto/IO/IO.none IO.o
undefined first referenced
symbol in file
__stat32 IO.o
__fstat32 IO.o
__lstat32 IO.o
__statlstat32 IO.o
Perl_croak IO.o
Perl_stack_sp IO.o
Perl_markstack_ptr IO.o
Perl_stack_base IO.o
Perl_sv_2io IO.o
fgetpos IO.o
Perl_newSVpv IO.o
Perl_sv_2mortal IO.o
Perl_sv_undef IO.o
errno IO.o
fsetpos IO.o
Perl_sv_newmortal IO.o
Perl_sv_setpvn IO.o
Perl_sv_setiv IO.o
Perl_na IO.o
Perl_sv_2pv IO.o
tmpfile IO.o
Perl_newGVgen IO.o
Perl_do_open IO.o
Perl_gv_stashpv IO.o
Perl_newRV IO.o
Perl_sv_bless IO.o
Perl_sv_setsv IO.o
Perl_newSViv IO.o
Perl_sv_2iv IO.o
ungetc IO.o
fflush IO.o
Perl_sv_grow IO.o
setbuf IO.o
setvbuf IO.o
sprintf IO.o
perl_get_sv IO.o
Perl_Sv IO.o
Perl_newXS IO.o
Perl_sv_yes IO.o
ld fatal: Symbol referencing errors. No output written to
blib/arch/auto/IO/IO.none
make: *** [blib/arch/auto/IO/IO.none] Error
13
If anyone can point me in the right direction I would really
appreciate it. I tried copying the .pm files from my Linux box
to the SCO box, but I don't have the proper binaries for SCO,
so the script didn't run properly...
Thanks!
--
jeff - http://jeffs.silverplatter.com
------------------------------
Date: Thu, 13 Feb 1997 10:20:50 -0600
From: Jerry Monsen <jerrym@ibmoto.com>
To: Ying Hu <Y_Hu@fccc.edu>
Subject: Re: log10
Message-Id: <33033F62.41C6@ibmoto.com>
Ying Hu wrote:
>
> Hello,
>
> Is there is log10 function in PERL?
>
> Thank u !
>
> Ying
>From CRC Standard Mathematical Tables 27th edition:
log10(x) = log(x)/log(10) = log10(e) * log(x)
Hope this helps.
Jerry Monsen
------------------------------
Date: Thu, 13 Feb 1997 11:57:05 -0600
From: Frank Stetzer <stetzer@alpha2.csd.uwm.edu>
Subject: Need code to read IBM numerics under UNIX
Message-Id: <Pine.OSF.3.91.970213114345.5608A-100000@alpha2.csd.uwm.edu>
I need some perl routines which will read IBM-MVS mainframe numeric
fields (packed decimal, zoned decimal, and straight numeric) in
a UNIX environment. These are just the raw, ebcdic data files,
ftp'd over.
========================================================================
Frank Stetzer, Ph.D. stetzer@csd.uwm.edu
Statistical Software Coordinator P.O. Box 413
Information and Media Technologies Milwaukee, WI 53201
University of Wisconsin - Milwaukee (414)-229-4571
------------------------------
Date: 13 Feb 1997 11:42:26 -0500
From: nelson <nmljn@wombat.staff.ichange.com>
Subject: Re: Need to convert from Date to Work Week.... How can this be done??
Message-Id: <w104tfgy7wt.fsf@wombat.staff.ichange.com>
Patrick Tan <patrickt@tm.net.my> writes:
> I am in the process of writing a simple Perl script to determine
> the work week, once a particular date is given.
There's a module on CPAN that does this for you already (or something
very close to it). Check out the following URL (sorry if its width is
greater than 80 characters):
http://www.perl.com/CPAN/modules/by-module/Time/Time-modules-97.011701.tar.gz
Note that I retrieve this file via the CPAN, the Comprehensive Perl
Archive Network, accessible at "root level" via http://www.perl.com/CPAN/
Cheers,
Laird
--
<laird.nelson@netsinc.com> perl FAQ: http://www.perl.com/perl/faq Perl manual:
http://www.perl.com/CPAN/doc/manual/html/frames.html. If CGI/web appears in
your comp.lang.perl.* post, see news:comp.infosystems.www.authoring.cgi. CGI
stands for Common Gateway *Interface*, not Language or Program or Script.
Consolidated perl reference page: http://www.amherst.edu/~ljnelson/perl.html
------------------------------
Date: 13 Feb 1997 12:45:33 -0500
From: awdorrin@ictest.delcoelect.com (Albert W. Dorrington)
Subject: Nenscript type print module for Perl?
Message-Id: <5dvjvt$gs4@ws051eng.ictest.delcoelect.com>
Hi,
I'm looking for a Perl module which has the behaviour
of the 'nenscript' printer utility for Unix.
For those of you unfamiliar with nenscript, it allows you
to print out a text file while specifying: Font, Font Size, orientation
(landscape/portrait) as well as allowing for header information on
each page printed.
The output of nenscript is in Postscript format, but that is
not really necessary to me.
Does anything like this exist? I've looked over CPAN but
didn't find anything that seemed to apply.
Thanks in advance,
Al
--
Al Dorrington awdorrin@ictest.delcoelect.com
Delco Electronics - IC CIM Database & Unix Administrator
Kokomo, Indiana, USA Phone: 317.451.9655
------------------------------
Date: Tue, 11 Feb 1997 20:54:33 +0000
From: Julian Knight <julian@jknight.demon.co.uk>
Subject: Re: NT4 & MISN & Perl 5.0=yikes!
Message-Id: <$B8mtFAJyNAzEwiM@jknight.demon.co.uk>
In article <5d5pn0$sa6@news.Hawaii.Edu>, Mark William Acosta
<mwa@Hawaii.Edu> writes
>When I run my perl scripts using Netscape the Microsofte INternet Server
>sends the content type back has x-perl instead of text\plain or
>text\html. When I run the same script using MS Internet Explorer it runs
>fine? What gives? How do I tell the Microsoft INternet Server to send
>the right content type so my perl code can be useful.
> Thanks,
> Mark
As I've just been through this I think I can help!
You need to ensure that you have the correct registry settings.
The settings are listed in the IIS documentation that is carefully
hidden off the back end of the IIS system directory.
--
Julian Knight,
/------------------------------------------------------------------------\
|Home Page: http://www.jknight.demon.co.uk/ |
|Location : Redditch, Worcestershire, United Kingdom. |
|Occupation: PC, Network & Email Consultant |
\------------------------------------------------------------------------/
------------------------------
Date: 13 Feb 1997 10:40:23 -0800
From: chrissch@cs.uoregon.edu (Chris Schleicher)
Subject: Re: Parseing path from uploaded file
Message-Id: <5dvn6n$170@psychotix.cs.uoregon.edu>
In article <Pine.SGI.3.93.970212111806.24026C-100000@world.std.com>,
James B Rush <jrush@world.std.com> wrote:
>Does anyone know how to parse the path from an uploaded dos file. I don't
>have a problem when the upload comes from a UNIX box, but when the files
>comes from dos I get "C:\somename.ext"
I frequently use the following:
## Deal w/uploads from PCs.
$fname = $upfile;
if ($fname =~ /\\/) {
use File::Basename;
fileparse_set_fstype("MSDOS");
$fname = basename($fname);
}
from which you get the idea that the File::Basename module can be
adjusted to one's needs....
Hope this helps,
--Chris
--
Chris Schleicher Office: 541/346-3998
Univ of Oregon CIS GTF email: chrissch@cs.uoregon.edu
URL: http://www.cs.uoregon.edu/~chrissch/
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 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.
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 V7 Issue 940
*************************************