[16440] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3852 Volume: 9

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

Date: Mon, 31 Jul 2000 00:05:17 -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: <965027117-v9-i3852@ruby.oce.orst.edu>
Content-Type: text

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

Today's topics:
    Re: can't use global $^W in "my"... (Decklin Foster)
        cleaning up temp files Please Help webmaster@sandiegopetandvet.com
    Re: cleaning up temp files Please Help <godzilla@stomp.stomp.tokyo>
    Re: cleaning up temp files Please Help <templar318@earthlink.net>
    Re: Confirming IP address and subnet mask (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
    Re: Data Editing <psychoNOpsSPAM@pcpatches.com.invalid>
    Re: Database Question <gellyfish@gellyfish.com>
    Re: Database Question (Abigail)
        DBI database access problem <bkimelma@midsouth.rr.com>
    Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
    Re: difference between require $file and require Module astewart@spawar.navy.mil
    Re: Downloading Perl <gellyfish@gellyfish.com>
        Help <dicceast@northcom.net>
    Re: Help (Iain Chalmers)
    Re: Help <tony_curtis32@yahoo.com>
    Re: Help (Gwyn Judd)
        How to recognize triplicates stillanewbie@db-networks.com
    Re: How to recognize triplicates (Decklin Foster)
    Re: How to recognize triplicates <jhiller@online-testing.net>
    Re: How to recognize triplicates (Gwyn Judd)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 31 Jul 2000 05:19:46 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: can't use global $^W in "my"...
Message-Id: <S%7h5.8993$f_5.42142@news1.rdc1.ct.home.com>

Darin Dugan <nobody@exnet.iastate.edu> writes:

[Jeopardectomy]

> "eaglewing" <eaglewing@zensearch.com> wrote in message
> news:8lshu6$56vab$1@ID-41717.news.cis.dfn.de...
> : If someone could help me with this before I am unable to resist putting my
> : fist through my screen I'd be very much obliged.
> :<snip>:
> : [Thu Jul 27 22:13:06 2000] [error] Can't use global $^W in "my" at
> : /home/gavin/codebase/v1/scripts/lucia2 line 1
> :<snip>:
>
> If you really aren't using $^W anywhere, how about:
>
> perl -p -i.bak -e 's/^W//g' /home/gavin/codebase/v1/scripts/lucia2

given that the error is probably

my $^W = $some_number;

this would leave you with the same problem, and a syntax error to
boot. (my $ = $some_number;)

The OP wants

local $^W = $whatever;

> (^W is really ctl-V ctl-W)

What if I had used <caret><dubya>?

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Mon, 31 Jul 2000 05:11:27 GMT
From: webmaster@sandiegopetandvet.com
Subject: cleaning up temp files Please Help
Message-Id: <8m31pt$67s$1@nnrp1.deja.com>

I have been banging my head on this one for several hours and combed
nearly every post to the forum and looked through my books. I am just
not getting it.

All I want to do it delete all files from a directory that have an
extension of tmp

This is the closest I have come, I think.

The relative directory variable is defined in the script setup which is
also where I write the temp files.

$relative_directory = "../userdefined/";

I figured out how to create temp files for reading, but now I can't
figure out how to get rid of them!

sub goto_cleanup
{
unlink(glob("$relative_directory*.tmp")) or die;
&create_main_form("<B>The tempory files were deleted</B>");
exit;
}

Any help is very much appreciated. I know the answer is simple, but I
just can seem to get it.


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


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

Date: Sun, 30 Jul 2000 22:45:02 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: cleaning up temp files Please Help
Message-Id: <3985125E.86FF5AAC@stomp.stomp.tokyo>

webmaster@sandiegopetandvet.com wrote:

(snipped here and there)

> All I want to do it delete all files from a directory
> that have an extension of tmp

> The relative directory variable is defined in the script
> setup which is also where I write the temp files.

 
> Any help is very much appreciated.

You may have second thoughts on this.


> I know the answer is simple, but I just can seem to get it.

Very simple answer. Fire up WS_FTP or a similar FTP client,
connect, go to your directory containing all your .tmp files,
highlight them, then click delete, answer "OK" for your prompt.

Shouldn't take you more than one-hundred-twenty seconds
to finish off this task.

However, you could do this even quicker from
a command line screen using a wild card to
delete all *.tmp files.

Godzilla!


-- 
if (${\index ($ENV{REMOTE_USER_AGENT}, "98")} gt -1)
 { print "file:///%43|%2f%77indo%77s/%6dedi%61/%64in%67.wav"; }
else { print "Ding!"; } exit;


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

Date: Mon, 31 Jul 2000 05:51:28 GMT
From: David Tsai <templar318@earthlink.net>
Subject: Re: cleaning up temp files Please Help
Message-Id: <398513BC.C3000AFB@earthlink.net>



webmaster@sandiegopetandvet.com wrote:

> I have been banging my head on this one for several hours and combed
> nearly every post to the forum and looked through my books. I am just
> not getting it.
>
> All I want to do it delete all files from a directory that have an
> extension of tmp
>
> This is the closest I have come, I think.
>
> The relative directory variable is defined in the script setup which is
> also where I write the temp files.
>
> $relative_directory = "../userdefined/";
>
> I figured out how to create temp files for reading, but now I can't
> figure out how to get rid of them!
>
> sub goto_cleanup
> {
> unlink(glob("$relative_directory*.tmp")) or die;
> &create_main_form("<B>The tempory files were deleted</B>");
> exit;
> }
>
> Any help is very much appreciated. I know the answer is simple, but I
> just can seem to get it.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

This probably isn't the easiest way to do it but it works.....

opendir(DIR,"$relative_directory") || die "Can't open directory\n";
while($file = readdir(DIR)) {
    if($file =~ /.+\.tmp/) {
        unlink("$relative_directory/$file");
    }
}
closedir(DIR);

--

Best Regards,
David Tsai
CGI Paradise
http://www.web-consult.com/scripts/




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

Date: 31 Jul 2000 06:10:48 GMT
From: cederstrom@kolumbus.REMOVE_THIS.fi (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
Subject: Re: Confirming IP address and subnet mask
Message-Id: <slrn8oa20i.ud.cederstrom@sitruuna.cedenet.local>

On Sun, 30 Jul 2000 10:40:21 +0100, 
Derek Fountain <derek@fortstar.nospam.demon.co.uk> wrote:
> Can anyone point me to a piece of code which will take an IP address and
> a subnet mask, and confirm that that IP address is valid for the subnet?

I hadn't used perl for a while, but I tried to do that. TMTOWTDI and this is
just one (probably almost the worst?) way. But I think it should work. 
Comments anyone?

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

my $IP = '192.168.1.32';
my $NET = '192.168.1.0';
my $MASK = '255.255.255.15';

my @IP_parts = split /\./, $IP;
my @NET_parts = split /\./, $NET;
my @MASK_parts = split /\./, $MASK;

my ($i, $ok, $part);

$ok = 1;
foreach $i (0..3) {
        $part = int( $IP_parts[$i] ) & int( $MASK_parts[$i] );
        $ok=0 unless $part==int( $NET_parts[$i] );
}

# If the IP was valid for subnet, $ok is now 1.

print "$ok\n";
--------------------


-- 
Juho Cederstrom    -    cederstrom<a>kolumbus.fi    s/<a>/@/


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

Date: Sun, 30 Jul 2000 18:06:25 -0700
From: psycho <psychoNOpsSPAM@pcpatches.com.invalid>
Subject: Re: Data Editing
Message-Id: <06837650.463e67a7@usw-ex0106-046.remarq.com>

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.

Thanks Again,
 Psycho


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: 31 Jul 2000 00:50:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Database Question
Message-Id: <8m2f11$gfd$1@orpheus.gellyfish.com>

On Sun, 30 Jul 2000 17:23:55 +0100 Unigni wrote:
> I'm wanting a database which I can use with Perl (running on a Unix web
> server). I only need to be able to access records using their key (no
> complicated searching things), but want to be able to lock specific
> records and write to them while I'm also reading/writing other records.
> Could anybody suggest a good database to use?

I think that postgres-sql has row level locking as do all of the major
database engines (Informix, Oracle, Sybase).  MySQL doesnt do this BTW.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 31 Jul 2000 00:10:45 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Database Question
Message-Id: <slrn8o9v1q.vcg.abigail@alexandra.foad.org>

Unigni (unigni@zaynar.demon.co.uk) wrote on MMDXXV September MCMXCIII in
<URL:news:o3jk3AAbaFh5EwDI@zaynar.demon.co.uk>:
@@ I'm wanting a database which I can use with Perl (running on a Unix web
@@ server). I only need to be able to access records using their key (no
@@ complicated searching things), but want to be able to lock specific
@@ records and write to them while I'm also reading/writing other records.
@@ Could anybody suggest a good database to use?

Sybase or Oracle.


Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


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

Date: Mon, 31 Jul 2000 00:12:16 GMT
From: Barry Kimelman <bkimelma@midsouth.rr.com>
Subject: DBI database access problem
Message-Id: <MPG.13ee81df8bf27762989687@news-server>

I am having a problem accessing an Informix database table on my UNIX 
system at the office while using the DBI interface.

The connect succeeds, but the "prepare" statement fails with the 
following error message :

    DBD::Informix::db prepare failed: SQL: -479: The number of DESCRIBED 
columns is greater than the allocated space.

According to the perl -v command we are running perl version 5.004_04
built for RM600-unix.

The table in question has 201 columns. Is there some built in limit with 
respect to the number of columns ? Is there some parameter or 
configuration option which can be used to solve this problem ?
Please advise as to how to solve this problem.

TIA for all your help.

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

Barry Kimelman
Memphis, TN, USA
email : bkimelma@midsouth.rr.com


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

Date: Sun, 30 Jul 2000 20:14:54 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <1a9cb347.f20535ae@usw-ex0108-061.remarq.com>

>Keith Calvert Ivey wrote:

>You should be aware that a little over one year from now
(September 2001) your reference numbers will no longer
start with 9, and they'll be 10 digits long.

You're right, I've not thought of that. I have an idea, why
not append a comment tag with the epoch time 3 days from
the date of post. It is sometime like this.

$deletedate = $ref + $threedays;

The new record looks like this:

{HTML tags}Reference: 9xxxxxxxx{line break}{HTML tags}
{Comment tag with deletedate}

Then I can extract $deletedate from the comment tag and
delete the record if time() > $deletedate.

How do I go about doing this? TIA.







* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


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

Date: Sun, 30 Jul 2000 22:42:26 GMT
From: astewart@spawar.navy.mil
Subject: Re: difference between require $file and require Module
Message-Id: <3984ae7d.688389@news.pwy1.sdca.home.com>

On 30 Jul 2000 14:44:49 GMT, mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:

> <astewart@spawar.navy.mil> wrote:
>>Quite some time ago Tom C. posted an explanation of the differences
>>between do, require and use,
>
>It's part of the FAQ actually.
>
>>                             which said, in part:
>>
>>3)  require Module is like require "Module.pm", except the former:
>>    3.1: translates each "::" into your system's directory separator.
>>    3.2: primes the parser to disambiguate class Module as an indirect
>>object.
>>
>>Could Tom or someone elaborate on what 3.2 means?

{snipped]
>
>This is where Perl's smoke and mirrors come in:  Perl uses whether
>name2 has been seen as a name of a module as one of the factors in
>choosing which interpretation to follow.
>
>
>Mike Guy

I understand the ambiguity. I was hoping to find out how the parser is
"primed" as Tom put, or what the "smoke and mirrors" were, as you
said. Is the namespace manipulated in some visible way?




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

Date: 31 Jul 2000 00:59:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Downloading Perl
Message-Id: <8m2fh0$i2h$1@orpheus.gellyfish.com>

On Sun, 30 Jul 2000 12:36:21 -0400 Ted wrote:
> Is there anywhere other than Activestate where one can do this?  They've
> been down since Friday night. 
> 

Patience, this is the internet, there is no quality control :)

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Mon, 31 Jul 2000 00:30:31 -0400
From: "Craig Easton" <dicceast@northcom.net>
Subject: Help
Message-Id: <3985028b@news2.kos.net>

Hi:

   I am new to perl programming and I need some help to get cgi to show up
as a webpage. If you can help me please email me.

Thanks,
Craig Easton.




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

Date: Mon, 31 Jul 2000 14:54:24 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Help
Message-Id: <bigiain-3107001454240001@bigman.mighty.com.au>

In article <3985028b@news2.kos.net>, "Craig Easton"
<dicceast@northcom.net> wrote:

>Hi:
>
>   I am new to perl programming and I need some help to get cgi to show up
>as a webpage.

try this:

#!/usr/bin/perl -w

use strict;

print "Content-type: text/html\n\n";

print <<END;

<HTML><HEAD><TITLE>cgi page</TITLE></HEAD><BODY>
cgi
</BODY></HTML>

END

cheers,

Iain <GRIN>


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

Date: 31 Jul 2000 00:02:06 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help
Message-Id: <87zomy6gfl.fsf@limey.hpcc.uh.edu>

>> On Mon, 31 Jul 2000 00:30:31 -0400,
>> "Craig Easton" <dicceast@northcom.net> said:

> Hi: I am new to perl programming and I need some help to
> get cgi to show up as a webpage. If you can help me
> please email me.

Well, here we can address the perl issues.  However, you
should be aware that other steps are generally necessary,
such as configuring the web server appropriately.
Questions for that part should be directed to the relevant
group for your websrver.

So here goes: you need to write a perl program which
outputs stuff to standard output.

    #!/usr/bin/perl -w
    use strict;
    use CGI ':standard';
    
    print header;
    print start_html('A Test');
    print h1('A Header');
    print end_html;

in an executable file should get you started.

Note that unless you have questions which are
*specifically to do with perl*, please use the groups

    comp.infosystems.www.authoring.cgi
    comp.infosystems.www.servers.*

instead.

To give you some context:

The standard module for CGI programming in perl is called,
well, CGI.  Read the documentation at "perldoc CGI".  It
will do most things for you and you'll be referred to it
here in the future.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Mon, 31 Jul 2000 05:50:44 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Help
Message-Id: <slrn8oa4ti.fp6.tjla@thislove.dyndns.org>

I was shocked! How could Iain Chalmers <bigiain@mightymedia.com.au>
say such a terrible thing:
>Iain <GRIN>

You idiot! You forgot to close the 'GRIN' tag. Do you realise what this
could cause? Massive outbreaks of worldwide happiness could spread
throughout usenet! Here:

</GRIN>

-- 
Gwyn "phew" Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Bershere's Formula for Failure:
	There are only two kinds of people who fail: those who
	listen to nobody... and those who listen to everybody.


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

Date: Mon, 31 Jul 2000 04:39:20 GMT
From: stillanewbie@db-networks.com
Subject: How to recognize triplicates
Message-Id: <lg0aos8h0rt23lls9ifqmjbtfsh5iegebq@4ax.com>

How to recognize 3 times the same character or the same number?

ie: 000 or 111 or AAA or ZZZ

I have tried but:  m/\D{3,}/ will match any 3 numbers in a row, not
identical numbers

Thanks


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

Date: Mon, 31 Jul 2000 05:01:57 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: How to recognize triplicates
Message-Id: <9L7h5.8991$f_5.42142@news1.rdc1.ct.home.com>

stillanewbie@db-networks.com <stillanewbie@db-networks.com> writes:

> How to recognize 3 times the same character or the same number?
> 
> ie: 000 or 111 or AAA or ZZZ
> 
> I have tried but:  m/\D{3,}/ will match any 3 numbers in a row, not
> identical numbers

You want a backreference (this is documented in perlre). Also, {3,}
will match three or more "\D"s, and \D itself means 'not a digit", so
that "***" will match but "111" will not.

[take a minute to read the docs now...]

So, you should do something like /(\w)\1{2}/.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Mon, 31 Jul 2000 05:07:03 GMT
From: Jordan Hiller <jhiller@online-testing.net>
Subject: Re: How to recognize triplicates
Message-Id: <398509DA.E8D532F@online-testing.net>

stillanewbie@db-networks.com wrote:
> 
> How to recognize 3 times the same character or the same number?
> 

Try something like this:

m/([a-z0-9])\1{2,}/i


Jordan Hiller
http://www.online-testing.net


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

Date: Mon, 31 Jul 2000 05:16:39 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: How to recognize triplicates
Message-Id: <slrn8oa2tl.fp6.tjla@thislove.dyndns.org>

I was shocked! How could stillanewbie@db-networks.com <stillanewbie@db-networks.com>
say such a terrible thing:
>How to recognize 3 times the same character or the same number?
>
>ie: 000 or 111 or AAA or ZZZ
>
>I have tried but:  m/\D{3,}/ will match any 3 numbers in a row, not
>identical numbers

/(\d)\1\1/

will match three of the same digit

/(\w)\1\1/

will match three of the same character

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Anything is good and useful if it's made of chocolate.


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

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 3852
**************************************


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