[16443] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3855 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 31 09:05:29 2000

Date: Mon, 31 Jul 2000 06:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965048713-v9-i3855@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 31 Jul 2000     Volume: 9 Number: 3855

Today's topics:
        Configure Win32::ODBC Connection to a SQL Server? <cbegemann@orga.com>
        Convert 1000000 --> 1.000.000 <gibson70@libero.it>
    Re: Convert 1000000 --> 1.000.000 <bill.kemp@wire2.com>
    Re: Convert 1000000 --> 1.000.000 aqutiv@my-deja.com
    Re: Convert 1000000 --> 1.000.000 (Bernard El-Hagin)
    Re: Convert 1000000 --> 1.000.000 aqutiv@my-deja.com
    Re: Data Editing (Colin Keith)
        garbage is read from first record in a file rickbowles@my-deja.com
    Re: garbage is read from first record in a file (Colin Keith)
    Re: How to print the thousands comma for financial numb <gibson70@libero.it>
    Re: I Am An Idiot president@whitehouse.gov
    Re: I Am An Idiot president@whitehouse.gov
    Re: I Am An Idiot mexicanmeatballs@my-deja.com
    Re: I Am An Idiot <flavell@mail.cern.ch>
    Re: Installing a module (Anno Siegel)
    Re: New Site: www.perlmodules.com <gellyfish@gellyfish.com>
    Re: NEWB Q: CGI and DATABASSE <gellyfish@gellyfish.com>
    Re: Newbii file write perl question (Colin Keith)
    Re: Passing File Handler (Colin Keith)
        PDF creation with PDF-111 sept00@my-deja.com
    Re: Please help in solving this mysterious prob (Colin Keith)
        POSIX::mktime (Chest Rockwell)
    Re: POSIX::mktime (Colin Keith)
        posting in newsgroup using perl script? <r.roosjen@koersagent.nl>
    Re: posting in newsgroup using perl script? <gellyfish@gellyfish.com>
    Re: Quotes in regex? (Colin Keith)
    Re: remove the newline? (Colin Keith)
    Re: Shell commands (Colin Keith)
        text file to HTML page (Dr M Hughes)
        text file to html (Dr M Hughes)
    Re: wierd regular expression <bart.lateur@skynet.be>
    Re: WIN32::NetAdmin president@whitehouse.gov
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 31 Jul 2000 13:51:57 +0200
From: "Carola Begemann" <cbegemann@orga.com>
Subject: Configure Win32::ODBC Connection to a SQL Server?
Message-Id: <8m3pgk$j1d$1@relay1.orga.com>

Hallo,
I am trying to configure a new Connection to a database on a sql 7 server
using the Win32::ODBC module.
Can someone help me with the correct Attrbutes for the driver "SQL Server"?
I can nor imagine how to correct  the string
 Win32::ODBC::ConfigDSN(ODBC_ADD_SYS_DSN,"SQL Server",
    ( "DSN=$dsn","Description= $condb automatisch generiert",
    "Server=$server","Database=$condb", "UID=$user", "PWD=$passwd"))

I get the error : No such file or directory (whatever that stands for).
And if i try the GetDSN() command on an existing SQL server connection all I
get back is a string showing the path to the driver DLL.
I did manage to configure a new ODBC Connection to an Access
database following the given example.

    Carola




------------------------------

Date: Mon, 31 Jul 2000 10:15:42 GMT
From: "Gibson" <gibson70@libero.it>
Subject: Convert 1000000 --> 1.000.000
Message-Id: <ilch5.43978$wS2.368313@news.infostrada.it>

I have just a little experience in Perl Programming

How can i convert a string like this

1245789

in this one

1.245.789

?

TIA





------------------------------

Date: Mon, 31 Jul 2000 11:27:20 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: Convert 1000000 --> 1.000.000
Message-Id: <965039415.118.0.nnrp-02.c3ad6973@news.demon.co.uk>


Gibson wrote in message ...
>I have just a little experience in Perl Programming
>
>How can i convert a string like this
>
>1245789
>
>in this one
>
>1.245.789

In perlfaq4
How can I output my numbers with commas added?

I presume this is for thousands and millions in a European country.
It should work if you swap the , for a .   in this case
BUT in some contexts it will need escaping \.




------------------------------

Date: Mon, 31 Jul 2000 11:45:21 GMT
From: aqutiv@my-deja.com
Subject: Re: Convert 1000000 --> 1.000.000
Message-Id: <8m3osg$m2u$1@nnrp1.deja.com>



>
> In perlfaq4
> How can I output my numbers with commas added?
>
> I presume this is for thousands and millions in a European country.
> It should work if you swap the , for a .   in this case
> BUT in some contexts it will need escaping \.
>
>

weird, I didn't find that there, might be an older version or
something..
anyhow, I've made my own. :)
$num = 1000000;
$ps = $num % 3;

$num =~ s/^(\d{$ps})/$1\./ if $ps;
$num =~ s/(\d{3})(?!$)/$1\./g;
print $num;





Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 31 Jul 2000 12:12:24 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Convert 1000000 --> 1.000.000
Message-Id: <slrn8oar0a.61h.bernard.el-hagin@gdndev25.lido-tech>

On Mon, 31 Jul 2000 11:45:21 GMT, aqutiv@my-deja.com
<aqutiv@my-deja.com> wrote:
>
>
>>
>> In perlfaq4
>> How can I output my numbers with commas added?
>>
>> I presume this is for thousands and millions in a European country.
>> It should work if you swap the , for a .   in this case
>> BUT in some contexts it will need escaping \.
>>
>>
>
>weird, I didn't find that there, might be an older version or
>something..
>anyhow, I've made my own. :)
>$num = 1000000;
>$ps = $num % 3;
>
>$num =~ s/^(\d{$ps})/$1\./ if $ps;
>$num =~ s/(\d{3})(?!$)/$1\./g;
>print $num;

This outputs 1.000.000.0 for $num = 10000000.

Bernard
--
perl -le 'open(JustAnotherPerlHacker,"")or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'


------------------------------

Date: Mon, 31 Jul 2000 11:56:17 GMT
From: aqutiv@my-deja.com
Subject: Re: Convert 1000000 --> 1.000.000
Message-Id: <8m3ph0$mfe$1@nnrp1.deja.com>


> $num = 1000000;
> $ps = $num % 3;

even though it works, it should be: length($num) % 3; my mistake.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 31 Jul 2000 10:20:55 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Data Editing
Message-Id: <bqch5.40$DT4.2083243@nnrp2.clara.net>

In article <06837650.463e67a7@usw-ex0106-046.remarq.com>, psycho <psychoNOpsSPAM@pcpatches.com.invalid> wrote:
>well, thanks Jonathan, but as im still new to perl, i dont get
>what you say with out source code that i can look at.. and can
>you explain what the point of use strict; for.

perldoc strict

but in summary the interpreter enforces that the syntax is strictly adhered 
to when 'use strict' is enabled. This stops you making mistakes through name 
clashes, through using the wrong syntax, etc. For example 

 maia% perl -w -Mstrict
 $x = 1;
 Global symbol "$x" requires explicit package name at - line 1.
 Execution of - aborted due to compilation errors.

compared with:

 maia% perl -w 
 $x = 1;
 Name "main::x" used only once: possible typo at - line 1.

(This warning generated by the -w flag)

The comments about the locking not being effective are best explained by 
looking at the example given in:

 perldoc -q lock
 =head2 I still don't get locking.  I just want to increment the number in 
 the file.  How can I do this?

But to summarise, your open didn't check for locking, it just opened the 
file for writing, which deleted anything in it and then you tried to get a 
lock.

>Got questions?  Get answers over the phone at Keen.com.
But I know what the answer is, its 42!


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 12:20:41 GMT
From: rickbowles@my-deja.com
Subject: garbage is read from first record in a file
Message-Id: <8m3qum$njg$1@nnrp1.deja.com>

When reading the first record in a file I get garbage. I am running on
AIX 4.3.0 and 4.3.3. I have tried this on perl versions 5.003, 5.004,
and 5.6.0.

Has anyone seen this before?

open( ROUTE_TEMP_FILE, "$WORK_PATH/hostdnld/route/$FILE_NAME.tmp" );

while ($REC1 = <ROUTE_TEMP_FILE>)
  {
  chomp($REC1);
  print (" $REC1\n");
  }


Debug shows:
main::(../awibin/dn:230):       while ($REC1 = <ROUTE_TEMP_FILE>)
main::(../awibin/dn:231):         {
  DB<2> s
main::(../awibin/dn:233):       print (" $REC1\n");
  DB<2> X REC1
$REC1 =
"\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c
@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c
@\c@\c@\
c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\
c@\c@\c@
\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@
RíP\c@\c@\c@`\c@\c@\c@\c@\c@\c@\c@\c@
And about 18k more

Thanks,
Rick Bowles
rbowles@awiweb.com


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 31 Jul 2000 12:45:03 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: garbage is read from first record in a file
Message-Id: <jxeh5.47$DT4.2088563@nnrp2.clara.net>

In article <8m3qum$njg$1@nnrp1.deja.com>, rickbowles@my-deja.com wrote:
>When reading the first record in a file I get garbage. I am running on

[snip]
What does the first line of your file say?

Bear in mind that you have just read a line of text. The fact that you say 
'record' suggests that you're playing with some kind of formatted file with 
defined records in it. <FH> will read until it finds a \n (assuming you 
haven't changed $/) What you posted looks very unlike text.

If you're working with defined records, you probably want to be using read() 
and seek() and such like to move around the file and read the records, not 
just reading lines of text.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 10:06:33 GMT
From: "Gibson" <gibson70@libero.it>
Subject: Re: How to print the thousands comma for financial numbers ( $ 12,8292.75)
Message-Id: <Jcch5.43922$wS2.367295@news.infostrada.it>

Eric Bohlman <ebohlman@netcom.com> wrote in message
8lmbki$i9m$4@slb2.atl.mindspring.net...
> Louis Banens (louis.banens@xs4all.nl) wrote:
> : I cannot find out how to print the thousands comma for financial numbers
( $
> : 12,8292.75).
> :
> : Any ideas ?
>
> Use the code shown in perlfaq5.

where is ?

www.perl.com ?




------------------------------

Date: Mon, 31 Jul 2000 11:22:47 +0100
From: president@whitehouse.gov
Subject: Re: I Am An Idiot
Message-Id: <39855377.4DB0A6BE@whitehouse.gov>

"Godzilla!" wrote:

> > Let's step back for a second and try actually reach a consensus on
> > what we're discussing. The question before us seems to be "what
> > additional actions should you take when opening a file?" Seems to me
> > that there are four options:
>
> Cannot say I've ever been one to step back. My preference
> is to charge a bull before he has a chance to charge me.
> Psyches 'em out, ya know. These bull runners over Spain,
> where it always rains on the plains, these boys need to
> either pop one of those bulls right on the nose or hop
> on a bull's back and go for wild ride! I prefer the latter.

And - let's see if I understand you, here - Dave is the bull in this
illustration?

(You are speaking metaphorically, right?)
---
Nick




------------------------------

Date: Mon, 31 Jul 2000 11:24:41 +0100
From: president@whitehouse.gov
Subject: Re: I Am An Idiot
Message-Id: <398553E9.3FB839A6@whitehouse.gov>

"Godzilla!" wrote:

> Have to disagree with your blanket denial on promotion of
> die or else. I constantly, almost always, read you boys
> saying, paraphrased,
>
> "You _must_ _always_ use die with a file opening."

You are the Internet mind reading Milk Mystic and I claim my free gift.

(what is a free gift exactly? Aren't all gifts free?)
---
Nick



------------------------------

Date: Mon, 31 Jul 2000 10:46:49 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: I Am An Idiot
Message-Id: <8m3lep$k1o$1@nnrp1.deja.com>

In article <39852C44.911E4624@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> Larry Rosler wrote:
>
> > Godzilla! wrote:
>
> > > > open HANDLE, "not_a_file" or die "Cannot open: $!";
> > > > open HANDLE, "not_a_file" || die "Cannot open: $!";
>
> > > Both kill your program. Reality dictates there is no difference.
>
> > The second of the two lines cannot kill the program, because the
string
> > literal is always TRUE.  Failure to open the file will be ignored.
>
> > > * waves another white flag in sarcastic jest *
>
> > Is that an advance acknowledgment of your outright error?
>
> As you know Mr. Rosler, I have a well earned reputation
> for testing "things" before committing myself to any
> knowledgable statement. My tests reflect a different
> reality than you attempt to impose:
>
> http://la.znet.com/~callgirl/rosler.jpg
>
> This image holds true for all tests I ran,
> for both case examples.
>
> My suggestion for personal enlightment, Mr. Rosler,
> is to setup scripts of your own and, test to verify
> your thoughts are correct, before utterance. Both
> kill a program unless you write code to compensate
> for a file open failure. First one outright kills
> your program. Second kills your program if you do
> not provide alternative output data under failure
> conditions.
>

<snip waffle>

> Godzilla!
>
> ==
> I am Dr. Victoria Frankie Einstein. I will rock you.
> http://la.znet.com/~callgirl5/frank.mid
>

To illustrate Larry's point:

#!/usr/bin/perl -w
use strict;

open IN, "</flobbleflube.txt" || die "arse";
open IN, "</flobbleflube" or die "ARSE";

Assuming that opening "/flobbleflube" will fail of course.
(I know _I_ don't have a /flobbleflube anyway, if you do
 you'll have to change the filename)

Will die from a capital arse.
Showing that the || die was ignored, they are _NOT_ the same.

Jon
perl -e '$_="MrqEdunhuClqdph1frp"; print map {chr(ord($_)-3)} split //;'


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 31 Jul 2000 14:10:56 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: I Am An Idiot
Message-Id: <Pine.GHP.4.21.0007311409560.9724-100000@hpplus03.cern.ch>

On Sun, 30 Jul 2000, Colin Keith wrote:

> >It was probably pining for the fjords...
> 
> Last time I looked we didn't have any fjords.

That would explain why it was pining...




------------------------------

Date: 31 Jul 2000 10:22:05 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Installing a module
Message-Id: <8m3k0d$d80$1@lublin.zrz.tu-berlin.de>

Eelke Kleijn <six4eight@NOSPAMhotmail.com> wrote in comp.lang.perl.misc:
>Hi everyone,
>
>I'm have problems installing the MIME-Base64-2-2.11 module in a selfmade
>directory. The webserver has perl support, but doesn't support this module,
>so I figured I would install it myself. I have created an empty directory in
>my cgi-bin named perl, and uploaded MIME-Base64-2-2.11.tar.gz into it. After
>that, I untarred and:
>
>make Makefile.PL
>make
>make test
>make install => All goes well until the install, perl gives the following
>error:
>
>/cgi-bin/perl//lib/perl5/site_perl/i386-linux/perllocal.pod: No such file or
>directory.
>
>I think this is because perl thinks I have installed perl in the directory
>/cgi-bin/perl ?? Or isn't that the problem?
>Anyway, I don't know what caused the error. I did everything according to
>the FAQ.

Well, in any case it thinks the library is under /cgi-bin/perl/lib/perl5.
Actually, perllocal.pod is just a repository where information is stored
about what modules have been installed.  It may well be that the actual
installation has worked, and only the informational part has gone wrong.
Have you tried to use the module, after an appropriate "use lib ..."?

Anno


------------------------------

Date: Mon, 31 Jul 2000 10:35:46 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: New Site: www.perlmodules.com
Message-Id: <6Ech5.734$82.27317@news.dircon.co.uk>

On Fri, 28 Jul 2000 09:57:13 -0500, Cameron Dorey Wrote:
> James wrote:
>> 
>> www.perlmodules.com
>> 
>> Please note of a new up and coming
>> centralized site for all info
>> regarding Perl Modules.  Any suggestions for what
>> you would like to see on this site would be helpful.
>> 
>> www.perlmodules.com
> 
> Great, a pointer to CPAN, and nothing but. I guess you get a fee for the
> banner ad every time someone opens your page? What a scam, I hope for
> your sake you quit before your advertisers start suing.
> 

Advertiser in the singular it would appear :)

/J\


------------------------------

Date: Mon, 31 Jul 2000 12:07:49 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: NEWB Q: CGI and DATABASSE
Message-Id: <p_dh5.754$82.27514@news.dircon.co.uk>

On Sun, 30 Jul 2000 17:04:54 GMT, eric_lyon@my-deja.com Wrote:
> In article <8luu94$l5t$1@news.vsnl.net.in>,
>   "Debjit" <debjit@oyeindia.com> wrote:
> 
> WHERE DID YOU GET IT ? is it available online ?
> 

Dont shout.

<http://www.google.com/search?q=ocelot+database>


/J\


------------------------------

Date: Mon, 31 Jul 2000 10:42:43 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Newbii file write perl question
Message-Id: <DKch5.41$DT4.2084211@nnrp2.clara.net>

In article <8m3f84$fuq$1@nnrp1.deja.com>, rune@clamon.dk wrote:
>find the place to increase
>   -the line looks like this:
>   //version control information: helloWorld.java $version: 001

Well strictly speaking you're after this:

perldoc -q file
=head2 How do I change one line in a file/delete a line in a file/insert a 
line in the middle of a file/append to the beginning of a file?

Although I guess you could do something nifty with seek() to get to the 
number, read the next 3 bytes, increment by 1, seek() back 3 bytes and write 
your (0 padded, 3 digit) number back to the file handle ...

but read that doc first:)


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 10:48:36 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Passing File Handler
Message-Id: <8Qch5.42$DT4.2084225@nnrp2.clara.net>

In article <3985223E.5F8A@yahoo.com>, Mouse <glodalec@yahoo.com> wrote:
>Hi !
>
>Does anyone know, how to pass file handler into subroutine ?

Passing them as glob types:

\*FH

Crack out the perlref and perldata man pages.

Or use 'FileHandle' objects. Since you're assigning them to scalars you'd 
pass 'em around as you normally would pass scalars.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 11:46:03 GMT
From: sept00@my-deja.com
Subject: PDF creation with PDF-111
Message-Id: <8m3otq$m31$1@nnrp1.deja.com>

Hello!!

I've been generatin PDF files for a while now with PDF-Create, but
there seems to be some bug that hits in special cases when the files
gets generates (if you want, I'll get more specific).

Does anybody know of any good documentation or even better sample
scripts for the PDF-111 modules? All I really want to do is get those
files out correctly, nothing fancy.

This is all running on a remote web server that doesn't have pdflib, or
this wouldn't be all too hard.

Thanks,
Tom


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 31 Jul 2000 11:51:50 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Please help in solving this mysterious prob
Message-Id: <qLdh5.43$DT4.2086869@nnrp2.clara.net>

In article <8m314j$5qf$1@nnrp1.deja.com>, Joydip Chakladar <joydip_chaklader@my-deja.com> wrote:
>programme is running fine in my localhost in Apache for Win32.

Where there ain't no security permissions?

>But when I upload the prog in my webserver linux-Apache it is unable
>to create the directory whose name would be dynamically generated from
>the form field login name.And at the time of login this directory name
>should be checked and then the login should be given. So if the
>directory is not created the total module doesnot function.

>This is the prog--

Its part of it. It doesn't say some of the important bits like: 
#!/usr/bin/perl -w
use strict;

Put those and you'll see a wonderful new world open up which will help you 
fix any problems created by incorrect syntax.

>$Rec=$pwd."|".$lname."|".$ul."|".$stl."|".$em."|".$nm."|".$d."|".$cn."|"
>..$ques."|".$ans."\n";

You don't need "'s, single quotes will do, you also don't need to 
concatenate everything together like this. I believe its less memory hungry 
if you use "$pwd|$lname|$ul" ... or join('|', $pwd, $lname ... );

Why does everyone want to use | given the problems it has when split()'ing 
the record fields again? 

>mkdir($lname, 0777)|| print ("\n Could not make Directory: $lname \n");

I would assume you have printed "Content-Type: text/html\n\n" or similar 
before this to tell the browser what to expect. The leading \n will end the 
headers but it is.. inconsistent. It also seems odd to print if you couldn't 
create this directory and then try and open a file in it. Trying to avoid 
the "do or die" flame, you might want to use if(!mkdir($lname, 0777))

and *always* include $! in your output otherwise you don't know why it can't 
mkdir(), open(), opendir() etc. I suspect strongly that it will say 
something like "Permission denied" because the web server user doesn't have 
write access to the directory that you're trying to create files in .. or 
the parent directory doesn't exist. I.e. mkdir()'ing 
"/usr/local/apache/vhosts/myaccount/private/username" when 'private' doesn't 
exist.

>open(F,$lname."/"."reg_info.db");

Urm, you opened it for reading, not writing. You should also (ideally) 
specify whether you want read/write/read-write in case you let through some 
data from your users with a | in it, that way:

open(F, "/blah/wibble\0/bin/cat /etc/passwd|");

fails if you specify

open(F, ">/blah/wibble/file") 

because you have explicitly instructed that you want to write to it. You 
don't give a chance for things to be interpreted based on the input. But 
then you are using taint checking and regexp filtering all of the input... 
aren't you? :)

Also the filename can be rewritten simply as "$lname/reg_info.db" to skip 
the need to concat two strings (neither of which have any variables in them, 
so could have been single quote enclosed, not double quote) and a scalar.

>syswrite(F,$Rec,length($Rec));

See above, you're using open() and not opening it for writing. Also 
syswrite() bypasses the stdio buffering so *i think* your meant to use 
sysopen(), not just open(). You might want to use sysopen() anyway because 
that will enable you to plonk down exclusive locks and the flock() the file 
so it doesn't get mangled by multiple connections trying to update it at 
once. see perldoc -q lock for details.

>close(F);

sysclose() ? (I don't think it matters though)

>open(F,">$iname"."/"."reg_info.db");

Now this is using >. Try to copy and paste the lines from the file so we can 
spot errors in the actual code and you don't introduce any by retyping it 
(besides, its faster:)

>  http://www.upahaar.com/vouchreg.htm

This doesn't exist?

>logical base for it. Can anybody help me to solve this !!!. Thank in

$! will tell you why mkdir() failed.. that's why you should use it in your 
failure messages. It should point you in the right direction. If it doesn't 
come back to us with the code and error message and we'll go from there :)

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 10:56:29 GMT
From: haaaajo@removethis.dds.nl (Chest Rockwell)
Subject: POSIX::mktime
Message-Id: <39855b3e.239694843@news.wirehub.nl>

Hi there,

I am trying to get the Unix time (nr seconds since 1970) for every day
at 00:00 since 2000 (for testing purposes). I am using the mktime
function from POSIX in a for loop. But I can't seem to get the $yday
(day of the year) argument working. My code looks someting like this:

for ($i=0;$i<366;$i++){
	$mytime = mktime(?,?,?,?,?,? etc)
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($mytime)

# some expression to format the date #

}

Does anyone have a tip?

Thanks in advance,

Chest


------------------------------

Date: Mon, 31 Jul 2000 13:02:45 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: POSIX::mktime
Message-Id: <VNeh5.48$DT4.2089643@nnrp2.clara.net>

In article <39855b3e.239694843@news.wirehub.nl>, haaaajo@removethis.dds.nl (Chest Rockwell) wrote:
>Does anyone have a tip?

I've never used mktime() so no. Try adding more months to the following:

#!/usr/bin/perl -w
use strict;
use Time::Local;

my(@mon, $d, $m) = (31,29,31,30);
foreach $m (0..@mon){
  foreach $d (1..31){
    last if($d > $mon[$m]);
    $_ = timelocal(0, 0, 0, $d, $m, 2000);
    printf("%12d => %s\n", $_, scalar(localtime($_)));
  }
}

   946684800 => Sat Jan  1 00:00:00 2000
   946771200 => Sun Jan  2 00:00:00 2000
   946857600 => Mon Jan  3 00:00:00 2000
   946944000 => Tue Jan  4 00:00:00 2000
   947030400 => Wed Jan  5 00:00:00 2000


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 13:55:17 +0200
From: Ron <r.roosjen@koersagent.nl>
Subject: posting in newsgroup using perl script?
Message-Id: <39856924.8BEA16C0@koersagent.nl>

Hi all,

I want to write a script that posts a message into a newsgroup (not this
one ;-)  )
Anyone has an example how to do this? Is it more or less the same than
sending an email from a script? (this, I managed)

Thanks in advance for your help,

Ron




------------------------------

Date: Mon, 31 Jul 2000 12:47:23 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: posting in newsgroup using perl script?
Message-Id: <vzeh5.756$82.27682@news.dircon.co.uk>

On Mon, 31 Jul 2000 13:55:17 +0200, Ron Wrote:
> Hi all,
> 
> I want to write a script that posts a message into a newsgroup (not this
> one ;-)  )
> Anyone has an example how to do this? Is it more or less the same than
> sending an email from a script? (this, I managed)
> 

Net::NNTP


------------------------------

Date: Mon, 31 Jul 2000 12:13:34 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Quotes in regex?
Message-Id: <O3eh5.44$DT4.2087706@nnrp2.clara.net>

In article <8m2epg$dv0$2@f40-3.zfn.uni-bremen.de>, ch-kaufhold@gmx.de (Christian Kaufhold) wrote:
>This does not match at all!

*runs into the corner blushing furiously* 
That explains it. I've since been a good boy and gone back and changed it 
and sure enough it gives the expected results. Sorry fer being stupid :)

>Other random thoughts at 1:35 AM:

Uh oh. Least its sunday, they're not beer thoughts:)

>Why does it allow for "2" being unquoted?

I was always under the impression that (in HTML3.2, the last standard before 
HTML4 in which the <FONT> tag was depreciated anyway) numerical values could 
be unquoted. To make sure I wasn't about to have to blush more I checked 
and without wanting to sound pedantic, and purely to stop anyone else having 
to search:

<!ELEMENT FONT - - (%text)*     -- local change to font -->
<!ATTLIST FONT
 size  CDATA   #IMPLIED    -- [+]nn e.g. size="+1", size=4 --
 color CDATA   #IMPLIED    -- #RRGGBB in hex, e.g. red: color="#FF0000" --
>

HTML allows CDATA attributes to be unquoted provided the attribute value 
contains only letters (a to z and A to Z), digits (0 to 9), hyphens (ASCII 
decimal 45) or, periods (ASCII decimal 46). Attribute values can be quoted 
using double or single quote marks (ASCII decimal 34 and 39 respectively). 
Single quote marks can be included within the attribute value when the value 
is delimited by double quote marks, and vice versa. 

http://www.w3.org/TR/REC-html32.html

Likewise the trailing \s+ was meant to be a trailing \s* since HTML allows 
a space there too. But stupidly the regexps weren't 'the same' anyway since 
the second didn't allow for unquoted 2's

>It has to do more case-insensitive comparisons.

They both have /i ... ?

>Christian

Thanks *blush*
Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 12:28:12 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: remove the newline?
Message-Id: <wheh5.45$DT4.2088132@nnrp2.clara.net>

In article <39852B88.9F30D0EC@hotmail.com>, Tom <chaptera@hotmail.com> wrote:

comp.lang.perl doesn't officially exist any more. It was dropped in place of 
a comp.lang.perl hierarchy.

>@lines = <INFILE>;
>close(INFILE);
>open(FILE, ">>d.txt") or die "Cannot ok it";
>foreach $line (@lines)
>{
>   $line =~ s/\n\n*/\n/sg;

Your record separator $/ is "\n" by default (see man perlvar for 
INPUT_RECORD_SEPARATOR) so you are only reading a line-at-a-time into each 
element of the array, so you will never find \n followed by a \n because 
that's the value that determines the end of a line. If you wanted to read 
paragraphs into each element, use 

$/ = "\n\n";

It will only break on \n\n, so \n\n\n will fox it (hence the other reply is 
better, but I thought this was worth pulling people's attention to). The 
answer is *not* to think that you can give it a regexp though. $/ takes a 
string. 


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Mon, 31 Jul 2000 12:34:06 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Shell commands
Message-Id: <2neh5.46$DT4.2088566@nnrp2.clara.net>

Oops, I first saw this by mail, so that's how I replied. But in case anyone 
else is following this thread with intregue, interest, wonder, edge-of-your 
swivel-chair-gripping-excitement (I should work in television:) then here's 
the reply:

In article <3984CE81.5D0953E4@home.com>, "Stephen L. Sims" <s1sims@home.com> 
wrote:
>This is a multi-part message in MIME format.
>--------------75DE23F78E50DA12A414DF29
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
>So let me see if I'm reading from your sheet of music. I should be using the &&
> to
>replace what would be a pipe symbol at the command line? I'm trying to emulate
> what I
>would type at the command line which is: "rmdtopvf file.rmd | pvfspeed -s 8000
> |
>pvftoau >file.au". Thanks for responding,

Ahhhh *realisation dawns*



esult. You don't compare it (an Lvalue) or assign it (an Rvalue) I.e.        
          

In other words if you use:
  uname();
  
And have '/usr/bin' as part of your path then perl runs /usr/bin/uname
But if you decide to define a sub routine called uname():             

sub uname {   return 'mycomputer.com'; }

Then that will be called instead. With this in mind, what you're doing isn't
"This is a snippet of shell code which is piping data between the functions"
but more "I'm calling a subroutine, bitwise OR'ing the result with another  
subroutine," ... etc. So when you do                                        

  x | y | z

Its interpreted by perl as meaning

  x 'bitwise ORed with' y 'bitwise ORed with' z

Which since you're not assigning to anything gives you the void context 
message. Try the statement:
   
   1+2+3;
  
Its illogical to exist because you don't do anything with the result. You 
don't compare it (an Lvalue) or assign it (an Rvalue) I.e.                  
  
  if(1+2+3 > $a)          or      $a = 1+2+3;

Thus perl complains.

Now, that clarified (hopefully?), you can't pipe the output of the programs 
through each other like that because pipe's are a feature of your shell, not
perl. In otherwords you need to use the shell to call these commands in     
sequence, so you need to execute them in a shell. To do this you can use   
system(), exec(), or (probably) open(). I.e.

(*phew* more gripping than an episode of the Waltons:)
  
Plz read the docs on using system and when to pass your data as a scalar and
when to pass it as an array.

You could also use:
  
`prog1 | prog2 | prog3`;

But backticks give the output of STDOUT (after the pipe has completed) which
is probably not what you want. You might also want to use shell redirections
for STDERR etc.                              

(*phew* more gripping than an episode of the Waltons:)


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: 31 Jul 2000 11:52:03 GMT
From: mhughes@hgmp.mrc.ac.uk (Dr M Hughes)
Subject: text file to HTML page
Message-Id: <8m3p93$o5h$1@niobium.hgmp.mrc.ac.uk>


Please could someone tell me how to convert the results of a program
that are in the way of a text file (.txt as i'm on windows) into an HTML file
that I can return to the browser in my CGI script?

Thanks
Rich

please reply to r.dobson@microscience.com


------------------------------

Date: 31 Jul 2000 11:36:10 GMT
From: mhughes@hgmp.mrc.ac.uk (Dr M Hughes)
Subject: text file to html
Message-Id: <8m3oba$o0t$1@niobium.hgmp.mrc.ac.uk>

Thanks in advance
Rich

please reply to r.dobson@microscience.com




------------------------------

Date: Mon, 31 Jul 2000 11:29:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: wierd regular expression
Message-Id: <vmoaos4p4fe94pqrk5ef9m3inh90umg42b@4ax.com>

john wrote:

>foreach my $line(@layout){
>$line=~s/<TEXT>/$text/g;
>$line=~s/<SUBJECT>/$subject/g;
>$line=~s/<EMAIL>/$email/g;
>print $line;
>}

So, what do you do if $text contains the text "<SUBJECT>" or "<EMAIL>"?
What if people DO want the literal text "<TEXT>"?

-- 
	Bart.


------------------------------

Date: Mon, 31 Jul 2000 11:14:55 +0100
From: president@whitehouse.gov
Subject: Re: WIN32::NetAdmin
Message-Id: <3985519E.E7610A18@whitehouse.gov>

"Godzilla!" wrote:

> Use of modules can be
> an asset, a great helper, but modules should
> be avoided whenever possible. Modules should
> be a last ditch effort to avoid coding what
> you don't know how to code or, modules should
> be used when hand coding would be long and
> complex. Other than this, modules are a plague.

Another scared cow totally and utterly eviscerated.
Well, so long to modular programming: how do you feel about gotos?



------------------------------

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 V9 Issue 3855
**************************************


home help back first fref pref prev next nref lref last post