[10351] in Perl-Users-Digest
Perl-Users Digest, Issue: 3944 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 10 20:07:25 1998
Date: Sat, 10 Oct 98 17:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 10 Oct 1998 Volume: 8 Number: 3944
Today's topics:
cgi programing needed wh21@my-dejanews.com
Re: cgi programing needed <rick.delaney@shaw.wave.ca>
Re: crypt function in perl <cc047@ecs.pc.cranfield.ac.uk>
Re: DBM multiuser (Dave Schenet)
Re: Fun with Arrays of Hashes (Mark-Jason Dominus)
Help me in getting source code of counter in perl! <markns@nsclub.net>
Help to compil or translate Perl in C to make it exe <horizons@hol.fr>
Re: Help with this code stevenjm@olywa.net
Help!!! in manipulating database file (dbf) using perl <markns@nsclub.net>
Re: How do I use die? <gellyfish@btinternet.com>
Re: How do I use die? <flavell@mail.cern.ch>
How to Load and Use Library Modules in Win32 <williams@clark.net>
Re: How to: Add data to mSQL db from CGI script ? <gellyfish@btinternet.com>
Re: Issuing remote commands trough sockets. <gellyfish@btinternet.com>
Re: mSQL and DBI Problem in PERL <gellyfish@btinternet.com>
Re: Net::Whois for new Internic output? <spamsux-tex@habit.com>
NETWORK & GRAPHIC CARD INFO (SattarS)
Re: Newbie question RE: SSI and .cgi scripts on NT4 <gellyfish@btinternet.com>
Perl advice <jhunter@igg-tx.net>
Re: Perl FTP API <gellyfish@btinternet.com>
Re: Problem with perlmodules <gellyfish@btinternet.com>
Re: Problems Using a Compare Subroutine with Sort <gellyfish@btinternet.com>
Re: Problems with dyn load of SDBM_File <gellyfish@btinternet.com>
Re: Question about locking files (Mark-Jason Dominus)
Re: Question/Logging Scripts <gellyfish@btinternet.com>
Re: reg-exp: change < to < but keep <I> - look ahead <gellyfish@btinternet.com>
size of file etrim@my-dejanews.com
Re: size of file <che@debian.org>
Votem na lammertech <commitman@digitalnet.com.br>
Re: Why it doesn't work under UNIX?????? <aperrin@mcmahon.qal.berkeley.edu>
Re: Why it doesn't work under UNIX?????? <che@debian.org>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 10 Oct 1998 22:22:21 GMT
From: wh21@my-dejanews.com
Subject: cgi programing needed
Message-Id: <6vommt$e8n$1@nnrp1.dejanews.com>
I would like to provide a service like http://www.ml.org/ml/ does the
AtHome project the Free Domain Project and the DynSite Project
this faq discribes each service
http://www.ml.org/ml/support/faq-1.html#ss1.2
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 10 Oct 1998 22:49:05 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: cgi programing needed
Message-Id: <361FE5FD.CAD260E1@shaw.wave.ca>
wh21@my-dejanews.com wrote:
>
> I would like to provide a service like http://www.ml.org/ml/ does the
> AtHome project the Free Domain Project and the DynSite Project
Good for you. If you are looking for programmers to help you, you
should try a *.jobs group. And please don't spam this group when you
are up and running.
Good luck.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 10 Oct 1998 23:06:13 +0100
From: Jeffrey Goldberg <cc047@ecs.pc.cranfield.ac.uk>
To: Ryan <manicx@iname.com>
Subject: Re: crypt function in perl
Message-Id: <Pine.LNX.4.02.9810102259500.6098-100000@arpad.thegreen.private>
On Sat, 10 Oct 1998, Ryan wrote:
> $encrypted = crypt ($password, ""); #encrypt's the password
If you were to use a random string (instead of "") for salt, it
your password cracker would have to work much much harder. It's what
the salt is for.
See crypt(3) for some more information.
-j
--
Jeffrey Goldberg +44 (0)1234 750 111 x 2826
Cranfield Computer Centre FAX 751 814
J.Goldberg@Cranfield.ac.uk http://WWW.Cranfield.ac.uk/public/cc/cc047/
Relativism is the triumph of authority over truth, convention over justice.
------------------------------
Date: 10 Oct 1998 23:45:49 GMT
From: shodan@spamtrap.shodan.net (Dave Schenet)
Subject: Re: DBM multiuser
Message-Id: <6vorjd$83t$1@winter.news.erols.com>
=?iso-8859-1?Q?Asbj=F8rn?= Dankertsen (adank@statoil.com) wrote:
: I have written an application which lets several users access a dbm
: database. The do both reads and writes.
:
: Every now and then data gets lost/destroyd. I think this happens when
: two users writes to the same key in the dbm database at the same time.
:
: Is there a way to lock a dbm file, so that only one user can write to
: it?
:
: BTW. the server is a Linux box.
:
: Regards,
: Asbjorn Dankertsen
I've had the same problem; but in this case I was the only one writing
to the gdbm file. Note that the gdbm module will perform its own locking,
if you try to tie a gdbm file to a hash and the file is already in use,
it will fail.
After this experiance, I wouldn't recommend using gdbm for any data
you want to keep; it's nice for tempory files, though.
--Dave
--
Dave Schenet - newsuser@spamtrap.shodan.net.
Getting my valid email address is a two step process.
First, delete spamtrap. Second, replace newsuser with shodan.
------------------------------
Date: 10 Oct 1998 18:09:59 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Fun with Arrays of Hashes
Message-Id: <6volvn$3c9$1@monet.op.net>
In article <361FA215.4DCCAC6A@america.net>,
Garry T. Williams <garry@america.net> wrote:
>Ronald J Kimball wrote:
>>
>> Garry T. Williams <garry@america.net> wrote:
>>
>> > #$array[0] = (%hash = ('var1',$var1,'var2',$var2) );
>> Actually, $array[0] gets 4, the number of items in the list.
>
>Yup. You're right. The reason is that this is an *array* assignment --
>not a *list* assignment as I had thought.
Nope! It's a list assignment. There's no such thing as an array
assignment. (Or rather, the inner assignment is a list assignment,
and the outer one is a scalar assignment.)
Let's see some examples that will clear up what is going on here.
$x = @array
Here the right-hand side is an array expression in scalar context.
The value of the expression is the number of elements in the array.
$x = (3,7)
Here the right-hand side is a scalar comma operator expression. The
scalar comma operator returns its second argument; in this case that
is 7.
@array = (3,7)
Here the right-hand side is a list constructor comma operator
expression. It constructs a list with two elements, which as assigned
to the array.
$x = (@array = (3,7))
Here the right-hand side is an **assignment** expression.
It is not the same as an array expression.
It is not the same as a comma expression.
The value of a list *assignment* expression in scalar context is the
number of elements available for assignment. In this case, it is 2.
$x = (($a, $b) = (3,7)) # $x gets 2
$x = (($a) = (3,7)) # $x gets 2
$x = ( my ($a) = (3,7)) # $x gets 2
This comes in handy in constructions like:
while (($k, $v) = each %hash) {
...
}
The condition of a `while' is in scalar context. The value of the
assignment is 2 (when there are items left in the hash) or 0 (when
there aren't). When `each' runs out of items, it returns an empty
list, the value of the assignment is 0, and the `while' loop exits.
>> Which seems odd, because
>>
>> $scalar = ('var1', $var1, 'var2', $var2);
>>
>> assigns the value of $var2 to $scalar, and
>
>Here, a *list* assignment.
Nope! A scalar assignment. There's no list there. That's the scalar
comma operator, which returns its right-hand operand.
------------------------------
Date: 10 Oct 1998 18:28:29 GMT
From: "Mark N. Salvador" <markns@nsclub.net>
Subject: Help me in getting source code of counter in perl!
Message-Id: <01bdf184$dfd50a60$042bb0cb@crimson>
Pls. help me in finding source code of perl script counter!
I badly need it... thanks!
Mark
------------------------------
Date: Sat, 10 Oct 1998 23:26:29 +0200
From: Fred & Chris <horizons@hol.fr>
Subject: Help to compil or translate Perl in C to make it exe
Message-Id: <361FD105.C68CD706@hol.fr>
This is a multi-part message in MIME format.
--------------90152C0B6B13D43AC10CBA7F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
I know very well Perl and I have wrote a software but this software
must run on system windows 95 without perl.
Anybody can translate it for me this software in C (delphi) and I
compil it directly in .exe. or anybody can compil it for me?
The software is attached.
Thank you for your help
It is really urgent...
Ps: Can you send me by e-mail fred@freudian.com the new program?
--------------90152C0B6B13D43AC10CBA7F
Content-Type: application/x-perl; name="anpe.pl"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="anpe.pl"
#!/usr/bin/perl
print "Traduction du fichier Partenet\n";
print "Fred. FAUCOUNEAU Criateur <fred.freudian.com>\n";
print "Entrez le nom du fichier ` traiter \n";
$entree =<STDIN>; chomp($entree);
open (FILE,$entree) or die ("Impossible de trouver le fichier : $!");
open (FLUTE,'>/home/fred/traite.html') or die ("Oups,probleme :$!");
while (<FILE>) {
chomp;
$offre=$1 if /(Offre.*?X)/;
$date=$1 if /(Date.*?98)/;
$Ale=$1 if /(Ale.*?TD)/;
$duree=$1 if /(Recherche.*?FONT>)/;
$descriptif= $1 if /(R><FO.*?FONT>)/;
$lieu=$1 if /(Lieu.*?FONT>)/;
if (/(B>H.*?FONT)/) { # On est a la fin du record"
$horaires =$1;
print FLUTE "<HTML>";
print FLUTE "<BODY>" ;
print FLUTE " ";
print FLUTE "<TABLE BORDER COLS=1>";
print FLUTE "<TR>";
print FLUTE "<TD><FONT SIZE=1><PRE><B>$offre <B>$date <B>$Ale</PRE></FONT>";
print FLUTE "<BR><FONT SIZE=1><B>$duree  ";
print FLUTE "<CENTE$descriptif</CENTER>";
print FLUTE "<FONT SIZE=1><B><PRE>$lieu <$horaires></PRE></TD>";
print FLUTE "</TR>";
print FLUTE "</TABLE>";
print FLUTE "</BODY>";
print FLUTE "</HTML>";
}
}
--------------90152C0B6B13D43AC10CBA7F--
------------------------------
Date: Sat, 10 Oct 1998 23:43:43 GMT
From: stevenjm@olywa.net
Subject: Re: Help with this code
Message-Id: <6vorff$l25$1@nnrp1.dejanews.com>
In article <361EB11F.56C8ADAE@netwave.ca>,
Imran Zalfackruddin <imran@netwave.ca> wrote:
> Hello:
>
> I have attached a snip of a code. I am getting a syntax error on the
> assignment to the
> FORM array. What is wrong with the code??? Any help would be greatly
> appreciated.
>
> Regards.
> Imran.
>
> --------------------------------------------
> open(IN,"</var/apps/xxxx.dat");
> while(<IN>) # For each line of the file:
> {
> #
>
> #
> # SPlit the inputline into its subcomponets
> # Each line has 40 sub components
> #
>
> @hold = split(/:/,$_);
>
> if(/^#/) { next; } # Discard comments.
If you are discarding the comments, shouldn't your if/next statement above be
before the split? Seems a waste to attempt a split and then throw away the
results (if any).
Another way to do it, that I think is easier to read..
/^#/ and next;
though I'd tend to do something like /^\s*#/ just in case someone hit the
spacebar by mistake. :-)
Matthew covered most everything else I think...
Steve
blackwater-pacific.com
>
> $FORM{'sessions'} = $hold(21); <--------------
> syntax error here
> $FORM{'expiration'} = $hold(9);
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Oct 1998 18:21:13 GMT
From: "Mark N. Salvador" <markns@nsclub.net>
Subject: Help!!! in manipulating database file (dbf) using perl in HTML
Message-Id: <01bdf183$dc17d0c0$042bb0cb@crimson>
Pls. help me re: manipulating the database files (dbf) using perl
scripts...
and also how to create an output HTML file...
Thanks..
Mark.
------------------------------
Date: 10 Oct 1998 17:32:11 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How do I use die?
Message-Id: <6vo26b$7r$1@gellyfish.btinternet.com>
On Fri, 9 Oct 1998 23:53:03 -0500 brettr <brettr@centuryinter.net> wrote:
> I'm running this simple little script for testing:
>
> #!/usr/bin/perl
> chdir('/user/printer');
> print "Content-type: text/html\n\n";
> print "<HEAD>\n";
> print " <TITLE>New User</TITLE>\n";
> print "</HEAD>\n";
> print "<BODY>\n";
> print "<P><HR><P></BODY></HTML>\n";
>
> It runs fine. However, if I replace the second line with either of these, I
> get Internal Server Error.
> chdir('/user/printer')or die();
> chdir('/user/printer') or die;
>
It is hardly ever a good idea to die() in a CGI program because it will
result in a mesasge that does little for your debugging and will be confusing
to a user.
In your example you could try something like:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HEAD>\n";
print " <TITLE>New User</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
if(chdir('/user/printer'))
{
print "CHDIR succeeded\n";
}
else
{
print "CHDIR failed - $!\n";
}
print "<HR><P></BODY></HTML>\n";
the module CGI::Carp will help you to provide useful logging messages
to both you in debugging and to the server log.
You can also trap the __DIE__ and __WARN__ pseudo signals and provide
useful debugging information thus:
BEGIN
{
$SIG{__WARN__} = $SIG{__DIE__} = sub {
print "Content-type: text/html\n\n";
print <<EOBLAH;
<HTML><HEAD><TITLE>Error message</TITLE></HEAD>
<BODY>@_</HEAD>
EOBLAH
}
}
But I have to emphasize that code like this should be used for debugging
purposes only - you will want to find a more robust method of handling
failures in production code as has been periodically discussed here.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 10 Oct 1998 21:58:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How do I use die?
Message-Id: <Pine.HPP.3.95a.981010214233.19813F-100000@hpplus01.cern.ch>
On 10 Oct 1998, Jonathan Stowe wrote:
> It is hardly ever a good idea to die() in a CGI program because it will
> result in a mesasge that does little for your debugging
I'd suggest that's only half right. Done properly, a diagnostic on the
browser is worth two in the log file.
> and will be confusing to a user.
That's true enough, but can you think of something better? Yes, OK, it
depends on whether the cause of the problem was something that would
be meaningful to the user (they submitted an invalid request) or not
(the process ran out of some obscure OS resource and couldn't
continue, there was an error in your code, whatever).
> the module CGI::Carp will help you to provide useful logging messages
> to both you in debugging and to the server log.
Aha, now you're talking. May I suggest
use CGI::Carp qw(fatalsToBrowser);
Seems to work for me.
(good stuff omitted)
------------------------------
Date: Sat, 10 Oct 1998 17:03:01 -0500
From: "Onramp Houston" <williams@clark.net>
Subject: How to Load and Use Library Modules in Win32
Message-Id: <6volik$jp6$1@news.onramp.net>
This is a simple one, but I can't seem to find a good ref as to how to load
and use even the standard libs on Win95 Perl.
Can someone just point me to a good source.
Many Txs.
------------------------------
Date: 10 Oct 1998 23:46:27 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How to: Add data to mSQL db from CGI script ?
Message-Id: <6voo43$c4$1@gellyfish.btinternet.com>
On 9 Oct 1998 15:14:59 GMT James D. Meacham <jmeacham@wittgenstein.jhuccp.org> wrote:
>
>
> So here's my task from the powers that be:
>
> I need to take the input from a form on our web site and have it sent to an
> SQL database. Now, I've chosen mSQL because I've used it before and it seems
> to have good support in Perl, my CGI language of choice. Perusing the docs
> for the mSQL module, I noticed that no mention is made of adding data, just
> retrieving it. So the question is, is there a module or extenstion that will
> allow me to add data to my mSQL database without having to script the enitire
> conversation? I'm a little new to the database thing, so any help would be
> gratefully accepted. Peace,
>
Nothing that "INSERT INTO <blah> VALUES ("blah","blah","blah")"
couldnt do ?
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 20:00:52 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Issuing remote commands trough sockets.
Message-Id: <6voat4$b3$1@gellyfish.btinternet.com>
On Mon, 05 Oct 1998 16:59:34 -0400 Farley Christian <cfarley@mlink.net> wrote:
> Most of the examples that i've seen on that subject have the server
> print "hello world" on the client.
>
> How can i have a script execute a command on a remote machine (like rsh)
> and collect back the output from that command?
>
The perlipc manpage is a good source for this kind of information.
You might also want to look at the unix manpage for rexec and also the
relevant rfc's which are probably too numerous to remember (for me on
saturday night anyhow).
if you look at the client and server examples in the eg/ directory of the
perl distribution you might also get a suggestion as to how something of this
sort could be achieved. You could have the server program run some random
program and return the output if you wanted.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 23:08:52 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: mSQL and DBI Problem in PERL
Message-Id: <6voltk$bo$1@gellyfish.btinternet.com>
On Fri, 09 Oct 1998 20:46:06 +0000 Alex Farber <alex@kawo2.rwth-aachen.de> wrote:
> Mdevivio wrote:
>> Can anyone tell me why this runs from the command line and not a web page?
>>
>> print "Content-type: text/html\n\n";
>>
>
> Shouldn't it be print "Content-Type: text/html\n\n"; ?
> ^
Erm One of either A) No or B) it doesnt matter.
I would err toward the former.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 10 Oct 1998 13:13:26 +0000
From: Austin Schutz <spamsux-tex@habit.com>
To: neal@make-a-store.com
Subject: Re: Net::Whois for new Internic output?
Message-Id: <361F5D76.2C02@habit.com>
neal@make-a-store.com wrote:
>
> Forget this message. I modified Whois.pm. If anyone needs this, just let me
> know.
>
Why not ask the module author?
Austin
------------------------------
Date: 10 Oct 1998 22:19:28 GMT
From: sattars@aol.com (SattarS)
Subject: NETWORK & GRAPHIC CARD INFO
Message-Id: <19981010181928.01520.00008841@ng104.aol.com>
Hi,
Can anyone tell me how to get Network card and Graphic Card details from Perl?
Thanks
------------------------------
Date: 10 Oct 1998 23:43:52 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Newbie question RE: SSI and .cgi scripts on NT4
Message-Id: <6vonv8$c1$1@gellyfish.btinternet.com>
On Sat, 10 Oct 1998 13:35:57 +0100 Adrian Albin-Clark <adrian@pearl.demon.co.uk> wrote:
>>If you want to do the <!--#exec cgi ... --> stuff referenced above you need
>>SSI.
>>
>>Because that stuff IS SSI (which means Server-Side-Includes by the way).
>>
>>To install it on an NT server? Well first you install webserver software on
>>you NT server... The documentation for that webserver software may tell you
>>where to go next.
>>
>
> Webserver is IIS2 as bundled with NT Server 4. The docs don't say how to
> set up SSI, in fact they do not even mention it. That's why I am asking
> here. Perhaps I should redirect this question to an NT4 newsgroup
> instead.
>
I would. I would also get Service pack 3 for NT4 at least. I must admit that
SSI is though poorly documented (on that platform) - but still no excuse for
asking a server question in a perl newsgroup.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 10 Oct 1998 14:47:10 -0500
From: Jeff Hunter <jhunter@igg-tx.net>
Subject: Perl advice
Message-Id: <361FB9BD.B4451461@igg-tx.net>
To all,
I've been asked to replace a binary program (no sorce code avail.) that
no longer does what we need it to. I'd like to use perl, but this may be
too complex a problem. As input, there is a text file with anywhere from
20 to 2000 lines, each line with 15 fields - always in the same order
but of varying length. Something like this:
Group1|192.33.21.1|255.255.255.0|darkstar|C|WACAFF|MGCS-SDR-DRSS|0...etc
Group1|..etc
Group1|...etc
Group2|...etc
Group2|...etc
Group3|...etc
the output would be configuration files:
acl_xhost - one file for each group (field 1) containing all the host
names in that group.
acl_dfstab - same as above except each host seperated by semi-colon
a file for each hostname containing a single word related to a code in
one of the fields
finally a single file with several sections that would list all the
groups, and lists of cross
references between selected fields.
Is it possible to read the input file into a hash array (without
knowing how many groups there are total, or how many hosts are in each
group) and then pull the data out of the array to
complete these files? Any advice on how efficient this will be and how
to utilize a hash in this way would be appreciated.
Jeff
------------------------------
Date: 10 Oct 1998 17:00:14 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl FTP API
Message-Id: <6vo0ae$7n$1@gellyfish.btinternet.com>
On Fri, 09 Oct 1998 20:17:34 -0400 Chris Stolpe <cstolpe@acm.org> wrote:
> Is there a Perl FTP API available?
>
That will be the Net::FTP module that comes with the libnet bundle that
is available from CPAN.
The module has methods for most of the FTP commands and should be enough
for all but the most esoteric needs.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 18:24:03 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problem with perlmodules
Message-Id: <6vo57j$82$1@gellyfish.btinternet.com>
On Sat, 10 Oct 1998 11:56:06 GMT Hampus Brynolf <hampus@globetree.org> wrote:
> I really think I got something wrong here...
>
<snip>
>
> My question:
> * When i write :
> use vfv.pm;
> is that script actually executed, and the 'open' instructions in the
> script performed?
>
Er, no.
When you 'use' a module its methods and variable are optionally exported
into the namespace of your script or you can create an instance of the
class that the module describes.
Whichever way you do it you must nonetheless call a subroutine or method
of the module in order for it to do anything. (You probably could do something
to cause it to automagically run some method on being used but thats a little
out of your scope here.)
I would suggest that you read the perlmod manpage and perhaps take a little
time to look at the design of your application. It can also be instructive
to look at the way that other modules work and are used.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 19:45:50 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <6voa0u$at$1@gellyfish.btinternet.com>
On Sat, 10 Oct 1998 12:23:27 GMT droby@copyright.com wrote:
> In article <361E6964.9AC57F95@min.net>,
> John Porter <jdporter@min.net> wrote:
>> droby@copyright.com wrote:
>> >
>> > > All IPv7 addresses are four-letter words. Neat!
>> >
>> > Unfortunately, it's a step backward. After posting this silliness, I went
>> > looking at RFCs. IPv6 addresses are 128 bits, and I'm sure you'll be happy
> to
>> > know the text representation is described in RFC 1884 as:
>> >
>> > <quote> The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the
>> > hexadecimal values of the eight 16-bit pieces of the address. </quote>
>> >
>> > I guess we'll just have to be twice as vulgar.
>>
>> Well, maybe they're four 32-bit characters.
>> Unicode can do that, right?
>> So you can be vulgar in vulcan.
>>
>
> Guess I should have looked at the Unicode spec while I was at my research.
> I'll just have to learn vulcan.
ghuy'cha'
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 23:37:59 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problems with dyn load of SDBM_File
Message-Id: <6vonk7$bu$1@gellyfish.btinternet.com>
In comp.lang.perl.misc virgil <horst.k@netway.at> wrote:
> Hi there,
>
> I am trying to use the Apache::ASP Module. The whole installation seams
> to be ok,
> but at runtime I get the following error message (in
> /var/log/httpd-error.log):
>
>
> # log begin
>
> /usr/sbin/httpd: can't resolve symbol 'Perl_markstack_ptr'
> /usr/sbin/httpd: can't resolve symbol 'Perl_stack_sp'
> /usr/sbin/httpd: can't resolve symbol 'Perl_sv_yes'
> /usr/sbin/httpd: can't resolve symbol 'Perl_stack_base'
> /usr/sbin/httpd: can't resolve symbol 'Perl_Sv'
> /usr/sbin/httpd: can't resolve symbol 'Perl_na'
> [Fri Oct 9 09:55:48 1998] [error] Can't load
> '/usr/lib/perl5/i586-linux/5.00404/auto/SDBM_File/SDBM_File.so' for
> module SDBM_File: Unable to resolve symbol at
> /usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166.
>
Nasty.
I reckon that you have got a distribution of Linux that came with all
of Perl and Apache / mod_perl precompiled yeah ?
And then you got Apache::ASP and all this happened.
You will need to recompile *all* of the elements I'm afraid.
Recompile Perl first and install. Then rebuild mod_perl and Apache.
This could get well out of Perl-land however. You may have further
problems that you would probably would be taking up with another forum.
It can be got to work though.
Have fun
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 17:50:48 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Question about locking files
Message-Id: <6vokro$342$1@monet.op.net>
In article <361faea0.11532993@news.iaehv.nl>,
Serial # 0 <Webchick@Cry.com> wrote:
>I noticed that the script always locks a file before it reads it! But
>I think you should only lock a file when there are more users writing
>to the same file.
And how do you know that there aren't any users writing to the file?
> Am I right or do I have it all wrong??
Both.
You lock it because you want to make sure that there *aren't* any
other users writing to the file. Unless you lock it, you can't be
sure.
------------------------------
Date: 10 Oct 1998 21:38:01 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Question/Logging Scripts
Message-Id: <6vogj9$bb$1@gellyfish.btinternet.com>
On Wed, 07 Oct 1998 19:51:09 -0400 brian d foy <comdog@computerdog.com> wrote:
> In article <Pine.GSO.4.02A.9810071351510.4710-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> posted:
>
>>On Wed, 7 Oct 1998, steve wrote:
>>
>>> Anyone know how i can log the refering url when someone comes
>>> to my page.
>>
>>Sounds as if you're doing something with a webserver. The docs, FAQs, and
>>newsgroups about webservers and related issues may be helpful.
>
> maybe he wants to write a mod_perl handler. in that case the current
> Perl Journal might be useful as well ;)
And i thought we had got over that nasty rash of mod_perl questions from
the previous week ;-P
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 10 Oct 1998 23:51:55 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: reg-exp: change < to < but keep <I> - look ahead?
Message-Id: <6vooeb$c8$1@gellyfish.btinternet.com>
On Sat, 10 Oct 1998 13:24:12 +0000 Alex Farber <alex@kawo2.rwth-aachen.de> wrote:
> Abigail wrote:
>> Alex Farber (alex@kawo2.rwth-aachen.de) wrote on MDCCCLXV September
>
>> ++ But how do you still allow people using <I>, </I>,
>> ++ <A HREF=""> and </A> ? I guess it is probably done
>> ++ somehow with (!=...)
>>
>> No, because there are way too many cases you would like to consider.
>> use HTML::Parser;
>
> Hi,
>
> thanks for the advice. I unfortunately made a typo: (?!...).
> Isn't it possible with a look ahead reg. exp.? I wonder how
> ?! and ?= are usually used.
>
That is discussed in the perlre manpage. However for the problem as you
described you will want to use some well developed module to deal with the
problem of parsing arbitrary HTML. If you need an example search this
newsgroup for HTML::Parser on DejaNews.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 10 Oct 1998 19:55:37 GMT
From: etrim@my-dejanews.com
Subject: size of file
Message-Id: <6voe3q$2tu$1@nnrp1.dejanews.com>
Hey, I am trying to find out the size of the file stored on a different
server using
$filename = "http://www.whats-up.com/whats-up.gif";
$idfilesize = -s "$filename";
but this does not work for some reason. Any help how i could do this would be
appreciated,
erik.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Oct 1998 13:19:17 -0700
From: Ben Gertzfield <che@debian.org>
Subject: Re: size of file
Message-Id: <yttvhlsnpa2.fsf@gilgamesh.cse.ucsc.edu>
>>>>> "etrim" == etrim <etrim@my-dejanews.com> writes:
etrim> Hey, I am trying to find out the size of the file stored on
etrim> a different server using
etrim> $filename = "http://www.whats-up.com/whats-up.gif";
etrim> $idfilesize = -s "$filename";
etrim> but this does not work for some reason. Any help how i
etrim> could do this would be appreciated,
Unless you have a filename called
"http://www.whats-up.com/whats-up.gif", there's no way in heck -s is
going to find the size of it! :) Perl may be smart and oftentimes "do
what I mean", but this is stretching it a bit far.
Take a look at the 'libwww-perl' (or sometimes called LWP) set of Perl
modules. They're available at CPAN (http://www.cpan.org/). LWP's home
site is http://www.linpro.no/lwp/ .
Ben
--
Brought to you by the letters Z and D and the number 17.
"Wakarimasu ka?" "Ee!" "Wakarimasen ka." "Ee." -- Tenchi Muyo-!
Debian GNU/Linux -- where do you want to go tomorrow? http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.
------------------------------
Date: Sat, 10 Oct 1998 15:49:53 -0300
From: "Commitman" <commitman@digitalnet.com.br>
Subject: Votem na lammertech
Message-Id: <6voa67$ldo$1@srv4-poa.nutecnet.com.br>
Galera, entra na pagina da LammerTech
www.digitalnet.com.br/clientes/lammertech ) e votem na lammertech, ajudem a
LammerTech ` Ajudar vc.
"Somente com o seu voto poderemos fazer uma lammertech melhor"
he he he
Ps: La tem um tutorial de perl !
------------------------------
Date: Sat, 10 Oct 1998 12:27:16 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Why it doesn't work under UNIX??????
Message-Id: <361FB514.F06B8911@mcmahon.qal.berkeley.edu>
Why would it? These lines make no sense at all to me:
> @txt = <*.txt>;
> @zip = <*.zip>;
you're asking perl to take the lines in a filehandle called *.zip (which, by the
way, could add lots of troubles since * also signifies a typeglob), and make
them the elements of an array, @zip. Problem is, there's no filehandle called
*.zip, since you haven't opened the filehandle!
It's not entirely clear what you're trying to do, but you could try something
like:
$zips = `ls *.txt`;
@zip = split(/\s+/,$zips);
which has a somewhat better chance of getting you somewhere....
Andy Perrin
Michael Yevdokimov wrote:
> #!/usr/local/bin/perl
> #
> ####$destdir =
> "/usr/local/etc/httpd/basicnet.sonnet.ru/data/devtools/components/vb_r";
> @txt = <*.txt>;
> @zip = <*.zip>;
> open (OUT,">index.html");
> print OUT "<html>\n<head>\n<title>Listing of files</title>\n";
> print OUT "</head>\n";
> print OUT "<body bgcolor=white text=black>\n";
> #Link files
> foreach ( @zip )
> {
> print OUT "<table border=0 cellpadding=2 width=593 height=97>\n";
> #Description files processing
> foreach ( @txt )
> {
> print OUT "<tr><td width=476 height=19 valign=top bgcolor=#004080>\n";
> print OUT "<a href=\"$_\">$_</a>\n";
> print OUT "</td>\n";
> print OUT "</tr><tr>\n";
> print OUT "<td width=593 height=16
> colspan=2><strong><em><small>Description:</small></em></strong></td>\n";
> print OUT "</tr><tr>\n";
> print OUT "<td width=593 height=42 colspan=2 valign=top><small>\n";
> open(IN,"$_");
> #print OUT "<pre>\n";
> while(<IN>) {
> print OUT "$_";
> }
> #print OUT "</pre>\n";
> close(IN);
> print OUT "</small></td>\n";
> print OUT "</tr>\n";
> }
> print OUT "</table>\n";
> }
> print OUT "</body>\n";
> print OUT "</html>";
> close(OUT);
> exit(0);
> ----------------------------------------------------------------------------
> -
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable
> to complete your request.
> Please contact the server administrator, flanker@sonnet.ru and inform them
> of the time the error occurred, and anything you might have done that may
> have caused the error.
>
> --
>
> Michael Yevdokimov (flanker@sonnet.ru)
> --------------------------------------------------------------------------
> Developers Support Site
> Web: http://www.basicnet.sonnet.ru
> E-mail: quests@basicnet.sonnet.ru
> --------------------------------------------------------------------------
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: 10 Oct 1998 13:05:39 -0700
From: Ben Gertzfield <che@debian.org>
Subject: Re: Why it doesn't work under UNIX??????
Message-Id: <ytt3e8wp4h8.fsf@gilgamesh.cse.ucsc.edu>
>>>>> "Andrew" == Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu> writes:
Michael> Why would it? These lines make no sense at all to me:
Michael> @txt = <*.txt>; @zip = <*.zip>;
Andrew> you're asking perl to take the lines in a filehandle
Andrew> called *.zip (which, by the way, could add lots of
Andrew> troubles since * also signifies a typeglob), and make them
Andrew> the elements of an array, @zip. Problem is, there's no
Andrew> filehandle called *.zip, since you haven't opened the
Andrew> filehandle!
Ouch! Andrew, that's not true at all.
>From man perlop:
If the string inside angle brackets is not a filehandle or
a scalar variable containing a filehandle name or
reference, then it is interpreted as a filename pattern to
be globbed, and either a list of filenames or the next
filename in the list is returned, depending on context.
One level of $ interpretation is done first, but you can't
say <$foo> because that's an indirect filehandle as
explained in the previous paragraph. (In older versions
of Perl, programmers would insert curly brackets to force
interpretation as a filename glob: <${foo}>. These days,
it's considered cleaner to call the internal function
directly as glob($foo), which is probably the right way to
have done it in the first place.) Example:
while (<*.c>) {
chmod 0644, $_;
}
is equivalent to
open(FOO, "echo *.c | tr -s ' \t\r\f' '\\012\\012\\012\\012'|");
while (<FOO>) {
chop;
chmod 0644, $_;
}
In fact, it's currently implemented that way. (Which
means it will not work on filenames with spaces in them
unless you have csh(1) on your machine.) Of course, the
shortest way to do the above is:
chmod 0644, <*.c>;
Andrew> It's not entirely clear what you're trying to do, but you
Andrew> could try something like: $zips = `ls *.txt`; @zip =
Andrew> split(/\s+/,$zips);
Andrew> which has a somewhat better chance of getting you
Andrew> somewhere....
Please be a little more careful before you answer questions like that.
--
Brought to you by the letters B and J and the number 16.
"Step away from the car. This car is protected by Viper." -- TMBG
Debian GNU/Linux -- where do you want to go tomorrow? http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.
------------------------------
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 3944
**************************************