[18222] in Perl-Users-Digest
Perl-Users Digest, Issue: 390 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 1 18:06:01 2001
Date: Thu, 1 Mar 2001 15:05:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983487919-v10-i390@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Mar 2001 Volume: 10 Number: 390
Today's topics:
A few questions came up! <fabianos@telia.com>
Re: Date formatting (Peter J. Acklam)
Re: dereferencing an array of references using join <joeykid6@yahoo.com>
Re: Display Delay in Perl? (Gwyn Judd)
Re: Display Delay in Perl? (Craig Berry)
Re: extracting e-mail addresses from text file database <steevedu@mondenet.com>
Re: File locking problem? <flavell@mail.cern.ch>
Re: File locking problem? <flavell@mail.cern.ch>
Re: File locking problem? <billk@cts.com>
Re: Guidance on printed output <mjcarman@home.com>
Re: Here is the script i'm working on = internal server <krahnj@acm.org>
Re: How the CLPM turns <bmb@ginger.libs.uga.edu>
Re: Need help with an array... <micah@cowanbox.com>
Re: not sure to post it here <lmoran@wtsg.com>
Re: Perl CGI.pm RESET problem (BUCK NAKED1)
Please help - Find files recursively by File::Find <cub@lukebsd.com>
Re: problem with mkdir <godzilla@stomp.stomp.tokyo>
Re: problem with mkdir <ah@datapharm.de>
Re: problem with mkdir <wo_ah_ho@yahoo.com>
Re: problem with mkdir <wo_ah_ho@yahoo.com>
Re: problem with mkdir <godzilla@stomp.stomp.tokyo>
Re: problem with mkdir (Joe Smith)
Re: problem with mkdir (Joe Smith)
Re: problem with mkdir <godzilla@stomp.stomp.tokyo>
Problem with Regular Expression Match <garcia868@yahoo.com>
Re: problem with {q}? <micah@cowanbox.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 01 Mar 2001 20:10:28 GMT
From: "Fabian" <fabianos@telia.com>
Subject: A few questions came up!
Message-Id: <U0yn6.16195$Qb7.2642304@newsb.telia.net>
I've changed it some. This script is suppose to delete e-mail addresses via
the form.
However: I suupose I've created a log call with this BEGIN { open (STDERR,
">>myprog-log") }. How can I wiew the logfile. What do you mean with
strict. =- $email is the data from the form..
Fabian
#!/usr/bin/perl -w
BEGIN { open (STDERR, ">>myprog-log") }
my $file = '/home/kalas/www/mail.htm';
open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
flock (FILE, 2) or die "cannot lock file exclusively: $!";
my @emailfile = <FILE>; # read it into @emailfile
seek FILE, 0, 0; # move to the beginning of the file and then
truncate FILE, 0; # remove all content from it
foreach $line (@emailfile)
{
if ($line !~ /^\Q$email/o)
{
print FILE $line; # we don't need a newline, since the file had them
when we read it into memory.
}
}
close (FILE) or die "cannot close message file: $!";
open (FILE, "<$file") or die "cannot open file for appending: $!";
> Try running with -w and use strict. =-) (Where does $email come
> from?)
>
> One tactic I find useful for debugging CGI scripts is to:
>
> BEGIN { open (STDERR, ">>myprog-log") }
>
> . . . so the 'internal server errors' aren't so mysterious.
>
> Hope this helps,
>
> Bill
>
>
> > my $file = "/home/kalas/www/mail.htm";
> > open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
> > flock (FILE, 2) or die "cannot lock file exclusively: $!";
> > my @emailfile = <FILE>;
> > seek FILE, 0, 0;
> > truncate FILE, 0;
> >
> > foreach $line (@emailfile)
> > {
> > if ($line !~ /^\Q$email/o)
> > {
> > print FILE $line; # we don't need a newline, since the file had
them
> > when we read it into memory.
> > }
> > }
> >
> > close (FILE) or die "cannot close message file: $!";
> >
> >
> >
> > This is the form:
> >
> > <html>
> >
> > <head>
> > <meta http-equiv="Content-Type"
> > content="text/html; charset=iso-8859-1">
> > <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
> > <title>Email Address:</title>
> > </head>
> >
> > <body>
> >
> > <form action="../cgi-kalas/remove.pl" method="POST">
> > <p>Email Address: <input type="text" size="20" name="address">
> > </p>
> > <input type="submit" value="Skicka">
> > </form>
> > </body>
> > </html>
> >
> >
>
>
------------------------------
Date: 01 Mar 2001 22:44:16 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Date formatting
Message-Id: <wkzof5yxoa.fsf@math.uio.no>
nmihai_2000@yahoo.com (Mihai N.) writes:
> Yes, I have read the original posting. I don't want to argue,
> but the limited view gives you trouble on the long run. You
> develop something today, is a great success, and 2 months from
> now the marketing comes and says "I want this for Europe".
Yeah, I see your point. However, while generalizing the code and
moving to a higher level of abstraction is a good thing, it often
requires more work. And you've got to draw the line somewhere.
If one doesn't have the time (or skills) to make a great and
general module, and that quick hack really is all one needs right
now, one might be better off just leaving it at that.
Peter
--
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!
------------------------------
Date: Thu, 1 Mar 2001 14:45:43 -0500
From: "Joe Williams" <joeykid6@yahoo.com>
Subject: Re: dereferencing an array of references using join
Message-Id: <97m92d$jb5$1@slb2.atl.mindspring.net>
Thanks for your patience, Tad. I hope you'll read my second response to
Anno, which I've pasted in just below. It may clarify even further.
Joe
You know what, Anno, the more I think about it, you're absolutely right.
That was a rotten thing to say. I've responded to lots of questions on
newsgroups before, and I know it takes time and energy. All the people who
responded to me were willing to give that time and energy, and my comment
ignoerd that. Also, as I read over the posting that originally annoyed me,
I realize that it wasn't condescending in the way I thought. I guess I was
just having a lousy day.
Thanks for the eye-opener.
Joe
Tad McClellan <tadmc@augustmail.com> wrote in message
news:slrn99shhl.l7k.tadmc@tadmc26.august.net...
>
> [ Please put your comments *following* the quoted text that you
> are commenting on, as is the convention here. Thanks.
>
> Jeopardectomy performed.
> ]
>
>
> Joe Williams <joeykid6@yahoo.com> wrote:
> >Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> >news:97ik65$1d7$1@mamenchi.zrz.TU-Berlin.DE...
> >> According to Joe Williams <joeykid6@yahoo.com>:
> >> > Thanks, Ren. For some reason, I thought I tested without the quotes
and
> >got
> >> > an error. You win for the most concise code and the least impatient
> >> > response....
> >>
> >> Do you realise how arrogant that sounds?
>
> >Sorry, didn't mean to be arrogant. One of the responses I got told me to
> >keep useless stuff out of my code, which just struck me the wrong way
>
>
> Keeping useless stuff out of your code makes your code better,
> for the reason given with the original comment.
>
>
> >since
> >I'd mentioned I was new to programming perl.
>
>
> New Perl programmers want better code too.
>
> How does being new to Perl have an effect on the
> applicability of the comment?
>
> I cannot find anything impatient in my followup.
>
>
> >No offense meant.
>
>
> I'll take your address back out then.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 01 Mar 2001 19:58:16 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Display Delay in Perl?
Message-Id: <slrn99tap4.3cp.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDCCXXXIX
>September MCMXCIII in <URL:news:97lb5c$7st$2@mamenchi.zrz.TU-Berlin.DE>:
>// Gee, you can give this special twist to just any program. What if
>// you want a two-second delay? Oh, I know, override print().
>
>perl -we '$| = 1; map {sleep sleep print} "Hello" =~ /./g'
alternatively:
perl -we '$| = 1; map {sleep 2*print} "Hello" =~ /./g'
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
What the fuck, over?
------------------------------
Date: Thu, 01 Mar 2001 22:11:29 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Display Delay in Perl?
Message-Id: <t9ti8h7er20159@corp.supernews.com>
Ranjithalingam Camalalingam (ranch@lager.engsoc.carleton.ca) wrote:
: How do i delay print an output?(in monitor)
: say i want to print "Hello World!";
:
: I want each letter in "Hello World" to appear after 1 second delay.
#!/usr/bin/perl -w
# slowecho - echoes arguments to stdout at 1cps.
# Craig Berry (20010301)
use strict;
my @chars = split //, join ' ', @ARGV;
local $| = 1;
foreach (@chars) {
print;
sleep 1;
}
print "\n";
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Thu, 01 Mar 2001 21:03:12 GMT
From: "Steeve Duchesne" <steevedu@mondenet.com>
Subject: Re: extracting e-mail addresses from text file database
Message-Id: <kOyn6.9453$f5.894269@news>
Here's an example of a text file:
name@something.com Mike Price 25years old 453 455 6045 Mushroom
Potatoes
name2@somethin.com Paul Green 19years old 654 324 4544 Celery
If the file is 100 lines long and I want to have information Paul Green, how
do I search for it in the text file from a script
Thanks in advance
Tom Scheper <tom@power.net.uk> a écrit dans le message :
9ths9tg4t237dubuo989sasdpef89hr57c@4ax.com...
> On Thu, 01 Mar 2001 12:55:14 GMT, "Steeve Duchesne"
> <steevedu@mondenet.com> shed a beam of light on us:
>
> >Hello everybody,
> >
> >I want to dynamically populate a simple text file database from entries
in a
> >form using Perl. This file will contain e-mail addresses, names and other
> >types of data. The information will be kept as lines separated by tabs or
> >pipes. My question is: Is there a simple way of extracting e-mail
addresses
> >without extracting all the other data? Also, lets say that the e-mail
> >addresses are placed at the beginning of each line. Is it possible to
> >extract the information that comes with a particular address, if so how
can
> >I get my program to do this?
>
> It is, but can you post a few sample lines from the database text
> file?
>
> -=Cornelis
------------------------------
Date: Thu, 1 Mar 2001 20:03:20 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: File locking problem?
Message-Id: <Pine.LNX.4.30.0103012002260.4620-100000@lxplus003.cern.ch>
On Thu, 1 Mar 2001, Steve Wells wrote:
> flock(C, LOCK_UN);
> close(C);
You're at it too.
Oh, an upside-down fullquoter. Figgers. (score adjusted)
------------------------------
Date: Thu, 1 Mar 2001 20:15:31 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: File locking problem?
Message-Id: <Pine.LNX.4.30.0103012005360.4620-100000@lxplus003.cern.ch>
On Thu, 1 Mar 2001, Bill Kelly wrote:
> - Or, I just had a thought: . . . This relates to the flushing
> of the writes to the file? . . .
Bingo
> Thing is, I learned how to use flock() by reading the
> perlfunc docs. . . . Which explicitly state that flock()
> handles the flush. . . .
As I said before, "recent versions of Perl...".
> - How did you find out about this? =)
I read comp.lang.perl.misc for a while ;-)
And checked Perlfaq5:
(print FH $num+1, "\n") or die "can't write numfile: $!";
# DO NOT UNLOCK THIS UNTIL YOU CLOSE
close FH or die "can't close numfile: $!";
> - Guess: you grew up with versions of flock() that don't handle
> flushing the file?
OK, so sue me - when I said it was "wrong" I should have said that
it's now only "pointless" to unlock immediately before close, and that
it used to be "wrong".
--
This .sig only acknowledges that the message was displayed on
the recipient's machine. There is no guarantee that the
content has been read or understood.
------------------------------
Date: Thu, 01 Mar 2001 20:05:56 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: File locking problem?
Message-Id: <EYxn6.100287$GV2.22700006@typhoon.san.rr.com>
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Thu, 1 Mar 2001, Bill Kelly wrote:
>
> > - Guess: you grew up with versions of flock() that don't handle
> > flushing the file?
>
> OK, so sue me - when I said it was "wrong" I should have said that
> it's now only "pointless" to unlock immediately before close, and that
> it used to be "wrong".
My statement wasn't meant to be judgemental in its tone - sorry if
it came out that way. Thanks for your responses. I have learned
something in this thread - besides the flock stuff - which is the
idea that I should check the perlfaq stuff more proactively,
perhaps. So far I've looked in there only when I've actually had
a "question" . . . but I suspect I could learn a lot of worthwhile
tidbits just by browsing the FAQs once in awhile. :-)
Thanks,
Bill
------------------------------
Date: Thu, 01 Mar 2001 16:26:09 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Guidance on printed output
Message-Id: <3A9ECC81.D1C2795A@home.com>
Kathy wrote:
>
> 1) I've seen some documentation on how to force page breaks in a web
> page, to for example count lines and when you reach them do a
> forced pagebreak by using a style command of
>
> <P STYLE="page-break-after: always">
>
> So I wrote a perl script to format the directory as a web page output
> with this style command in there, and I haven't seen this do anything
> at all, doesn't page break at all
This has nothing to do with Perl. It's an HTML thing, and I suspect that
it's a browser-specific extension at that. If you take this approach,
you'll want to go to an HTML group and ask how to force page breaks in
printed output.
For the rest, I'm assuming that you want to generate formatted text from
Perl, and that no CGI is involved.
> 2) Use perl format. However, I don't see any way you can make
> double-columned format lines for output. Am I missing something?
As in the Perl format/write syntax? Yes, you can do columns. See the
perlform manpage.
What do you mean by columns anyway? Do you mean that if you had a list
(1..10) you'd print it like this?
1 4 7
2 5 8
3 6 9
If so, then buy/beg/borrow a copy of the Cookbook and look at recipe
4.18.
And of course, there's always [s]printf().
Tell us what the input and output should look like, and it making Perl
format it nicely becomes a trivial problem.
-mjc
------------------------------
Date: Thu, 01 Mar 2001 22:02:03 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Here is the script i'm working on = internal server error
Message-Id: <3A9EC82F.961FAC9@acm.org>
"Fabian Thorbjörnsson" wrote:
>
> This is the script:
>
> #!/usr/bin/perl
>
> my $file = "/home/kalas/www/mail.htm";
> open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
^^
You are opening the file for output and are then trying to read from it.
This won't work.
open FILE, "<" . $file or die "cannot open $file for input: $!";
> flock (FILE, 2) or die "cannot lock file exclusively: $!";
> my @emailfile = <FILE>;
> seek FILE, 0, 0;
> truncate FILE, 0;
>
> foreach $line (@emailfile)
> {
> if ($line !~ /^\Q$email/o)
> {
> print FILE $line; # we don't need a newline, since the file had them
> when we read it into memory.
> }
> }
>
> close (FILE) or die "cannot close message file: $!";
John
------------------------------
Date: Thu, 1 Mar 2001 14:38:46 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: How the CLPM turns
Message-Id: <Pine.A41.4.21.0103011433270.15630-100000@ginger.libs.uga.edu>
On Thu, 1 Mar 2001 bernard.el-hagin@gdndev25.dev.lido-tech wrote:
> >While I'm at it, I'd like to thank Martien, Uri, nobull, Randal,
> >Anno, Abigail, and Ilmari for helping me grow as a Perl programmer.
>
> The people you mentioned, along with Tad McClellan, Larry Rosler, brian
> d foy, Mark-Jason Dominus, Bart Lateur, and a plethora of others on this
> group are directly responsible for 90% of my Perl knowledge so anytime I
> see someone criticise this newsgroup I just don't get it.
Neither do they. Being clueless implies that you don't know you are.
I speak from personal experience. :-)
By the way, I tried Abigail's sort routine and it's not working.
What am I doing wrong?
Brad
------------------------------
Date: 01 Mar 2001 14:25:25 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: Need help with an array...
Message-Id: <yu866htktyi.fsf@mcowan-linux.transmeta.com>
u678619384@spawnkill.ip-mobilphone.net writes:
> I have an array that looks like:
>
> $webhost = 'app2.exactone.net';
> $webpage[0] =
> '/servlet/ApparelKeySearch?xaction=%2Fservlet%2FApparelKeySearch&iqformat=xml&
> iqdtdtype=0&site=spreexml&keywords=' .$key.
> '&logic=0&Submit=Submit+Query&maxpersite=1&maxtotal=100&pagesize=9999';
> $webpage[1] =
> '/servlet/AuctionKeySearch?xaction=%2Fservlet%2FAuctionKeySearch&iqformat=xml&
> iqdtdtype=0&site=spreexml&keywords=' .$key.
> '&logic=0&Submit=Submit+Query&maxpersite=1&maxtotal=100&pagesize=9999';
>
> but, it goes up to $webpage[21], and I'm trying to call it like this:
>
> $PageUrl = 'http://' . $webhost . @webpage[0..21];
> $rqst = HTTP::Request->new('GET', $PageUrl);
>
> which is working only for the last URL ($webpage[21]).
That's exactly what the code you wrote ought to do.
If what you want is a result of 22 different URLs, then
@result = map { 'http://' . $webhost . $_ } @webpage;
ought to do for you. If 0..21 is all the elements in @webpage, you
can simply drop that [] suffix.
You might also find:
foreach my $webpage (@webpage) {
my $url = 'http://' . $webhost . $webpage;
$rqst = HTTP::Request->new('GET', $PageUrl);
# do something with $rqst
}
helpful
> Can anyone tell me how
> to get it to do all of the webpage's?
>
> Also... It's returning all of the content in XML, does anyone know how to just
> get it return Apparel or Auction if there's content? Rather than all of the
> actual content. Thanks so much in advance...Janet (please send
> reply to jgs2283@hotmail.com since I don't check newsgroups too
> often...) Thanks!
Check the newsgroups if you post here. That's what we're here for.
I really don't understand what you're trying to achieve. Why are you
using HTTP::Request if you don't want content? And what do you mean
you want it to return something /if/ there's content? If you're
trying to see if there's an auction based on some keywords or
something, there's /always/ going to be content - you will need to
find a way to /parse/ the content to determine whether or not there
were keyword matches.
HTH,
Micah
------------------------------
Date: Thu, 01 Mar 2001 15:42:23 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: not sure to post it here
Message-Id: <b0dt9tsid43stu86c83o6ute78djntv42u@4ax.com>
On 28 Feb 2001 23:16:04 +0000, nobull@mail.com wrote wonderful things
about sparkplugs:
>
>[snip question in no way shape or form even remotely related to Perl ]
>
>You may just as well have asked about how to cook oysters. Oysters
>contain pearls. "Pearl" sounds like "Perl". So questions about oyster
>cooking are on-topic, surely?
about the oysters though...
--
"> thanks in advance !!!
If you are going to do anything 'in advance' it should be RTFM."
--swiped from a nobull clp.misc post
Lou Moran <lmoran@wtsg.com>
------------------------------
Date: Thu, 1 Mar 2001 15:24:55 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl CGI.pm RESET problem
Message-Id: <2900-3A9EBE27-2@storefull-248.iap.bryant.webtv.net>
Thanks again Joe,
I appreciate the HTML tips. I had planned on changing that later. Now to
the heart of the problem...
I took override=> out of the textfield
and changed defaults to one parameter like so...
$query->defaults('RESET'); and it still gives me the script URL when you
hit the RESET button.
I might could do a hack if I could figure out what preset var is calling
out the script URL... but after reviewing perlvar, I tried doing $0=''
and $_='' and that still didn't change the script URL.
I also tried the advanced techniques example from CGI.pm... that uses
subs to save and restore status, and that didn't work either.
I've written Lincoln Stein about this. First time, I felt the need to
write an author. Maybe he'll tell me what I'm doing wrong.
--Regards,
Dennis
------------------------------
Date: Thu, 1 Mar 2001 17:22:08 -0500
From: Luke <cub@lukebsd.com>
Subject: Please help - Find files recursively by File::Find
Message-Id: <MPG.1508959f14f5185f9896a5@emcnews1.lss.emc.com>
I'm trying to find all the .log files recursively within a big directory.
I already got it working with this:
use File::Find;
find(\&wanted,"$root_dir");
sub wanted {
$names{$File::Find::name}++ if /\.log$/;
}
Now I'd like to list only the .log files that are 4 days old. How do I
go for doing this?
Any help is appreciated,
Luke H.
------------------------------
Date: Thu, 01 Mar 2001 12:30:45 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: problem with mkdir
Message-Id: <3A9EB175.7004F30@stomp.stomp.tokyo>
Jason Wong wrote:
> I tried to create a directory in a remote machine
> (web hosting folder) using the following codes,
> which works fine on my own computer:
You cannot create files nor directories on a
remote machine without direct access such as
telnet, ftp, a script installed within this
remote machine or other similar devices.
> #!/usr/bin/perl
> #testdir.pl
> require "cgi-lib.pl";
> &ReadParse;
> $newdir = "E:/Inetpub/wwwroot/wsc/eng/bmcwest/cgi-bin/testing";
> mkdir $newdir;
> but i got this error:
(snipped)
There is nothing within your example indicating a need
for cgi-lib nor a need for a read and parse. Your comments,
as well, do not indicate a need for this.
You indicate you are running this as a cgi script.
A return of a content type is a minimal must, as
displayed by my test script below my signature.
Godzilla!
--
#!perl
print "Content-type: text/plain\n\n";
$newdir = "E:/Inetpub/wwwroot/wsc/eng/bmcwest/cgi-bin/testing";
mkdir $newdir;
if (-e "/Inetpub/wwwroot/wsc/eng/bmcwest/cgi-bin/testing")
{ print "Creation Of Directory Successful"; }
else
{ print "Creation Of Directory Unsuccessful"; }
exit;
------------------------------
Date: Thu, 01 Mar 2001 22:16:22 +0100
From: Andreas Huber <ah@datapharm.de>
To: Jason Wong <wo_ah_ho@yahoo.com>
Subject: Re: problem with mkdir
Message-Id: <3A9EBC26.821F76A0@datapharm.de>
> I tried to create a directory in a remote machine (web hosting folder) using
> the following codes, which works fine on my own computer:
>
of course, there is a way...
on NT try this
------------------------------------
#!/usr/bin/perl
my $ok = mkdir("c:/testdir",777);
print "Content-type: text/plain\n\n";
print "Hello World\n\n\n";
print $ok;
exit 0;
-----------------------------------
--
Andreas Huber
Produktion & Entwicklung
Datapharm Netsystems AG
E-Mail: ah@datapharm.de
Tel.: (+49) 89 85 68 4 -202
Fax: (+49) 89 85 68 4 -100
------------------------------
Date: Thu, 1 Mar 2001 16:25:26 -0500
From: "Jason Wong" <wo_ah_ho@yahoo.com>
Subject: Re: problem with mkdir
Message-Id: <97meq2$gmr$1@bcrkh13.ca.nortel.com>
The codes used to work when serving with Apacher Web Server (if someone is
accessing the websites, folders can be created on the my computer, Win95)
Now I try to put the scripts on a public web hosting folder (on another
server machine on the network, WinNT) which serves webpages using IIS. I
located the scripts in the proper folder so when someone try to use the
website, the script on that WinNT machine should be invoked and creates the
proper folder.
My question is why Apache works but IIS doesn't.
any idea?
------------------------------
Date: Thu, 1 Mar 2001 16:37:03 -0500
From: "Jason Wong" <wo_ah_ho@yahoo.com>
Subject: Re: problem with mkdir
Message-Id: <97mffs$h31$1@bcrkh13.ca.nortel.com>
I got 0, which means doesn't work
I think the problem may be the fact that i only have access to the shared
folders on that WinNT machine.
------------------------------
Date: Thu, 01 Mar 2001 14:15:48 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: problem with mkdir
Message-Id: <3A9ECA14.3F7B9B52@stomp.stomp.tokyo>
Jason Wong wrote:
> The codes used to work when serving with Apacher Web Server (if someone is
> accessing the websites, folders can be created on the my computer, Win95)
> Now I try to put the scripts on a public web hosting folder (on another
> server machine on the network, WinNT) which serves webpages using IIS. I
> located the scripts in the proper folder so when someone try to use the
> website, the script on that WinNT machine should be invoked and creates the
> proper folder.
> My question is why Apache works but IIS doesn't.
> any idea?
Yes, a good idea would be to decide what is your primary
problem then address this problem specifically.
This might help. Obtain an official Number 2 pencil and
a notepad. Decide what is your problem. Write this problem
down on your notepad. Pin this note to your shirt sleeve
or shirt pocket, then proceed with addressing this problem
directly and on task. Periodically, perhaps every sixty
seconds, read your pinned note to remind you of your problem
and to remind you of what you are trying to accomplish.
Doing these things will assist you in not mentally
bird walking around like a Mauritius dodo.
Godzilla!
------------------------------
Date: 1 Mar 2001 22:29:49 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: problem with mkdir
Message-Id: <97migt$2of3$1@nntp1.ba.best.com>
In article <3A9EBC26.821F76A0@datapharm.de>,
Andreas Huber <ah@datapharm.de> wrote:
>> I tried to create a directory in a remote machine (web hosting folder) using
>> the following codes, which works fine on my own computer:
>
>my $ok = mkdir("c:/testdir",777);
You've got the wrong value for the second arg to mkdir().
That should be 0777, not 777. (Octal versus decimal.)
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 1 Mar 2001 22:38:04 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: problem with mkdir
Message-Id: <97mj0c$2p7r$1@nntp1.ba.best.com>
In article <3A9EB175.7004F30@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Jason Wong wrote:
>
>> I tried to create a directory in a remote machine
>> (web hosting folder) using the following codes,
>> which works fine on my own computer:
>
>You cannot create files nor directories on a
>remote machine without direct access such as
>telnet, ftp, a script installed within this
>remote machine or other similar devices.
Godzilla is wrong.
It is possible to create subdirectories on a remote server, if the
server is set up for that type of access, and if the programmer
remembers to include the mandatory arguments on the functions that
require them.
>
>> but i got this error:
>
>(snipped)
>displayed by my test script below my signature.
The snipped part is very important.
Not enough arguments for mkdir at
E:\Inetpub\wwwroot\wsc\eng\bmcwest\cgi-bin\testdir.pl line 12, near
"$newdir;"
Execution of E:\Inetpub\wwwroot\wsc\eng\bmcwest\cgi-bin\testdir.pl aborted
due to compilation errors.
>$newdir = "E:/Inetpub/wwwroot/wsc/eng/bmcwest/cgi-bin/testing";
>mkdir $newdir;
Godzilla's example will fail for the same reason the original poster's
program failed. "Not enough arguments for mkdir".
Please re-read the manual. It says that mkdir() takes two arguments,
both of which are mandatory.
$permission = 0755; # Or $permission = 0777; leading 0 required.
if (mkdir($newdir,$permission)) {
print "Content-type: text/html\n\n<H1>OK!</H1>\n";
} else {
print "Content-type: text/plain\n\nFailed: $!\n";
}
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Thu, 01 Mar 2001 14:52:44 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: problem with mkdir
Message-Id: <3A9ED2BC.96EDB30B@stomp.stomp.tokyo>
Joe Smith wrote:
> Godzilla! wrote:
> >Jason Wong wrote:
> >You cannot create files nor directories on a
> >remote machine without direct access such as
> >telnet, ftp, a script installed within this
> >remote machine or other similar devices.
> Godzilla is wrong.
> It is possible to create subdirectories on a remote server, if the
> server is set up for that type of access, and if the programmer
> remembers to include the mandatory arguments on the functions that
> require them.
So, go over to microsoft.com and create for me,
a directory named "godzilla" then let me know
when you have accomplished this task. I will
be very impressed.
Godzilla!
------------------------------
Date: Thu, 1 Mar 2001 14:26:40 -0800 (PST)
From: J Garcia <garcia868@yahoo.com>
Subject: Problem with Regular Expression Match
Message-Id: <20010301222640.10387.qmail@web1604.mail.yahoo.com>
I am reading comments from a Web form textbox into a
$comments scalar and then wherever there is an empty
line, replacing it with <P> using the following:
$comments =~ s/^\n*$/<P>/mg;
After previewing the form, if the user chooses to make
a submission, <P> is supposed to be replaced
with <P> using the following:
$comments =~ s/(<P>)/<P>/mg;
After the record is written to a plain text
pipe-delimited database file, I check the file but do
not find any occurences of <P> in the $comments field
in the database (the blank lines inserted by the user
in the textbox should be replaced with <P> which is
what I am trying to do).
After trying everything I could think of, I have not
been able to figure why the substitution is not
working. I would really like any help I can get with
this. Any help would be greatly appreciated. Thanks a
lot.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
------------------------------
Date: 01 Mar 2001 14:12:49 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: problem with {q}?
Message-Id: <yu88zmpkuji.fsf@mcowan-linux.transmeta.com>
Micah Cowan <micah@cowanbox.com> writes:
> <To OT:>
> And if you'd been using "use strict" on a regular basis, you'd have
> written it like this anyway...
Huh! Silly, me - that's supposed to be:
<To OP:>
Who the hell said he was off-topic? I sure didn't mean to...
*Selfthwack*...
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 390
**************************************