[9695] in Perl-Users-Digest
Perl-Users Digest, Issue: 3289 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 29 17:07:19 1998
Date: Wed, 29 Jul 98 14:00:19 -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 Wed, 29 Jul 1998 Volume: 8 Number: 3289
Today's topics:
Re: Dynamic module loading (Thomas Frederick O'Connell)
Re: Finding online users (-)
Re: Finding online users <kbyrne@engin.umich.edu>
Re: How to delete files inside perl script? <cmeena@hotmail.com>
HTML module - would this be useful to you? <rbowen@databeam.com>
Re: I want to separate my Perl from my HTML <gcoulomb@gpu.srv.ualberta.ca>
Re: Nead a Redir Script, Please (-)
Re: Newbie: extracting fields (Tad McClellan)
Re: perl as pseudocode <jdporter@min.net>
Re: Perl Embed Win32 C++ <ed@pdh.com>
Re: Perl variable types problems <lance@nospam.net-school.com>
Q: lpd / sockets / perl / HP750 plotters (Will Morse)
QUERY_STRING sometimes missing from GET tokpela@my-dejanews.com
Re: Request for help with very basic anydbm operation. (Nem W Schlecht)
Re: Request for help with very basic anydbm operation. (Seth Perlman)
test <phkulp@tomco.net>
Re: UID, passwd (Nem W Schlecht)
Re: Unable to get REMOTE_HOST (-)
Re: why is clpm generally used rather than clp? <davidc@selectst.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Jul 1998 15:15:04 -0500
From: tfo@telalink.net (Thomas Frederick O'Connell)
Subject: Re: Dynamic module loading
Message-Id: <tfo-2907981515040001@jesus.telalink.net>
In article <waa67mbfg3g.fsf@ese.UCSC.EDU>, hermit@cats.ucsc.edu (William
R. Ward) wrote:
> Michel Prevost <michel.prevost@cactuscom.ca_REMOVE_TO_MAIL> writes:
> > I would like to dynamically load a module in perl. Preferably using the
> > "use" keyword. I know that when the perl interpreter encounters the
> > "use" keyword, it executes it right way prior to continue compilation.
> > So, it makes impossible to write something like that:
> >
> > $module_to_load = $ARGV[0];
> >
> > use $module_to_load;
i would like to do exactly the same thing.
> Nothing is impossible in a language where you can construct code on
> the fly and execute it (eval). Here's what I do:
>
> eval "use $module_to_load";
> die $@ if $@;
the only problem with this solution is that it does not import any of the
exported functions from $module_to_load for transparent calls. to gain
access to these, i end up having to do this:
eval( "$module_to_load->import();" );
and since import returns undef (i believe; the perl books are not very clear on
this), this is very difficult to test for success.
furthermore, i would like to be able to set module variables in the
traditional manner (e.g. $Getopts::Long::ignorecase = 0;). but now i have
to do this:
eval( "\%${module_to_load}::foo = \%foo;" );
eval( "\%${module_to_load}::bar = \%bar;" );
in fact, every interaction with my dynamic module must occur through an
eval. a style of coding which sort of leaves me uncomfortable and unnerved
(due to less explicit calls and return values as mentioned above with
import(), as well as the general klooginess involved). is there a cleaner
way to do any (or all) of this? i have tried some things with require and
ended up with an equal feeling of gracelessness.
-freddie
------------------------------
Date: Wed, 29 Jul 1998 19:57:41 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Finding online users
Message-Id: <35bf7e59.97527923@news2.cais.com>
christopher michael mabee <mabee@students.uiuc.edu> Said this:
> Hello. I am trying to write a script to find out when certain users
>come on line. So when say "bob" logs on I get a message saying "bob is
>logged on" or something like that. I'm fairly new to the language and any
>help is appreciated. Thanks.
>
Do you mean just "logged on" as in they are connected to the internet,
or that they've gone to a particular web page on your site?
If they have a static IP address, it shouldn't be too hard to initiate
a ping on their IP address every so often, and if there is a returned
packet, they're online, if not, they aren't.
If you want a "log on" page, that's even easier - just log them in.
easy.
------------------------------
Date: Wed, 29 Jul 1998 16:07:53 -0400
From: Keith Byrne <kbyrne@engin.umich.edu>
Subject: Re: Finding online users
Message-Id: <35BF8119.70F40AC6@engin.umich.edu>
christopher michael mabee wrote:
> Hello. I am trying to write a script to find out when certain users
> come on line. So when say "bob" logs on I get a message saying "bob is
> logged on" or something like that. I'm fairly new to the language and any
> help is appreciated. Thanks.
>
> Chris
you don't need to write a perl program to do this. a package of client
programs running under a zephyr server allow you to check for the login of
another user, amoung other things. your school should have this installed,
and if not recommend that they do install it.
------------------------------
Date: Wed, 29 Jul 1998 15:01:16 -0500
From: Meena Chockalingam <cmeena@hotmail.com>
Subject: Re: How to delete files inside perl script?
Message-Id: <35BF7F8C.54097DFA@hotmail.com>
I used unlink and it does not work either.
Meena
Dan Nguyen wrote:
> Meena Chockalingam <cmeena@hotmail.com> wrote:
> : I used backquotes as well as system commands. Nothing seems to work.
>
> I'm in a giving mood. Try using the 'unlink' function.
>
> --
> Dan Nguyen | There is only one happiness in
> nguyend7@msu.edu | life, to love and be loved.
> http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Wed, 29 Jul 1998 16:25:14 -0400
From: Rich Bowen <rbowen@databeam.com>
Subject: HTML module - would this be useful to you?
Message-Id: <35BF852A.5C3C@databeam.com>
I have a module which I use in all of my CGI code development, and was
wondering if anyone else would find this useful. That is, should this be
on CPAN, and, if so, does anyone have a suggested name for it.
You can see the full docs at http://www.rcbowen.com/RCBowen_CGI.html but
it really only does one thing that is (as far as I can tell) unique. The
other 3 functions are pretty generic stuff, but thrown in there so that
I don't have to load another module.
What I am attempting to do is to separate the CGI code from the HTML
output, so that the customer/end-user/clueless person installing my code
does not have to edit Perl code in order to modify HTML output. So, I
put the HTML in HTML files, and Perl code in Perl files. This function
(PrintTemplate) loads up the HTML template file, fills in the variables,
and regurgitates the HTML file. A pretty simple task, but not one that
is really the way that CGI.pm thinks about things.
For example, I might put a tag like
%%%foo%%%
in my HTML template file, then, in my code I would just have to set
$details{foo} = "Value Here" to get that value passed on to the HTML
page. At process time, the %%%foo%%% in the template file would be
replaced with Value Here.
So, my question is whether anyone else other than me sees the value of
this, and, if so, would HTML::Template be a reasonable name for it, or,
am I just missing an existing implementation of this same idea?
Rich
--
###############################################
# Rich Bowen rbowen@databeam.com #
# Web Services Engineer DataBeam Corporation #
###############################################
------------------------------
Date: Wed, 29 Jul 1998 14:32:13 -0600
From: Greg Coulombe <gcoulomb@gpu.srv.ualberta.ca>
Subject: Re: I want to separate my Perl from my HTML
Message-Id: <35BF86CD.12EB432D@gpu.srv.ualberta.ca>
I use separate html resource files that have special tagging in them.
The CGI opens the html file and writes it out, line by line, but when it
finds one of the special tokens, it starts printing out the proper data.
In your case you might do:
open(HTML, "<resource.html");
while(defined $line = <HTML>)
{
print $line;
if ($line =~ /<!--LANGUAGES-->/)
{
foreach $record ( @records )
...
}
}
close(HTML);
Its crude, but it works for me. As long as the tokens are there,
everything is kosher.
pjgeer@my-dejanews.com wrote:
>
> I write CGIs that output HTML. I want to separate the HTML from the Perl so I
> can edit (or have someone else edit) just the HTML by itself, without worrying
> about busting the script. I had been using here docs to handle blocks of HTML
> but I get mad about things like the code below. How can I separate the HTML
> from the Perl?:
> print <<"EOF";
> ...
> <SELECT Name="languages">
> EOF
> foreach $record ( @records ) {
> print "<OPTION Value=\"$record.txt\">$record</OPTION>\n";
> }
> print <<"EOF";
> </SELECT>
> EOF
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
--
Greg Coulombe
Programmer, Orlando Project
Faculty of Arts
University of Alberta
coulombe@cs.ualberta.ca
"It is easier to port a shell than a shell script."
-- Larry Wall
------------------------------
Date: Wed, 29 Jul 1998 19:53:05 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Nead a Redir Script, Please
Message-Id: <35bf7ca5.97091587@news2.cais.com>
"Martin" <minich@globalnet.co.uk> Said this:
>
>OK, so that's not really a major project! <g>
>
>#! Shebang
>
>$file = "cgi-bin/structure.txt";
>open (INF,$file) or die "open $filename: $!";
> @indata = <INF>;
>close(INF);
>
>$url = "";
>$id = $ENV{QUERY_STRING};
>$id =~ s/id=//g;
>foreach $_ (@indata) {
> if ( /$id(.*?)=/i && $1 eq "") {
> $url = $';
> }
>}
>
>print "Content-type:text/html\n\n";
>print <<EndOfHTML;
> <html><head><frameset cols 100%><frame src=$url></head></html>
>EndOfHTML
>;
>Exit;
>
>THAT MIGHT WORK, I HAVEN'T TESTED IT YET.
Well... that's the "quickest" way to do it. But, for local files, you
can simply open them and print them to standard output.... now the
user only sees the URL of the script, and when he views source, all he
sees is the HTML source, no URLs, nothing.
Of course, for external pages, off this server, you'll need to
retrieve the page on the server side, then print it out, as above....
this isn't all that complicated though, there's a couple modules that
allow HTTP connections, and as a quick hack, you can always do this:
$page_content = `lynx -source http://location.com/file.htm`;
Then,
print "Content-type: text/html\n\n";
print $page_content;
will push the page out to the browser as the output for the redir
script
it works, it's just not "portable".
------------------------------
Date: Wed, 29 Jul 1998 12:17:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie: extracting fields
Message-Id: <4flnp6.o22.ln@localhost>
Abigail (abigail@fnx.com) wrote:
: greggman@my-dejanews.com (greggman@my-dejanews.com) wrote on MDCCXCIII
: September MCMXCIII in <URL: news:6pmodc$tev$1@nnrp1.dejanews.com>:
: ++ I'm reading a file one line at a time. A typical line looks like this
: ++
: ++ .fdata.s f'33.011974, f'50.352013, f'-30.042702 ; max
: ++
: ++ How do I get $1, $2 and $3 to be 33.011974, 50.352013, -30.042702
: ++ respectively?
: I would have written it as:
: @numbers = $str =~ /f'([^,]*),/g;
But that won't pick up the third field...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 29 Jul 1998 20:31:59 GMT
From: John Porter <jdporter@min.net>
Subject: Re: perl as pseudocode
Message-Id: <35BF8728.7A1B@min.net>
Adam Atkinson wrote:
>
> On 27-Jul-98 15:43:25, Lavoie Philippe said:
> >create a pseudo->real perl script (and perl->pseudo script to).
>
> Ewwww.... that sounds like far more work than writing non-idiomatic
> but working scripts in the first place. :-)
It certainly would be.
> I was thinking more about things like "Does heavy use of default
> arguments make perl more or less useful as pseudocode?". and
> things like "hard" regular expressions, map, tr, and so on.
Like I said before, use English; then $_ is $ARG, etc.
And avoid using default arguments; so instead of
split;
say
split ' ', $ARG;
and instead of
if ( /(\d+)/ ) {
say
if ( $ARG =~ /(\d+)/ ) {
You could try to avoid using $ARG altogether, but you'll find
that it's not so easy. Sure you could replace
while ( <> ) {
with the less legible
while ( defined($line=<>) ) {
but you can't avoid $_ in places such as grep and map.
But it's no big deal. You can't avoid the use of $a and $b
when you write a sort routine, either.
> "(var, var) =" can probably go, though
No! The idea that lvalues must be scalar entities is an artifact of
the programming language. The idea that function calls, or other
expressions, can evaluate to a vector of values is hardly a
difficult one. And perl supports it nicely.
> > (symbol[i] , prob[i]) = separate the current line at ' '
> >to
> > separate the current line at ' ' then put the result in symbol[i] and
> > prob[i]
>
> yep, I'd agree with that
No; I'll bet you can assume that your audience understands what you mean
when you say
let y = f(x)
And
let (y,z) = f(x)
is not significantly different.
> Hmm. I have to admit this isn't what I was originally thinking about,
> but the idea is intriguing (um. sp?)... a perl "pseudocodifier"...
But not worth wasting time on, IMHO.
--
John Porter
------------------------------
Date: Wed, 29 Jul 1998 12:26:22 -0700
From: Ed <ed@pdh.com>
Subject: Re: Perl Embed Win32 C++
Message-Id: <35BF775D.6BF430F@pdh.com>
Brian Jepson wrote:
> On Tue, 28 Jul 1998 14:04:34 -0700, Ed <ed@pdh.com> wrote:
> >To start out with, I am not a perl programmer and don't really know a
> >whole lot about perl, but was given the task to call a perl program from
> >within my C++ code. I have looked at the perl embed for win32 stuff but
> >still don't have a good idea of how to do this. Most of the programs
> >want to take the command line arguments which I do not want to use (from
> >void main(argc, argv)). I will know the argument (single argument) and
> >the perl program name. I have not seen any really good examples of how
> >to do this. Does anyone have any ideas?
> >
>
> Have you looked at the revised version of the Perl for Win32 FAQ? It is
> included with the ActivePerl distribution at www.ActiveState.com. The FAQ
> includes examples with Makefiles that show how to embed Perl in Visual C++,
> but I'm sure it could be adapted to other C compilers.
>
> You can also find the FAQ on line at:
>
> http://www.activestate.com/support/faqs/win32
>
> Section 10 of the FAQ will be of interest to you. For some reason, the
> link to section 10 is missing from the main page, so you'll have to get it
> at:
>
> http://www.activestate.com/support/faqs/win32/perlwin32faq10.html
>
> Hope this helps,
>
> --
> Brian Jepson * (bjepson@ids.net) * http://users.ids.net/~bjepson
> Choosy mothers choose to chew Chew-Z
>
I hadn't seen those FAQs before. Not sure how I missed them. Thanks Brian.
--Ed
------------------------------
Date: 29 Jul 1998 20:33:32 GMT
From: "Lance Hollman" <lance@nospam.net-school.com>
Subject: Re: Perl variable types problems
Message-Id: <01bdbb2f$c53e66a0$24f186cd@myname>
Thomas van Gulick <melkor@valimar.middle.earth> wrote in article
<6pnu54$anj$1@dinkel.civ.utwente.nl>...
> ${$clan_one}{GAMETYPES} = 31;
> ${$form}{GAMETYPE} = 4;
>
> then ${$clan_one}{GAMETYPES} & ${$form}{GAMETYPE} results in 0 instead of
> the expected 4. This happens in my source code and is probably not easily
check out the differences between bitwise and (&) and logical and (&&) in
perlop.
Lance
------------------------------
Date: Wed, 29 Jul 1998 20:25:05 GMT
From: wtm001@anadarko.com (Will Morse)
Subject: Q: lpd / sockets / perl / HP750 plotters
Message-Id: <EwvI1u.Kq4@anadarko.com>
Hi,
As I have previously posted, I am writing a specialized plotter
interface to some HP 750 plotters that have a Jet Direct card in
them. The JetDirect has an lpd interface so I am trying to write
to that. I am writing the interface in perl 5.004_03.
I have written a "test rig" to try to copy files to the plotter
via the socket interface, and that program is shown below.
The problem I am having is that about 380 characters into the
third message (the "data" file) I lose the connection and the perl
program exitis with "Broken Pipe". I have dummied up a file less
than 380 characters which seems to go through, although you can't
hardly get a good rtl file in less than 380 characters.
I have RFC 1179, which is helpful, but not always clear on fine
points. I have the source for LPRng, which is great but very
general and very complex. I have Programming Perl 2nd edition
and have read its discussion of sockets, as well as the man pages.
I can't think of anything I could be doing wrong to lose the
connection. At this point I am not sure if I am making an
error in the program, the JetDirect card, wrong parameters in
the control file or what. I am making a connection to the
JetDirect Card, but I am not sure if I am making sense to it.
I would really appreciate some pointers on where to look or how
to debug this.
Thanks in advance.
Will
===============================================================
If it makes any difference, these are relevant parameters:
psrv1 574> /opt/hpnp/bin/hpnpadmin -q pl0711
Card Description : HP ETHERNET MULTI-ENVIRONMENT,ROM A.05.03,JETDIRECT,JD24,EEPROM A.05.05
JetDirect ID : 24
psrv1 575> /opt/hpnp/bin/hpnpadmin -i pl0711
Printer Description:
--------------------
MANUFACTURER :Hewlett-Packard;
COMMAND SET :PML,MLC,PJL,HP-GL,HP-GL/2,RTL,POSTSCRIPT;
MODEL :HP DesignJet 750C Plus (C4709A);
CLASS :
Printer ID : 20
psrv1 576> perl -v
This is perl, version 5.004_03
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
psrv1 577> uname -a
SunOS psrv1 5.5.1 Generic sun4u sparc SUNW,Ultra-2
===============================================================
This is the test program:
#! /usr/local/bin/perl -w
#
# program to explore using perl with sockets
#
# for details about the lpd protocol consult RFC1159 which is
# available, among other places, from
# http:/sunsite.doc.ic.ac.uk:/pub/rfc/rfc1159.txt
#
require 5.002;
use Socket;
# $testFilename="/people/wtm001/apcp/small.file";
$testFilename="/people/wtm001/apcp/testPlotFile.rtl";
$blocksize = 320;
$proto = getprotobyname('tcp');
$port = getservbyname('printer', 'tcp');
$ticket = 100;
$hostname = `hostname`;
chomp $hostname;
$username = `whoami`;
chomp $username;
foreach $host (@ARGV)
{
printf "Sending to %-24s\n ", $host;
$hisiaddr = inet_aton($host)
or die "unknown host $host\n";
$hispaddr = sockaddr_in($port, $hisiaddr);
socket(SOCKET, PF_INET, SOCK_STREAM, $proto)
or die "socket $! \n";
connect(SOCKET, $hispaddr)
or die "bind $!";
# send printer name
send (SOCKET,"\2lp\n",0);
$ack1 = " ";
read(SOCKET, $ack1, 1);
$ack1x = unpack("c", $ack1);
printf STDOUT "Printer selection Ack was %s\n", $ack1x;
# constuct the filenames and the control file contents
#
$ticket++;
if ( $ticket > 999)
{
$ticket = 0;
}
if ($ticket < 10 )
{
$ticketx = "00" . $ticket;
}
else
{
if ($ticket < 100)
{
$ticketx = "0" . $ticket;
}
else
{
$ticketx = $ticket;
}
}
$controlFileName = "cfA" . $ticketx . $hostname;
$dataFileName = "dfA" . $ticketx . $hostname;
$hostset = "H" . $hostname . "\n";
$userset = "P" . $username . "\n";
$command = "l\n";
$controlFileContents = $hostset . $userset . $command;
$controlFileLength = length $controlFileContents;
#
&sendControlFile;
&sendDataFile;
#
print STDOUT "-> \n";
send (SOCKET,"\4\n",0);
$queueValues = " ";
read(SOCKET, $queueValues, 4096);
print STDOUT "$queueValues",
close(SOCKET);
print STDOUT "\nByte count = $byteCount fileSize = $fileSize \n";
$hpnp = `/opt/hpnp/bin/hpnpadmin -s $host`;
print "$hpnp\n";
}
# send count controlfilename
# followed by "null"
sub sendControlFile
{
$mo = "\2" .
$controlFileLength .
" " .
$controlFileName .
"\n" .
$controlFileContents .
"\0";
send (SOCKET,$mo,0);
$ack2 = " ";
$ackCount = read(SOCKET, $ack2, 1);
printf STDOUT "Control File Ack Count: %d\n", $ackCount;
$ack2x = unpack("c", $ack2);
printf STDOUT "Control File Ack was %s\n", $ack2x;
$hpnp = `/opt/hpnp/bin/hpnpadmin -s $host`;
print "$hpnp\n";
}
# send count datafilename
# followed by data
sub sendDataFile
{
$fileSize = -s $testFilename;
$mo = "\2" .
$fileSize .
" " .
$dataFileName .
"\n";
send (SOCKET,$mo,0);
open (DF, "<$testFilename");
$byteCount = 0;
# while (! eof(DF) )
while (1)
{
$bytesSent = read (DF, $buffer, $blocksize);
$rc = send (SOCKET, $buffer, 0);
$byteCount += $bytesSent;
print "bytes send $bytesSent - byteCount $byteCount out of $fileSize RC = $rc $!\n";
$hpnp = `/opt/hpnp/bin/hpnpadmin -s $host`;
print "$hpnp\n";
last if $bytesSent < $blocksize;
}
send (SOCKET, "\0", 0);
$ack3 = " ";
$ackCount = read(SOCKET, $ack3, 1);
printf STDOUT "Data File Ack Count: %d\n", $ackCount;
$ack3x = unpack("c", $ack3);
printf STDOUT "Data File Ack was %s\n", $ack3x;
$hpnp = `/opt/hpnp/bin/hpnpadmin -s $host`;
print "$hpnp\n";
}
===============================================================
The typical output:
psrv1 578> p3 pl0711
Sending to pl0711
Printer selection Ack was 0
Control File Ack Count: 1
Control File Ack was 0
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 32 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 64 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 96 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 128 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 160 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 192 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 224 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 256 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 288 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 320 out of 4302874 RC = 32
Printer State : ready to plot
- connected to psrv1.anadarko.com
bytes send 32 - byteCount 352 out of 4302874 RC = 32
Printer State : ready to plot
Broken Pipe
===============================================================
Note that the "- connected to psrv1.anadarko.com" goes away
before the broken pipe.
------------------------------
Date: Wed, 29 Jul 1998 19:58:34 GMT
From: tokpela@my-dejanews.com
Subject: QUERY_STRING sometimes missing from GET
Message-Id: <6pnutb$fk7$1@nnrp1.dejanews.com>
Hi,
I have an index.cgi script written in Perl (running w/Apache) that parses the
QUERY_STRING for information and then logs this to a file. It works *most*
of the time (and always when I try debug it) but sometimes I get blank
entries even though my HTTP_REFERER variables shows the QUERY_STRING present
in the URL.
I thought that this might be a browser problem - but it seems to happen with
newer browsers as well.
Any help is greatly appreciated!
Christopher Taranto
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 29 Jul 1998 15:02:45 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: Request for help with very basic anydbm operation.
Message-Id: <6pnv55$nun@abattoir.cc.ndsu.nodak.edu>
[courtesy copy e-mailed to author(s)]
In comp.lang.perl.misc, Paul <paul@opsi> wrote:
>Hi all,
>I am writing a script to perform a simple search on two basic databases. I
>created the databases from flat text files and the script runs fine on my
>machine running perl for win32. However when I upload the script (and the
>database files one.pag, one.dir, two.pag, two.dir) to my web server and run
Are both machines win32 machines? DBM files, for the most part (Berkeley
DB is the only exception) are *not* necessarily binary compatible across
platforms.
>it, as far as I can tell when the dbmopen occurs the array is not filled
>from the database files, and so no matches are ever returned. One thing I
>have noticed - on the server when the script is run it creates the files
>one.db and two.db, which are of identical size, even though the two
>databases should be very different in size - does this have anything to do
>with it?
DBM files are created in, well, a 'block' method. New 'chunks' of space
are allocated even though they are not filled in. (I'm probably confusing
you more than helping you here). It is possible to have 2 different
databases containing different numbers of elements but they have the same
size.
>use AnyDBM_File;
>dbmopen(%clients,"discounted2",0666);
[deletia]
>dbmopen(%clients,"discounted",0666);
You should put '|| die..' statements after these two dbmopen() calls, just
to see if they are correctly being opened or not.
--
Nem W Schlecht nem@plains.nodak.edu
NDUS UNIX SysAdmin http://www.nodak.edu/~nem/
"Perl did the magic. I just waved the wand."
------------------------------
Date: 29 Jul 1998 16:30:46 -0400
From: seth@fellspt.charm.net (Seth Perlman)
Subject: Re: Request for help with very basic anydbm operation.
Message-Id: <6po0pm$5uf@fellspt.charm.net>
In article <901269763.6292.0.nnrp-01.c2ded04b@news.demon.co.uk>,
Paul <paul@opsi> wrote:
>Hi all,
>I am writing a script to perform a simple search on two basic databases. I
>created the databases from flat text files and the script runs fine on my
>machine running perl for win32. However when I upload the script (and the
>database files one.pag, one.dir, two.pag, two.dir) to my web server and run
>it, as far as I can tell when the dbmopen occurs the array is not filled
>from the database files, and so no matches are ever returned. One thing I
>have noticed - on the server when the script is run it creates the files
>one.db and two.db, which are of identical size, even though the two
>databases should be very different in size - does this have anything to do
>with it?
>The script is attached below:
>Thanks for any help
>Paul Scott
>paulscott@iname.com
>
>
>-----<snip>-----
The dbm/ndbm files are not capable of being simply copied or downloaded
like ordinary files. This is because they consist of non-contiguous
filesystem pages containing the "values" whose offsets are pointed at
by hashed "keys".
A regular copy utility can't reproduce this sparse file correctly and the
result is gibberish which prevents any keys from matching.
1.
To copy dbm files:
print out via a simple perl routine to an ascii file on the original system:
key<tab>value or, if your platform has it, run "makedbm -u"
copy this ascii file, using regular copy, to the destination machine:
recreate the dbm file by reading the ascii file or use "makedbm".
2.
You say the destination host produces "one.db" rather than one.dir and one.pag
If so, your destination perl script is not using DBM/NDBM.
You might try: 'use Fcntl;use NDBM_File' if dbm is what you want to use.
Otherwise, just realize that you are converting to a different file format.
------------------------------
Date: Wed, 29 Jul 1998 16:50:53 -0400
From: Philip Kulp <phkulp@tomco.net>
Subject: test
Message-Id: <35BF8B2C.8F372434@tomco.net>
test
------------------------------
Date: 29 Jul 1998 15:29:33 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: UID, passwd
Message-Id: <6po0nd$o9m@abattoir.cc.ndsu.nodak.edu>
[courtesy copy e-mailed to author(s)]
In comp.lang.perl.misc, Tom Phoenix <rootbeer@teleport.com> wrote:
>On Thu, 23 Jul 1998, Damien Lachuer wrote:
>
>> I'd like to make a web utility to create unix user.
>
>I'd like a program that could create a woman. If she understood Unix,
>so much the better. :-)
I've been looking for this program for some time!! ;-)
(Tell you what, Tom. If you can get most of the internals written, I'll
take care of the interface. *hehe*)
--
Nem W Schlecht nem@plains.nodak.edu
NDUS UNIX SysAdmin http://www.nodak.edu/~nem/
"Perl did the magic. I just waved the wand."
------------------------------
Date: Wed, 29 Jul 1998 19:46:21 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Unable to get REMOTE_HOST
Message-Id: <35bf7bc3.96865534@news2.cais.com>
"Thomas =?iso-8859-1?Q?=D8derud?=" <tho@sn.no> Said this:
>> use Socket;
>>
>> $hostname = gethostbyaddr(inet_aton($ENV{REMOTE_ADDR}),AF_INET);
>>
>> $hostname *should* now hold the host name, if DNS resolution
>> succeeded. If not, it'll just have the IP address - but that's what
>> you'd get with hostname lookups anyway.
>>
>
>Thank you, this worked fine. This is the first time I ever tried to post a
>message to a news group but it will not be the last. Thanks for all help..
>
Glad to help. Just remember to help someone else whenever you have an
answer.... that's how Usenet can continue to be a great resource. ;)
------------------------------
Date: Thu, 30 Jul 1998 06:18:11 +1000
From: David Coldrick <davidc@selectst.com>
Subject: Re: why is clpm generally used rather than clp?
Message-Id: <35BF8383.C6F33022@selectst.com>
Oh good, now we have a thread that can compete with the government
killing people in its relevance. What does it mean for a newsgroup to
exist? I can read (the few) posts in this newsgroup, I have *replied* to
posts in this newsgroup. Ipso facto . . . aw, forget it :-)
I R A Aggie wrote:
>
> In article <35BEAAB9.26A914C9@selectst.com>, David Coldrick
> <davidc@selectst.com> wrote:
>
> + Dumb question time. Is there any reason why this newsgroup is used for
> + perl questions/answers rather than comp.lang.perl? Presumably there's
> + some history to it . . .
>
> 'cause clp doesn't exist?
>
> James - no, really...
------------------------------
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 3289
**************************************