[8766] in Perl-Users-Digest
Perl-Users Digest, Issue: 2382 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 22 13:27:26 1998
Date: Wed, 22 Apr 98 10:16:03 -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 Wed, 22 Apr 1998 Volume: 8 Number: 2382
Today's topics:
Re: how can I get commands to display? pault@corbina.ru
How can I get the correct answer? <James_Yang@via.com.tw>
How do I get the name of each file in a dir? <poohba@io.com>
Re: How do I get the name of each file in a dir? (Mike Williams)
Re: How do I get the name of each file in a dir? jesten@wdynamic.com
Re: How do I get the name of each file in a dir? (Jonathan Stowe)
Re: How do I get the name of each file in a dir? <sneaker@earthling.net>
Re: How do I get the name of each file in a dir? (John Klassa)
Re: How do I get the name of each file in a dir? (Martien Verbruggen)
Re: how do I install modules on win32? <"xuming "@ email.unc.edu>
Re: How Send Mail: PERL to VB Translators?! (Jonathan Stowe)
how to change password in netscape webserver with a CGI ender@mythen.ch
Re: how to change password in netscape webserver with a (Martien Verbruggen)
Re: How to create a new file? (Abby Franquemont)
Re: How to create a new file? (Martien Verbruggen)
Re: How to create a new file? (John Klassa)
How to get clock ticks or calculate elapsed time less t <j_harrison1@ti.com>
Re: How to get clock ticks or calculate elapsed time le (brian d foy)
How to insert <a href> using regexp? (Apisilp Trunganont)
Re: How to insert <a href> using regexp? (brian d foy)
Re: How to insert <a href> using regexp? (Michael Fuhr)
Re: How to insert a \n each... (Andrew M. Langmead)
How to load the module with calculated name? (Petr Prikryl)
Re: How to post to phtml? <rafi@flashpoint.com>
http://www.rwx.net (michael)
Image can view but cannot download? (LM386)
Re: Image can view but cannot download? (brian d foy)
Re: Image can view but cannot download? (Martien Verbruggen)
Interesting (?) file programming issue (Rich Gibson)
Re: Interesting (?) file programming issue (Rich Gibson)
Re: Interesting (?) file programming issue (Clive Newall)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Apr 1998 17:47:07 -0600
From: pault@corbina.ru
Subject: Re: how can I get commands to display?
Message-Id: <6hgj9b$ete$1@nnrp1.dejanews.com>
You could also download Tix (for GUI) and try visual perl debugger from
http://www.qub.com/group/
It is written in perl and works with UNIX and Windows 95/NT.
Rgds.Paul.
>
> joes garage <joe@garage.com> wrote:
> >I looked at the FAQ and programming perl book and cannot find
> >what I am looking for. I would like to display lines as they execute.
> >
> >I am looking for the equiv of set -x in shell.
> >Does such a beast exist?
>
> You could try using the debugger perl -d and trace mode (t).
>
> --
> Jason Gloudon
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 21 Apr 1998 12:07:23 +0800
From: James Yang <James_Yang@via.com.tw>
Subject: How can I get the correct answer?
Message-Id: <353C1B7B.87A1109F@via.com.tw>
Hi!
The following is my program.
#! /cad/bin/perl5.4 -w
($n1, $n2, $n3) = (55.460, 50, 100);
$n4=$n1+$n2-$n3;
print "$n1 + $n2 - $n3 = $n4\n";
($n1, $n2, $n3) = (1553.050, 50, 1600);
$n4=$n1+$n2-$n3;
print "$n1 + $n2 - $n3 = $n4\n";
exit 0;
But I got the following result after I execute this program
55.46 + 50 -100 = 5.46000000000001
1553.05 + 50 - 1600 = 3.04999999999995
Is it a bug or I can get the correct answer in the other way?
------------------------------
Date: Sun, 19 Apr 1998 12:38:42 -0500
From: Chocolate <poohba@io.com>
Subject: How do I get the name of each file in a dir?
Message-Id: <Pine.BSI.3.96.980419123805.2123A-100000@pentagon.io.com>
How do I get the name of each file in a dir and print it?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/ _/ _/
_/ _/ _/ _/
Web Page Designs _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/
Small Programs _/ _/ / _/ _/ _/ _/ _/ _/ _/ _/ poohba@io.com
www.io.com/~poohba _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/\_ (919)506-5883
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: 19 Apr 1998 20:33:50 GMT
From: daolath@news1.mnsinc.com (Mike Williams)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <6hdn3e$sn1$1@clarknet.clark.net>
On Sun, 19 Apr 1998 12:38:42 -0500, Chocolate <poohba@io.com> wrote:
>How do I get the name of each file in a dir and print it?
How about
print `ls`;
--
-Mike Williams
http://www.mnsinc.com/daolath/index.html
I can also be reached at work: mike.williams@swift.com
------------------------------
Date: Sun, 19 Apr 1998 15:59:27 -0600
From: jesten@wdynamic.com
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <6hdojf$qqr$1@nnrp1.dejanews.com>
In article <Pine.BSI.3.96.980419123805.2123A-100000@pentagon.io.com>,
Chocolate <poohba@io.com> wrote:
>
> How do I get the name of each file in a dir and print it?
$directory = '/usr1/home/yourname';
opendir(DIR,$directory);
@files = readdir(DIR);
closedir(DIR);
foreach(@files) {
print $_\n";
}
...many variations for filtering out, among other things, the dot and double
dots entries...
Jim
Jim Esten, Lead Developer, WebDynamic
http://www.wdynamic.com
ICQ: 5943404
In the beginning was the word, and the word was ... adjust!
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Sun, 19 Apr 1998 23:04:20 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <353a74a8.8347171@news.btinternet.com>
On Sun, 19 Apr 1998 12:38:42 -0500, Chocolate <poohba@io.com> wrote:
>How do I get the name of each file in a dir and print it?
An agent provocateur, right ?
A whole bunch of methods are available to you to get a list of files
in a directory - I suppose its a kind of RTFM thing.
You can glob.
You can opendir()
You can use File::Find
But hey thats just a matter of opinion.
/J\
Jonathan Stowe
See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: Sun, 19 Apr 1998 23:25:47 GMT
From: Bill 'Sneex' Jones <sneaker@earthling.net>
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <353A8661.5024CA73@earthling.net>
This is a multi-part message in MIME format.
--------------2F084C1673356E359CE9BED5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Chocolate wrote:
> How do I get the name of each file in a dir and print it?
>
After I learned to print "Hello world!\n";
I learned to:
opendir,
readdir,
HTH,
__________________________
Bill Jones...............|
Sneaker's Nest...........|
Chasecreek Systemhouse...|
PS - See attached:
--------------2F084C1673356E359CE9BED5
Content-Type: text/plain; charset=us-ascii; name="output"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="output"
=item readdir DIRHANDLE
Returns the next directory entry for a directory opened by opendir().
If used in a list context, returns all the rest of the entries in the
directory. If there are no more entries, returns an undefined value in
a scalar context or a null list in a list context.
If you're planning to filetest the return values out of a readdir(), you'd
better prepend the directory in question. Otherwise, because we didn't
chdir() there, it would have been testing the wrong file.
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
--------------2F084C1673356E359CE9BED5--
------------------------------
Date: 20 Apr 1998 19:46:35 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <6hg8mr$1c7$1@aurwww.aur.alcatel.com>
On Mon, 20 Apr 1998 00:33:04 -0700, Aaron <aaronl@sunset.net> wrote:
->resort to the shell to get a file list? Hell we can chmod, chdir, mkdir
->and the like, but I can't find a "perl" command to list the files.
opendir and readdir are your friends... As is the File::Find module.
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: 21 Apr 1998 06:25:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <6hhe5g$r94$1@comdyn.comdyn.com.au>
[Excuses if this has been answered elsewhere in the thread. My news
server only had this article]
In article <353AFA30.7187@sunset.net>,
Aaron <aaronl@sunset.net> writes:
> Mike Williams wrote:
>>
>> On Sun, 19 Apr 1998 12:38:42 -0500, Chocolate <poohba@io.com> wrote:
>> >How do I get the name of each file in a dir and print it?
# perldoc -f opendir
# perldoc -f readdir
# perldoc -f closedir
You *could* use the following, but I wouldn't recommend it.
# perldoc -f glob
>> How about
>>
>> print `ls`;
Eeek. Not portable. Unnecessarily spawning a process. Not safe.
> I too have wondered about this. I have had to resort to the above or
> also I have used $foo=`echo /some_dir/*`;
I guess this would be equivalent to glob().
> But what if I'm on a different platform, win32? Do we always have to
> resort to the shell to get a file list? Hell we can chmod, chdir, mkdir
> and the like, but I can't find a "perl" command to list the files.
See above. opendir(), readdir(), closedir(). Portable, safe, fast.
Have you tried
# perldoc perlfunc
/search for 'dir'
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: Sun, 19 Apr 1998 11:39:30 -0400
From: Xuming <"xuming "@ email.unc.edu>
Subject: Re: how do I install modules on win32?
Message-Id: <6hd6av$quc$1@fddinewz.oit.unc.edu>
Jonathan,
thank you very much for all the helpful infomation and pointing out the right
way to to learn programming languages. I agree examining program source is
helpful. and I do have this curiosity. I did take a look at cpan.pm. but, as
a newbie who just learnd Perl for a couple of weeks, is it possible to
understand those 3587 lines of codes? I quited after about 100 lines. (Perl
actually is my first programming language if don't count FORTAIN which I learned
a semester 9 years ago.)
also, I do agree newbies should read the faqs, manpages... but I also did
that. to me, is just not easy to find the info I need is in cpan.html. (maybe
I should finish all those 4.5 MB html files before I post another newbie
question :-) anyway, I appreciate anyone who point me to the right document.
I also thank the people working at CPAN, I know they are all volunteers. but I
would be more happy if the site is easier to browse, and faqs contain more
helpful infomation (like the answers I got here for the question
How_do_I_install_modules)
Thank you again for answering my question! seems dmake is working right now...
xuming wang
Jonathan Stowe wrote:
>
> On Sat, 18 Apr 1998 12:52:33 -0400, Xuming <"xuming "@ email.unc.edu>
> wrote:
>
> >I am new to perl, but I checked the FAQ and the readme file with a module
> >bundle, and I also searched Dejanews. the most helpful info I got is:
> >
> <snip>
> >
> >there is a CPAN.pm file under my perl/lib dir, but how do I use it to install a
> >module bundle? I don't have gzip or tar on my win95 for sure. so if I run
> >'perl cpan.pm' it would just fail (error messages at the end of this post). I
> >don't have a C compiler either. so make won't run. (I'm going to install VC5,
> >will that help?)
> >
>
> What you really want to do is :
>
> perl -MCPAN -e shell
>
> Or try:
>
> perldoc CPAN
>
> to find more information.
>
> Examining the CPAN.pm file with an editor would reveal the
> documentation, however, whether perldoc works or not. For myself I
> actually find it quite wierd that people dont look at program source
> more often - especially in Perl where there is so much of it. (Hey,
> I've learned programming languages, after a fashion admittedly, by
> reading source code.) Perhaps this lack of curiosity lies at the root
> of some of the symptoms we are seeing in c.l.p.m.
>
> You can find both tar and gzip out there for Windows (djgpp & cygwin32
> ports are available and possibly more). Alternatively WinZip which is
> a widely available piece of shareware will deal with these and various
> other formats.
>
> If you have the "standard" distribution for win32 then you will also
> have "dmake". Once you have unpacked a module you can run through the
> standard build procedure i.e.
>
> perl Makefile.PL
> dmake
> dmake test
> dmake install
>
> You may find it far easier if you have a unix-like shell and
> associated utilities. (I guess I lay myself open to charges of being
> a unix zealot but - ) I have been finding myself advocating the
> cygwin32 port of the GNU utilities and shell quite a lot recently -
> but again you can look at:
>
> http://www.cygnus.com
>
> (On NT the Resource Kit gives you enough shell stuff to be going on
> with - just enough..)
>
> /J\
> Jonathan Stowe
> See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: Tue, 21 Apr 1998 14:48:25 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How Send Mail: PERL to VB Translators?!
Message-Id: <353c86ac.6463848@news.btinternet.com>
On Tue, 21 Apr 1998 19:54:16 +1000, "David Hamilton"
<hamilton@melbpc.org.au> wrote:
>I am wondering if anyone can help me?
>I want to know how to send an E-Mail from a Visual Basic 4 CGI, using a
>mail program already on the server. I think it is just a matter of
>SENDing the info to the program, but I don't know how to direct this info
>to the mail program.
>
Eh,oh.
Deep down in your heart of hearts you know this is a question for
comp.lang.basic.visual. For what its worth I dont think that what you
want to do is anywhere near as easy to in VB as it is in Perl. You
would probably be better off implementing the SMTP code yourself if
you cant find an example somewhere else.
However this has nothing to do with Perl.
>The PERL equivalent of what I want to do goes something like this and I
>need to know how I would express the first line of this in visual basic,
>as I assume the 'print MAIL "Subject: ";' is equal to 'Send ("Subject: ")
>in VB.
>
Send() is not a VB function. It will be implemented by whatever
module you are using to help with you CGI. The handling of STDIN &
STDOUT will be completely different. (and so on and so forth).
/J\
Jonathan Stowe
See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
------------------------------
Date: Tue, 21 Apr 1998 00:55:28 GMT
From: ender@mythen.ch
Subject: how to change password in netscape webserver with a CGI?
Message-Id: <353be8d0.899883@news.unisource.ch>
Hi All
We have many users defined in a Netscape Enterprise Server 2.0
Database. Now the maintenance takes a lot of time and only the server
administrator can change user data.
It would be very useful if users could change their passwords by
themselves over the Web or if some users would be able to create new
user accounts.
Does anyone know how to implement this with a CGI in Perl?
Thanks in advance.
Josi
------------------------------
Date: 21 Apr 1998 01:20:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how to change password in netscape webserver with a CGI?
Message-Id: <6hgs82$pp1$1@comdyn.comdyn.com.au>
In article <353be8d0.899883@news.unisource.ch>,
ender@mythen.ch writes:
> Hi All
>
> We have many users defined in a Netscape Enterprise Server 2.0
> Database. Now the maintenance takes a lot of time and only the server
> administrator can change user data.
> It would be very useful if users could change their passwords by
> themselves over the Web or if some users would be able to create new
> user accounts.
> Does anyone know how to implement this with a CGI in Perl?
Probably the same way as a CGI in any other programming language, or
possibly harder. We have no idea where your user database lives, or
what sort of format it is in (Netscape servers allow various formats,
from dbm to LDAP services). You should find out how your database is
stored. You could ask on a netscape server specific group, and check
your configuration files.
Now, for changing passwords over the Web... I believe that there have
been several threads the last few weeks about that. I believe that
Bill 'Sneex' Jones has answered a lot of them. You would probably be
best served by doing a search on www.dejanews.com to find out an
answer to that.
You will need:
- A way to interface between perl and whatever your user database is
- CGI.pm
- A notion of security (read the perlsec documentation)
- The right permissions to update the stuff from a CGI script, or run
something suid (again, see the perlsec documentation)
Without more information, we really can't help you. Sorry.
If you come back with more questions, please make sure that they are
about perl. Not about the Netscape server, not about CGI, but about
perl.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 20 Apr 1998 12:38:00 -0700
From: abby@ucan.foad.org (Abby Franquemont)
Subject: Re: How to create a new file?
Message-Id: <6hg86o$bnf$1@ucan.foad.org>
In article <01bd6c90$ae722ad0$8eeb42cf@priscilla>,
Matthew Bell <mbell@thedomaingroup.com> wrote:
>I'm a Perl newbie, writing my first script on Perl for NT. How do I create
>a new file? Here's a snippet of my code:
>
>open(CURRFILE,$ARGV[0]) or die "\nUnable to open $ARGV[0] -- $!\n";
># opens existing file
>
># code section here that correctly defines $NewFN
>
>open(NEWFILE,$NewFN) or die "\nUnable to create $NewFN -- $!\n";
># I was expecting this would create a new file in the current directory,
>but I get a "no such file or directory" error. I can't find any reference
>to a "file create" or a relevant "new(filename)" function. Can someone
>help? Thanks.
I'm sure some helpful soul will correct me if I"m wrong, but you're
using the exact same kind of open. There are multiple ways to open a
file handle -- for input, for output, for both... your second example
is using the exact same syntax as your first example, so they would
do the same thing: open a file to read it in. To open a new file,
which you're going to write to, you would need to use:
open(NEWFILE, ">$NewFN");
or, to open an existing file to append to it:
open(NEWFILE, ">>$NewFN");
The first creates a file where it has not existed, the second adds
to an existing file, same as if you're using those redirects from
your average UNIX shell.
In your example, open(NEWFILE, $NewFN), what happens is it looks for
the file defined as $NewFN and tries to read it in, failing when no
such file is found, rather than when it is unable to write that file.
To save you one other possible gotcha, remember to clean up any temp
file you write at the end of the script[1], so you don't run into a
problem because the file does exist and you don't want it to, when
you try to run your script more than once.
[1] or whenever you don't need it anymore
--
Abby Franquemont Nothing cures insomnia like the realization
J. Random BOFH that it's time to get up. --Fortune program
------------------------------
Date: 20 Apr 1998 23:44:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to create a new file?
Message-Id: <6hgmkl$p4t$5@comdyn.comdyn.com.au>
In article <01bd6c90$ae722ad0$8eeb42cf@priscilla>,
"Matthew Bell" <mbell@thedomaingroup.com> writes:
> open(NEWFILE,$NewFN) or die "\nUnable to create $NewFN -- $!\n";
> # I was expecting this would create a new file in the current directory,
> but I get a "no such file or directory" error. I can't find any reference
> to a "file create" or a relevant "new(filename)" function. Can someone
> help? Thanks.
You need to read some documentation, specifically about the open() function:
# perldoc -f open
[snip]
If the filename begins with '<' or nothing, the file is opened for input.
If the filename begins with '>', the file is truncated and opened for
output. If the filename begins with '>>', the file is opened for
appending.
[snip]
So, if the filename starts with '>', the file will be created if it
doesn't exist, truncated to zero length if it does exist, and opened
for writing.
open(CURRFILE, ">$NewFN") || die "Cannot create $NewFN: $!";
Also, read the following:
# perldoc perlfaq
# perldoc perlfaq5
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: 20 Apr 1998 19:23:38 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: Re: How to create a new file?
Message-Id: <6hg7bq$t0a$1@aurwww.aur.alcatel.com>
On 20 Apr 1998 19:12:22 GMT, Matthew Bell <mbell@thedomaingroup.com> wrote:
->I'm a Perl newbie, writing my first script on Perl for NT. How do I create
->a new file? Here's a snippet of my code:
You read the documentation for "open", apparently. Might I suggest
that you read it again -- therein lies the answer.
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: Mon, 20 Apr 1998 12:15:55 -0500
From: Jim Harrison <j_harrison1@ti.com>
Subject: How to get clock ticks or calculate elapsed time less than a second
Message-Id: <353B82CA.3E23DFD@ti.com>
Is there a perl function that will return the clock ticks like the C
function times?
The perl times only returns the 4 cpu values, but neglects the ticks.
Maybe there is another fuction that will let me calculate time in units
lower than a second.
------------------------------
Date: Mon, 20 Apr 1998 14:26:09 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to get clock ticks or calculate elapsed time less than a second
Message-Id: <comdog-ya02408000R2004981426090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <353B82CA.3E23DFD@ti.com>, Jim Harrison <j_harrison1@ti.com> posted:
> Is there a perl function that will return the clock ticks like the C
>function times?
have you looked at the Time::* modules?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 20 Apr 1998 03:53:11 GMT
From: b39ast@nontri.ku.ac.th (Apisilp Trunganont)
Subject: How to insert <a href> using regexp?
Message-Id: <6hegr7$9do$1@news.ku.ac.th>
I have this string.
"Please visit my homepage at http://www.abc.com"
How can I use regexp to change it to...
"Please visit my homepage at
<a href=http://www.abc.com>http://www.abc.com</a>"
------------------------------
Date: Mon, 20 Apr 1998 01:05:30 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to insert <a href> using regexp?
Message-Id: <comdog-ya02408000R2004980105300001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6hegr7$9do$1@news.ku.ac.th>, b39ast@nontri.ku.ac.th (Apisilp Trunganont) posted:
>I have this string.
>"Please visit my homepage at http://www.abc.com"
>How can I use regexp to change it to...
>"Please visit my homepage at
><a href=http://www.abc.com>http://www.abc.com</a>"
Tom C. has a script called 'urlify' in his regex tutorial at
<URL:http://www.perl.com/CPAN/doc/FMTEYEWTK/regexps.html>
does just what you want.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 20 Apr 1998 05:00:41 GMT
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: How to insert <a href> using regexp?
Message-Id: <6hekpn$6ce@flatland.dimensional.com>
b39ast@nontri.ku.ac.th (Apisilp Trunganont) writes:
> I have this string.
> "Please visit my homepage at http://www.abc.com"
> How can I use regexp to change it to...
> "Please visit my homepage at
> <a href=http://www.abc.com>http://www.abc.com</a>"
"Give a man a regexp and he matches for a day.
Teach a man to write a regexp and he matches for a lifetime."
Check out the perlre manual page on your system or at:
http://www.perl.com/CPAN/doc/manual/html/pod/perlre.html
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Mon, 20 Apr 1998 15:01:39 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How to insert a \n each...
Message-Id: <ErpwEr.70M@world.std.com>
greene@gucc.org writes:
>However, I've tried benchmarking $& vs $1 and don't see a significant
>difference on my WinNT machine (Perl 5.004 binary distribution). Is this true
>only because the regex is small and simple?
Benchmarking the effects $& can be tough. Once the perl sees a $& when
parsing a script, it spoils _every_ regular expression match and
subsitution in the _entire_ execution of the script.
Did you use the $& and $1 matches in the same script? Because in this
case, the $& will contaminate the match that uses $1.
--
Andrew Langmead
------------------------------
Date: 20 Apr 1998 17:12:16 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: How to load the module with calculated name?
Message-Id: <6hfvlg$iep$1@boco.fee.vutbr.cz>
Hi everybody,
Please, how can I load the module when its name was calculated (read
from the input text file into a variable). The module is placed in
the subdirectory which was also calculated (it is not in @INC).
My solution up to now is:
require "$directory/$module.pm";
eval "$module\::function()";
where $directory and $module are variables. I do "use strict" and I want
to keep the strict mode.
Does any other better solution exist? It seem that my solution shows
some problems. I did not find why, but "die" called from inside
$module::function() does not write anything to the output. I am using
Ilya Zakharevich port of Perl 5.004_01 for OS/2 under Windows'95
(but I do not expect the difference in other 5.004 Perls).
Thanks,
Petr
--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz) http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering; tel. +420-(0)5-7275 218
------------------------------
Date: Tue, 21 Apr 1998 14:39:54 -0700
From: root of all evil <rafi@flashpoint.com>
Subject: Re: How to post to phtml?
Message-Id: <353D122A.AECCFAB5@flashpoint.com>
This person is using eperl. I can't seem to remember where to find the
program, but it behaves just like PHP. Everything in the phtml file that
begin with <? until !> gets interpreted by eperl as a perl app.
Apisilp Trunganont wrote:
>
> I found one web page (http://www.paclink.co.th/phtml/send.phtml)
> that use phtml. Could you tell me please what is phtml? And this site has
> CGI form that post data to http://www.paclink.co.th/phtml/send.phtml. I am
> so confuse, phtml can be both HTML file and CGI file? I try to post using
> my Perl script as I show below, but it doesn't work. Please tell me what
> should I do?
------------------------------
Date: Mon, 20 Apr 1998 19:39:37 GMT
From: info@rwx.net (michael)
Subject: http://www.rwx.net
Message-Id: <353ba29c.9530138@news.rotterdam.luna.net>
Read Write Execute, located in the Netherlands, invites you
to our new website: http://www.rwx.net
Here you will find over 600 computer components! Please have
a look and drop us a line with your comments or questions to:
info@rwx.net
The site is still being expanded - let us know what you would
like to see on the site :)
thank you for your time,
michael
RWX-Team
------------------------------
Date: Mon, 20 Apr 1998 17:49:28 GMT
From: stevenchan69@hotmail.com (LM386)
Subject: Image can view but cannot download?
Message-Id: <353b89a0.1412664@news.hknet.com>
Image can view but cannot download?
how is the technique to make it possible?
i find that there are some site on the net using this technology,
but it is very mystery to me,
the WWW browser should only receive the right content-type header to
display the image correctly,
if the WWW browser know the content-type is image,
it should be downloadable thought the right click mouse button,
so...
how do those people make this real?!
pls tell me
very thanks!!!
------------------------------
Date: Mon, 20 Apr 1998 14:22:24 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Image can view but cannot download?
Message-Id: <comdog-ya02408000R2004981422240001@news.panix.com>
Keywords: from just another new york perl hacker
In article <353b89a0.1412664@news.hknet.com>, stevenchan69@hotmail.com (LM386) posted:
>Image can view but cannot download?
>how is the technique to make it possible?
if you can see it you can download it. the LWP module makes this
an even easier thing to do.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
i'm not a browser, but i play one in telnet.
------------------------------
Date: 20 Apr 1998 23:35:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Image can view but cannot download?
Message-Id: <6hgm4e$p4t$3@comdyn.comdyn.com.au>
In article <353b89a0.1412664@news.hknet.com>,
stevenchan69@hotmail.com (LM386) writes:
> Image can view but cannot download?
> how is the technique to make it possible?
> i find that there are some site on the net using this technology,
> but it is very mystery to me,
> the WWW browser should only receive the right content-type header to
> display the image correctly,
> if the WWW browser know the content-type is image,
> it should be downloadable thought the right click mouse button,
> so...
> how do those people make this real?!
> pls tell me
> very thanks!!!
I am not entirely clear about what you are trying to say, but it is
clear that this is not a perl question. Your mention of 'images'
and 'WWW browser' lead me to believe that you will have a lot more
chance on success if you ask this same question (maybe slightly
reworded) on one of the comp.infosystems.www.* groups.
This group is for discussions about Perl issues. This group is not for
discussions about www issues, not even if there is perl involved.
Please don't confuse the task with the language used.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Tue, 21 Apr 1998 06:01:51 GMT
From: drahcirr@netcom.com (Rich Gibson)
Subject: Interesting (?) file programming issue
Message-Id: <drahcirrErr233.37t@netcom.com>
If you write to a file, and then read from it as stdin, the read will not
read all that the write wrote.
Assume:
--
#!/usr/bin/perl -w
$cntout=0;
$cntin=0;
open TEST, ">testfile.txt" or die "blah blah blah";
for ($i=0;$i<1000;$i++){
$cntout++;
print TEST "Data $i\n";
}
while (<>){
$cntin++;
}
print "cntout=$cntout cntin=$cntin\n"
=cut
Then call it as:
test.pl < testfile.txt
...cntout and cntin are not the same...
If you close TEST between the write and read loops everything is cool.
------------------------------
Date: Tue, 21 Apr 1998 20:25:08 GMT
From: drahcirr@netcom.com (Rich Gibson)
Subject: Re: Interesting (?) file programming issue
Message-Id: <drahcirrErs61w.76B@netcom.com>
This is all totally cool! To tell the truth, I was completely surprised
that it would work at _all_, to write to a file that was redirected via
standard in...
Perl is great, and great fun!
Tom Phoenix (rootbeer@teleport.com) wrote:
: On Tue, 21 Apr 1998, Rich Gibson wrote:
: > If you write to a file, and then read from it as stdin, the read will not
: > read all that the write wrote.
: ..If and only if there's an unflushed buffer, of course. Check out
: perlvar's description of the magical $| variable.
: --
: Tom Phoenix Perl Training and Hacking Esperanto
: Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 21 Apr 1998 16:27:27 +1000
From: crn@nellie.bby.com.au (Clive Newall)
Subject: Re: Interesting (?) file programming issue
Message-Id: <v5zphfn0z4.fsf@nellie.bby.com.au>
File buffering. Add the following after the open:
select TEST ; $| = 1 ; select STDOUT ;
or.... you could close TEST after you finish writing to it...
In article <drahcirrErr233.37t@netcom.com> ,
drahcirr@netcom.com (Rich Gibson) writes:
If you write to a file, and then read from it as stdin, the read will not
read all that the write wrote.
Assume:
--
#!/usr/bin/perl -w
$cntout=0;
$cntin=0;
open TEST, ">testfile.txt" or die "blah blah blah";
for ($i=0;$i<1000;$i++){
$cntout++;
print TEST "Data $i\n";
}
while (<>){
$cntin++;
}
print "cntout=$cntout cntin=$cntin\n"
=cut
Then call it as:
test.pl < testfile.txt
...cntout and cntin are not the same...
If you close TEST between the write and read loops everything is cool.
--
Clive Newall <crn@bby.com.au> / Broker Services Australia Ltd Melb Australia
"I think Casper is the ghost of Richie Rich. I wonder how Richie died?"
"Perhaps he realized how hollow the pursuit of money is and took his own life"
--Bart and Lisa Simpson
------------------------------
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 2382
**************************************