[10644] in Perl-Users-Digest
Perl-Users Digest, Issue: 4236 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 17 00:07:25 1998
Date: Mon, 16 Nov 98 21:00:20 -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 Mon, 16 Nov 1998 Volume: 8 Number: 4236
Today's topics:
Re: [PLEASE HELP]: Eliminate spaces at end of string (Peter J. Kernan)
Re: a RE for email addresses? <rbush@up.net>
Re: Beginner Book? paulwade@my-dejanews.com
EUREKA - web-based e-mail client <jtjohnston@courrier.usherb.ca>
ftp question otmeister@worldnet.att.net
Re: ftp question (Martien Verbruggen)
Re: getting the date as a string (Erik)
Re: getting the date as a string (Martien Verbruggen)
Re: getting the date as a string <rootbeer@teleport.com>
Re: iis 4 problem with perl .... <pjhurwitz@pikeonline.net>
installing PERL on NT, IIS 4.0 (Radic96)
mod_perl for Win32 Apache <jwarner@texas.net>
Re: need help using ipc.ph <rootbeer@teleport.com>
Re: Not to start a language war but.. <zenin@bawdycaste.org>
Re: Not to start a language war but.. (Ilya Zakharevich)
Re: novice question re CGI.pm/cgi-lib.pl <zenin@bawdycaste.org>
Re: novice question re CGI.pm/cgi-lib.pl <rootbeer@teleport.com>
Re: Perl scripts as a NT service ()
Send Attachment by Perl CGI <a.amemiya@asahi-jc.com>
Re: Send Attachment by Perl CGI (Martien Verbruggen)
Re: test for.t failure due to bad rounding <rootbeer@teleport.com>
Trying to create directory! <alcazar@netcomp.net>
Re: Trying to create directory! (Martien Verbruggen)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Nov 1998 04:36:48 GMT
From: pete@localhost.localdomain (Peter J. Kernan)
Subject: Re: [PLEASE HELP]: Eliminate spaces at end of string
Message-Id: <72quh0$hfe$1@pale-rider.INS.CWRU.Edu>
In article <MPG.10ba7fed1b58dd3989717@news.scescape.net>,
dragons@scescape.net (Matthew Bafford) writes:
> #!/usr/bin/perl -w
>
> $os = "strip silly trailing spaces ";
>
> substr($os, -1, 1) = '' while substr($os, -1, 1) eq ' ';
>
> print "[$os]\n";
That is obviously the right approach, but I have abandoned that
technique altogether and have settled on
while ($os =~ /[^ ]+/g) {$i = pos $os}
$os = sprintf("%.${i}s",$os);
for production " stripping of silly trailing spaces ";-)
--
open SIG, "<$ENV{HOME}/.sig" or die "sigless! $!";
$sig = do {local $/; <SIG>}; close SIG && print<<"$sig SIG";
Pete Kernan CWRU Physics and Statistics Depts
http://theory2.phys.cwru.edu/~pete
$sig SIG
------------------------------
Date: Mon, 16 Nov 1998 22:48:33 -0500
From: Ray Bush <rbush@up.net>
Subject: Re: a RE for email addresses?
Message-Id: <3650F211.FBB@up.net>
sara starre wrote:
>
> I tried to use the /.+\@.+\..+(\..+)*/ to find good email addresses, but
> it let
> "my mail@myplace.com" thru, so I modified it to: /.+\@.+\..+(\..+)*/ &&
> !/[\s]/
>
> According to my camel book, /.+/ should be one or more characters- is
> whitespace considered a character?
>
> Does anyone have any better suggestions for RE's to validate email
> addresses? This one seems pretty good:
>
> good: mymail@mycompany.com
> bad: mymail#myplace.com
> bad: my mail@myplace.com
> bad: mymail@myplace
> good: m1ymail@my1place2.com3good:
> good: m1ymail@my1place2.mystate.com3
> bad: m1ymail@my1place2.mystate. com3
>
> HUG!
> S
> PS: Thanks for the help with my assignment question.. :)
Jeffrey Freidl has an example or two on this in his book an regular
expressions. http://enterprise.ic.gc.ca/~jfriedl/regex/code.html
------------------------------
Date: Tue, 17 Nov 1998 00:47:49 GMT
From: paulwade@my-dejanews.com
Subject: Re: Beginner Book?
Message-Id: <72qh3l$gc1$1@nnrp1.dejanews.com>
In article <3650788e.14819289@news.newsguy.com>,
jeff.kennedy@natdecsys.com (Jeff Kennedy) wrote:
> I need a book geared to an ABSOLUTE BEGINNER! No perl experience, no
> programming experience, no real shell scripting experience.
>
> What would I be looking for? Not something that assumes I know
> anything!
>
Probably something like "Perl 5 for Dummies" by Paul E. Hoffman. There are
reviews and comments as well as a table of contents for this book at:
http://www.amazon.com/exec/obidos/ASIN/0764500449/bibs/
Alternatively, something like "Programming Perl" by Larry Wall, may also be
good. I suggest you compare the reviews and comments of these 2 books and that
may help you to decide. For reviews of the Larry Wall book , the page is:
http://www.amazon.com/exec/obidos/ASIN/1565921496/bibs/
Hope this helps you,
Paul.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 16 Nov 1998 22:12:49 -0500
From: JTJ <jtjohnston@courrier.usherb.ca>
Subject: EUREKA - web-based e-mail client
Message-Id: <3650E9B1.1529@courrier.usherb.ca>
Check this ...
http://www.vejrum.dk/WWW-Mail/
Reall easy to set up too. Attachments and all
------------------------------
Date: Tue, 17 Nov 1998 02:52:57 GMT
From: otmeister@worldnet.att.net
Subject: ftp question
Message-Id: <72qoe9$mmc$1@nnrp1.dejanews.com>
I am running perl on an HP-UX system that has an ftp.pl file in the site_perl
directory. I am trying to use this file but I got the following message.
"can't locate sys/socket.ph in @inc(did you run h2ph?)(@inc --a complete
listing of all the files in @inc) at /ttg/install/lib/perl/chat2.pl line 9"
the script I am trying to run is not complete yet but I get this message when
I try to require the file. The following is the script:
#!/ttg/install/bin/perl
require "ftp.pl";
Does anybody know how to resolve this problem? Any help would be appreciated.
Thanks,
David
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 17 Nov 1998 03:36:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: ftp question
Message-Id: <Na642.130$Qs1.142@nsw.nnrp.telstra.net>
In article <72qoe9$mmc$1@nnrp1.dejanews.com>,
otmeister@worldnet.att.net writes:
> "can't locate sys/socket.ph in @inc(did you run h2ph?)(@inc --a
> complete listing of all the files in @inc) at
> /ttg/install/lib/perl/chat2.pl line 9"
It's @INC. Not @inc.
> the script I am trying to run is not complete yet but I get this
> message when I try to require the file. The following is the
> script:
>
> #!/ttg/install/bin/perl
> require "ftp.pl";
>
> Does anybody know how to resolve this problem? Any help would be
> appreciated.
ftp.pl will require sys/socket.ph, which obviously is not available on
your system. You should run h2ph to produce the file as the error
message suggests. If you don't have the priveleges to do that, contact
your admin and have them fix the problem.
# perldoc h2ph
This should have been part of the perl installation procedure.
You should probably consider using Net::FTP instead of the failry
oldish ftp.pl.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about it's friends.
NSW, Australia |
------------------------------
Date: 17 Nov 1998 01:54:16 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: getting the date as a string
Message-Id: <72ql08$uhb$1@news.cyberhighway.net>
[Posted and mailed]
In article <3650D3D5.47D457A@1185design.com>,
mikej <mikej@1185design.com> writes:
> #gets the date
> my $now = time;
This is unnecessary. Calling localtime with no argument defaults
to the current time.
> ($seconds, $minutes, $hours, $day_of_month, $month, $year,
> #$wday, $yday, $isdst) = localtime($now);
^
What is that # doing there? This won't even compile for me with that.
> $date = sprintf("\n%02d-%02d-%02d\n",$month+1,$day_of_month,$year);
You really don't want those \n's there, do you? I would imagine the
thing is trying to make a directory with \n's as part of its name, and
the filesystem gets confused by them. Take them out, and it'll work fine.
> $date = "11-16-98";
> mkdir ($date, 0777);
See? No linefeeds in $date this time, and it works...that's your problem.
HTH!
--
Erik Nielsen, Cyberhighway Internet Services NOC
I find that anthropomorphism really doesn't help me deal with hardware all
that much, because it lends a certain attitude of disdain to what would
otherwise be a mere malfunction.
-- Carl Jacobs in a.s.r.
------------------------------
Date: Tue, 17 Nov 1998 02:03:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: getting the date as a string
Message-Id: <pP442.116$Qs1.259@nsw.nnrp.telstra.net>
In article <3650D3D5.47D457A@1185design.com>,
mikej <mikej@1185design.com> writes:
> ($seconds, $minutes, $hours, $day_of_month, $month, $year,
> #$wday, $yday, $isdst) = localtime($now);
>
> $date = sprintf("\n%02d-%02d-%02d\n",$month+1,$day_of_month,$year);
>
>
> mkdir ($date, 0777);
1) You don't want the newlines in your $date variable.
2) You have a year 2000 problem
3) You should check the return code of the mkdir
4) Maybe you should have a look at the POSIX module and its strftime
function
5) If you format your date as YYYY-MM-DD it will sort much nicer. and
you avoid year 200 problems.
use POSIX;
my $date = strftime("%Y-%m-%d", localtime());
or
my @t = localtime();
my $date = sprintf("%d-%02d-%02d", $f[5]+1900, $f[4]+1, $f[3]);
If you insist on two digit years (sigh), use $f[5]%100
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Tue, 17 Nov 1998 02:41:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: getting the date as a string
Message-Id: <Pine.GSO.4.02A.9811161837590.27321-100000@user2.teleport.com>
On Mon, 16 Nov 1998, mikej wrote:
> Subject: getting the date as a string
Maybe you want a module to do this.
> I am trying to make a directory with the date as the name of the
> directory. So far I have the date formatted how I want it (MM-DD-YY),
> but when I go to make the directory, it wont create a directory. instead
> it creates something else that is not a directory and not a file.
> my $now = time;
>
> ($seconds, $minutes, $hours, $day_of_month, $month, $year,
> #$wday, $yday, $isdst) = localtime($now);
Did you mean to comment out that last line?
> $date = sprintf("\n%02d-%02d-%02d\n",$month+1,$day_of_month,$year);
Did you mean to put two newlines into $date? Have you read the docs on
localtime to know what it is (or would be) returning there?
> mkdir ($date, 0777);
Did you forget to check the return value of mkdir? Although a newline is
generally a valid character in a directory name, it's not generally an
advisable character.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 16 Nov 1998 22:33:48 -0500
From: "Pike Online, Ltd." <pjhurwitz@pikeonline.net>
Subject: Re: iis 4 problem with perl ....
Message-Id: <u$DWdtdE#GA.220@uppssnewspub05.moswest.msn.net>
George,
I upgraded my IIS 3.0 to 4.0 today to resolve an SSL problem that was
inherent with IIS 3.0. Then I got a new problem. The upgrade blew away my
ability to run perl scripts. The upgrade blew the perl mapping from the
windows NT registry & moved it to a "metabase" whatever that's supposed to
be. In the move it didn't map the perl.exe file properly and left out a
"\". Just 1 little \. That's all it left out. Just enough for everything
to stop! I totally freaked! It's been a tough day and I needed this to ice
the cake!
I figured this out by piecing the information together that I got from this
newsgroup, the feeble information I could glean from the IIS 4.0 product
manual & using the information found at the perl web site.
To see what IIS 4.0 did to your server's mapping go to the faq page at
www.activestate.com
Full address =
http://www.activestate.com/support/faqs/win32/perlwin32faq6.html
when you get to where IIS 4.0 shows the map for your perl executable it
should show the complete path
something like this: c:\perl5\bin\perl.exe %s %s
Mine was missing the 3rd \
Enjoy!
George Statis <REMOVETHIS.statis@nettaxi.org> wrote in message
news:72kor1$6ig$1@ns1.otenet.gr...
>I installed ActiveWare's perl on an NT server machine runing options pack 4
>.....
>
>I have tryed to test perl by puting the script bellow on the cgi-bin
>directory of the server ...
>
>---------------------------------------------------------------------------
-
>------------
>#! c:\perl\bin\perl
>
>print "<meta http-equiv='Content-Type' content='text/html;
>charset=windows-1253'>\n";
>print "<HTML>\n";
>print "<BODY>\n";
>print "hello\n";
>print "</BODY>\n";
>print "</HTML>\n";
>---------------------------------------------------------------------------
-
>---------
>
>the script works fine if i run it from the command prompt
>but if I try to run it from the server I get the following msg ...
>
>---------------------------------------------------------------------------
-
>---------
>CGI Error
>The specified CGI application misbehaved by not returning a complete set of
>HTTP headers. The headers it did return are:
>
>hello
>---------------------------------------------------------------------------
-
>---------
>
>what could be wrong ????????
>can anybody help me with that ???
>thanx in advance
>statis george
>
>
>
------------------------------
Date: 17 Nov 1998 04:26:49 GMT
From: radic96@aol.com (Radic96)
Subject: installing PERL on NT, IIS 4.0
Message-Id: <19981116232649.01754.00000210@ng06.aol.com>
I am having trouble getting PERL 5.0 to work with NT 4.0 and IIS 4.0. Perl
works perfect from command line, but I get errors running it from a browser. I
am trying to run a PL file from my SCRIPTS directory. Any help will be
appreciated.
Patrick Glenn
pglenn@lditel.com
------------------------------
Date: Mon, 16 Nov 1998 22:38:52 -0600
From: John Warner <jwarner@texas.net>
Subject: mod_perl for Win32 Apache
Message-Id: <3650FDDC.16D486B6@texas.net>
Does anybody know if the mod_perl available on CPAN contain the correct
libraries for Win32 Perl (on a 95 machine)? If so, how do I go about
installing it?
Thanks in advance,
John
------------------------------
Date: Tue, 17 Nov 1998 02:15:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: need help using ipc.ph
Message-Id: <Pine.GSO.4.02A.9811161807250.27321-100000@user2.teleport.com>
On Mon, 16 Nov 1998 igor_urisman@hyperion.com wrote:
> I just downloaded 5.004_04 for solaris 2.6 and am unable to use the
> system V style IPC. ( I did run h2ph.) In the most reduced form,
> my program has just one line:
>
> require "sys/ipc.ph"
>
> When I run it I get a syntax error (!?):
>
> Number found where operator expected at (eval 19) line 1, near ")0"
> (Missing operator before 0?)
Probably a bug in h2ph. One way to fix this might be to step through that
require in the debugger to find the problem line. Then you can manually
fix it by editing the file. The not-so-quick fix, of course, is to see
about fixing h2ph.
Then again, perhaps you really want to install SysV::IPC from CPAN.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 17 Nov 1998 02:08:08 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Not to start a language war but..
Message-Id: <911268345.173696@thrush.omix.com>
meaw@my-dejanews.com wrote:
>snip<
: Do you know if JPL is available for free? (I've seen it bundled with the
: "perl resource kit" from Orielly but that costs money.) If it is free, where
: do I get it?
I think you do have to buy the resource kit. In common programming
wage terms however, the $150 or so the kit costs *is* free. :-)
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 17 Nov 1998 02:20:33 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Not to start a language war but..
Message-Id: <72qmhh$j72$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Zenin
<zenin@bawdycaste.org>],
who wrote in article <911268345.173696@thrush.omix.com>:
> meaw@my-dejanews.com wrote:
> >snip<
> : Do you know if JPL is available for free? (I've seen it bundled with the
> : "perl resource kit" from Orielly but that costs money.) If it is free, where
> : do I get it?
>
> I think you do have to buy the resource kit. In common
> programming wage terms however, the $150 or so the kit costs
> *is* free. :-)
Check p5p archive. The only reason why JPL was not made public a
couple of months ago was an absense of a volunteer to maintain it. I
think that somebody volunteereed several days ago, so it should appear
in a free source form pretty soon.
Ilya
------------------------------
Date: 17 Nov 1998 02:09:03 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: novice question re CGI.pm/cgi-lib.pl
Message-Id: <911268399.431545@thrush.omix.com>
richard@stirlingbrig.com wrote:
>snip<
: Whichever one I use I get an error
: with cgi-lib.pl error = Can't find string terminator "END_MULTIPART"
: anywhere before EOF at cgi-lib.pl l
: ine 119.
: with CGI.pm I get a similar one for line 686 message about cant find
: SMTHG_SMTHNG_OvERLOAD
Maybe you uploaded them in binary mode instead of text?
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Tue, 17 Nov 1998 02:37:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: novice question re CGI.pm/cgi-lib.pl
Message-Id: <Pine.GSO.4.02A.9811161836140.27321-100000@user2.teleport.com>
On Tue, 17 Nov 1998 richard@stirlingbrig.com wrote:
> with cgi-lib.pl error = Can't find string terminator "END_MULTIPART"
> anywhere before EOF at cgi-lib.pl l
> ine 119.
Have you seen what it says about this message in perldiag?
> with CGI.pm I get a similar one for line 686 message about cant find
> SMTHG_SMTHNG_OvERLOAD
You probably transferred those files improperly to or from a DOS/Windows
machine. Try properly installing 5.004 or later of Perl, which includes
the CGI module. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 17 Nov 1998 03:03:49 GMT
From: technik@clio.muses.agoron.com ()
Subject: Re: Perl scripts as a NT service
Message-Id: <slrn751q5c.j9.technik@clio.muses.agoron.com>
To the original poster, have you tried pointing to them using UNC's? You may fix
it if you explicitly name the path for everything in a UNC-ish way (like
\\myserver\home\perl\lib\...) by hackiing @INC from a BEGIN subroutine.
You should also verify that the script is running as a user with rights to the
directory in question. The default is the local system account which, depending
upon lots of things, might not. Also, remember that normal NT services can
interact with the user or access the network but not both. I do not know if perl
scripts are subject to the same limitation.
Ross
In article <364FFB3C.EDB154FA@gfc-net.de>, J|rgen Ibelgaufts wrote:
[snip]
>what does NT service mean for you? In which way do you invoke your perl
>interpreter and script to run as a service? Do you register perl with sc.exe so
>that you can control its start and end by means of My Computer -> System ->
>Services ? Where do you find the error messages? As far as I know, perl is a
>console program that prints to stdout rather than to the services logfile. Do you
>want your program start before any user logs on?
[snip]
>Farouk Khawaja schrieb:
[snip]
>> I'm trying to start run a perl script as a NT service. My problem is that
>> my Perl code, interperter, and libraries are on a virtual drive (R: ) .
>> Unfortuantely, that's my environment and I cannot change it. When I try to
>> start the script from any other drive besides R:, perl cannot find any of
>> its libraries.
[snip]
------------------------------
Date: Mon, 16 Nov 1998 22:34:07 -0500
From: "Atsushi Amemiya" <a.amemiya@asahi-jc.com>
Subject: Send Attachment by Perl CGI
Message-Id: <72qqsd$h3p@netaxs.com>
Hi there,
I'm wondering if this can be done with Perl. I want to send emails with
attachment, using sendmail comand. Does anyone know how?
Thanks in advance.
Atsushi
------------------------------
Date: Tue, 17 Nov 1998 03:57:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Send Attachment by Perl CGI
Message-Id: <bv642.138$Qs1.142@nsw.nnrp.telstra.net>
In article <72qqsd$h3p@netaxs.com>,
"Atsushi Amemiya" <a.amemiya@asahi-jc.com> writes:
> Hi there,
>
> I'm wondering if this can be done with Perl. I want to send emails with
yes, it can.
> attachment, using sendmail comand. Does anyone know how?
# perl -MCPAN -e shell
cpan> i /mail::/
[snip]
Module Mail::Mailer (GBARR/MailTools-1.12.tar.gz)
Module Mail::POP3Client (SDOWD/POP3Client-1_18.tar.gz)
Module Mail::Send (GBARR/MailTools-1.12.tar.gz)
Module Mail::Sendmail (M/MI/MIVKOVIC/Mail-Sendmail-0.74.tar.gz)
Module Mail::UCEResponder (Contact Author Charlie Stross <charlie@antipope.org>)
Module Mail::Util (GBARR/MailTools-1.12.tar.gz)
[snip]
cpan> i /mime/
Distribution ERYQ/MIME-Lite-1.123.tar.gz
Distribution ERYQ/MIME-tools-4.119.tar.gz
Distribution GAAS/MIME-Base64-2.09.tar.gz
[snip]
cpan>
http://www.perl.com/CPAN/modules
good luck,
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Tue, 17 Nov 1998 02:31:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: test for.t failure due to bad rounding
Message-Id: <Pine.GSO.4.02A.9811161821540.27321-100000@user2.teleport.com>
On Mon, 16 Nov 1998 everybodydies@my-dejanews.com wrote:
> i'm trying to build perl5.005_02 on a sparc box running solaris 2.5.1,
> and i'm seeing a really odd failure. it seems that ordinary integer
> values (4 and 8 are big culprits) are being improperly rounded to
> floats (like 3.999999 and 7.999997). this is seen in the for.t test
> among others:
>
> 1..7
> #1 :10: eq :10:
> #1 :0 1 2 3 3.999999 5 6 7 7.999997 9 10: eq :0 1 2 3 4 5 6 7 8 9 10:
> not ok 1
That's weird. I'd guess that it could be either the increment operator, or
it could be happening when it's being stringified. To see which, this test
may help:
for ($i = 0; $i <= 10; $i++) {
next if $i < 3.5 or $i > 4.5;
if ($i == 4) {
print "No problem with auto-increment\n";
print "Problem with stringification\n"
if "#$i#" ne "#4#";
} else {
print "Problem with auto-increment, perhaps\n";
}
}
Of course, once you find out which it is, that's just the start of the
fun. Perhaps you can use gdb or something similar to step through the ops
to see what's really going on, and whether the root of the problem is in
Perl or in one of your system libraries. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 16 Nov 1998 21:03:43 -0600
From: "illfigah" <alcazar@netcomp.net>
Subject: Trying to create directory!
Message-Id: <OGnYpadE#GA.274@upnetnews02.moswest.msn.net>
Hello all,
I'm trying to create a directory, however, I can't seem to do so using
the following code:
###perl_extra.pl
sub modify_files{
$client_name = $in{'clientName'};
mkdir("/www/clients/$client_name", 0777) || die "Can't make
directory: $! \n";
}
1;
This subroutine is located in external file called from a different
script. The form variables are passed as parameters to the above subroutine
from the following external file (in short):
require 'cgi-lib.pl';
require 'perl_extra.pl';
&ReadParse;
sub other_sub{
&modify_files(*in);
}
I've tried a number of different things and have proved this to be true.
1.) When I remove the variable from the mkdir() and replace it with a
string, the directory is created. 2.) When I print out $client_name to see
what values it stores, it returns the entered string.
Basically, I need to be able to create a directory based on form input
(CGI) and I can't do so because somewhere between passing form input as
parameters to the subroutine?? and creating the directory, something is
going wrong. I'm still a learning novice to perl and just can't seem to
figure it out. Any ideas would be greatly appreciated.
R. Alcazar
------------------------------
Date: Tue, 17 Nov 1998 03:49:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Trying to create directory!
Message-Id: <on642.136$Qs1.142@nsw.nnrp.telstra.net>
In article <OGnYpadE#GA.274@upnetnews02.moswest.msn.net>,
"illfigah" <alcazar@netcomp.net> writes:
> sub modify_files{
>
> $client_name = $in{'clientName'};
> mkdir("/www/clients/$client_name", 0777) || die "Can't make
> directory: $! \n";
You never check what is in $in{'clientName'}. Bad.
Those permissions are unnecessarily generous.
> require 'cgi-lib.pl';
> require 'perl_extra.pl';
> &ReadParse;
>
> sub other_sub{
> &modify_files(*in);
> }
This passes a typeglob that holds %in, I presume?. In the modify_files
subroutine however, you don't do anything to access it. I bet you are
not running with the -w flag, and are not using strict. Nowadays,
people tend to use references to pass arrays and hashes into
subroutines.
Besides that, you don't need to pass the typeglob. %in will be
available inside of modify_files, which is obviously what you are
looking at.
> I've tried a number of different things and have proved this to be true.
> 1.) When I remove the variable from the mkdir() and replace it with a
> string, the directory is created. 2.) When I print out $client_name to see
> what values it stores, it returns the entered string.
1) Which most likely means that your variable contains nothing or bad
stuff.
2) If $client_name contains something, is it sensible stuff? (does
it maybe contain bad characters? Newline, maybe? Characters that your
OS doesn't allow in pathnames?).
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4236
**************************************