[9985] in Perl-Users-Digest
Perl-Users Digest, Issue: 3578 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 28 18:03:17 1998
Date: Fri, 28 Aug 98 15:00:24 -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 Fri, 28 Aug 1998 Volume: 8 Number: 3578
Today's topics:
Another backslash question (Doug)
can not send email with perl, this module, that module (Michael Wang)
Re: CGI Form Refresh <artm@mail.utexas.edu>
Re: Determining strlen <aqumsieh@tigre.matrox.com>
directories <splinter@monmouth.com>
Re: directories <egwong@netcom.com>
Re: even or odd (Doug)
Re: even or odd (Larry Rosler)
Re: Hexdigit <abarfoot@eng.auburn.edu>
Re: Hexdigit (Bob Trieger)
Re: Hexdigit <jefpin@bergen.org>
Re: How do you debug Perl scripts on an ISP? <daniel@NOSPAMstridhammar.pp.se>
Re: How do you debug Perl scripts on an ISP? (Craig Berry)
Re: Misinterpreted => why no true/false keywords? <zenin@bawdycaste.org>
mod_perl configuration marad@usa.net
Need Help with Perl Script (Justin Baugh)
Re: Need Help with Perl Script <splinter@monmouth.com>
Re: Perl <-> Database interface module selitskiy@my-dejanews.com
Re: Perl Cookbook, does anyone have it? indhiraa@hotmail.com
Re: Perl Docs.. forget the original post (Author) (Norman UNsoliciteds)
Re: posting to a program, receiving results <aqumsieh@tigre.matrox.com>
Problem with sending an array to a subrutine <gt2214a@prism.gatech.edu>
Re: problem with substr function <jdw@dev.tivoli.com>
Pydb/DDD. An interesting idea for a GUI perl debugger. John_Cavanaugh@NOSPAM.hp.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Aug 1998 19:45:35 GMT
From: dmr@doug.fc.hp.com (Doug)
Subject: Another backslash question
Message-Id: <slrn6ue2a0.h53.dmr@doug.fc.hp.com>
I get this error:
/www.whatever.com\/: trailing \ in regexp at ./new.pl line 7.
With this code:
5: $fqdn="www.whatever.com\\";
6: $machine_names[1]="www.whoever.com\\";
7: if(grep(/$fqdn/, @machine_names))
8: {
9: ... ...
10: }
I can read the error message, but my attempts of working around
it have failed. Things like:
$fqdn =~ tr/\\//;
$fqdn =~ tr[\][]; #(pukes)
$fqdn =~ tr/\\\\//;
I have a scenario where I'm parsing a common log and this URL
happens by and crashes the program:
http://www.cnn.com\/desktop/desktop_ad.html
"sed s~www.cnn.com\\\\~www.cnn.com~g" worked to remove them, but
I'd like someone to enlighten me towards a elegant solution if you
could.
Thanks!
------------------------------
Date: 28 Aug 1998 20:36:02 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: can not send email with perl, this module, that module
Message-Id: <6s74bi$bjs$1@news.ml.com>
OK, I want to send email using Perl.
FAQ#9 - > Mail::Internet -> Net::Domain -> Data::Dumper.
I managed to have all modules installed, but it still complains.
Can you kindly tell me why?
Why sending email in Perl is such a pain? Why should I install
modules after modules in order to send email?
In Korn shell, it is just
mailx -s "subject" user << EOF
message
body
EOF
Thank you.
[mwangrs][16:20][/home/mwang/PERL]cat sendmail.pl
#!/usr/local/bin/perl
use Mail::Internet;
use Mail::Header;
# say which mail host to use
$ENV{SMTPHOSTS} = 'tech.cicg.ml.com';
# create headers
$header = new Mail::Header;
$header->add('From', 'mwang@tech.cicg.ml.com');
$header->add('Subject', 'Testing');
$header->add('To', 'mwang@ml.com');
# create body
$body = 'This is a test, ignore';
# create mail object
$mail = new Mail::Internet(undef, Header => $header, Body => \[$body]);
# send it
$mail->smtpsend or die;
[mwangrs][16:20][/home/mwang/PERL]perl sendmail.pl
Not an ARRAY reference at /usr/local/lib/perl5/site_perl/Mail/Internet.pm line 193.
--
unix programs: niftp (non-interactive recursive ftp), hide (hide command args),
submit (replace nohup), etc from ftp://ftp.mindspring.com/users/mwang/unix-prog
Michael Wang, mwang@ml.com, Merrill Lynch, World Financial Center, 212-449-4414
------------------------------
Date: Fri, 28 Aug 1998 16:07:14 +0000
From: Art Martinez <artm@mail.utexas.edu>
Subject: Re: CGI Form Refresh
Message-Id: <35E6D5B2.2594@mail.utexas.edu>
Ashley Latham wrote:
>
> Hi,
>
> I have a form set up that calls a perl script. After data is entered the
> script checks the data, adds it to the database and returns a html page
> stating the data has been added or there was an error in the data entry.
>
> All this works fine.
>
> On some browsers when I hit the browser back button I can see the form with
> all the information I have entered as it was just before I hit the submit
> button. This is good in that if an error has been made with the data entry
> the entire form doesn't need to be re-entered, only the fields that are
> wrong.
The best way to handle this is when an error has occured and the user
must go back and correct something, push them the form again with all
the correct fields filled out. That way you dont have to rely on
browser settings and all the fields will be filled ou and you can put
the blurb about an error occuring at the to of that page.
art
------------------------------
Date: 28 Aug 1998 15:56:33 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Determining strlen
Message-Id: <x3y7lzsanim.fsf@tigre.matrox.com>
comdog@computerdog.com (brian d foy) writes:
>
> In article <x3yd89l9n5d.fsf@tigre.matrox.com>, Ala Qumsieh <aqumsieh@tigre.matrox.com> posted:
>
>
> >/<A HREF=http:.*>/i
> >
> >But notice that this is a naive approach. Asterisks are greedy
> >matchers by default .. so you might end up matching something like:
> >
> ><A HREF="http://www.bla.com/>Click <bold>here</bold>
>
> so why not go on to mention the ? modifier which will make the
> match non-greedy?
>
> /<a href=.*?>/i;
>
For two reasons:
1) I wanted him to read more and investigate for himself and try to
find a better solution.
2) Even the ? modifier does not save the day. There is a bit more to
this problem (as you know for sure). Maybe using one of the modules
would be a better idea.
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Fri, 28 Aug 1998 17:16:40 -0400
From: "Matt" <splinter@monmouth.com>
Subject: directories
Message-Id: <6s7743$676$1@news.monmouth.com>
Hi,
I seem to be having a directory problem with my bulletin board script.
When I issue the command
chdir($certaindir);
It doesn't change the directory or doesn't do it fast enough because its
writing all the files to the directory the perl script is in.
Any suggestions?
-Matt
------------------------------
Date: Fri, 28 Aug 1998 21:35:48 GMT
From: Eric Wong <egwong@netcom.com>
Subject: Re: directories
Message-Id: <egwongEyF5Bo.Mxq@netcom.com>
Matt <splinter@monmouth.com> wrote:
: I seem to be having a directory problem with my bulletin board script.
: When I issue the command
: chdir($certaindir);
: It doesn't change the directory or doesn't do it fast enough because its
: writing all the files to the directory the perl script is in.
: Any suggestions?
One suggestion is to check for the return value to make sure
chdir() is doing what you want.
chdir($certaindir) || die "Can't cd to $certaindir, $!";
,Eric
[cc'd]
------------------------------
Date: 28 Aug 1998 20:03:16 GMT
From: dmr@doug.fc.hp.com (Doug)
Subject: Re: even or odd
Message-Id: <slrn6ue3b5.hnl.dmr@doug.fc.hp.com>
>>I don't know how to test the number for even or odd.
>
>You don't? Really? Can you tell us what an even or odd
>number means to you? If you can, you can test for it.
>It's 4th-grade math stuff. Just think it through.
Great. I'm sure that helps him and encourages him to program and
continue to persue PERL. Responses like that will just make him
think you're an ass.
I have over-thought trivial matters before and made them into problems
before as well as not seen things that were right in front of my nose.
If you divide a number by two and it leaves no remainder, it is
even. This will work, there are several other ways of doing it.
@index=(0,1,2,3,4,5,6,7);
LOOP: foreach $number (@index) {
next LOOP if (($number/2) != int($number/2));
print $number."\n";
}
------------------------------
Date: Fri, 28 Aug 1998 14:25:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: even or odd
Message-Id: <MPG.1050c030b133faff989773@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <slrn6ue3b5.hnl.dmr@doug.fc.hp.com> on 28 Aug 1998 20:03:16
GMT, Doug <dmr@doug.fc.hp.com> says...
> >>I don't know how to test the number for even or odd.
...
> >It's 4th-grade math stuff. Just think it through.
...
> If you divide a number by two and it leaves no remainder, it is
> even. This will work, there are several other ways of doing it.
>
> @index=(0,1,2,3,4,5,6,7);
> LOOP: foreach $number (@index) {
> next LOOP if (($number/2) != int($number/2));
> print $number."\n";
> }
As you say, there are several other ways of doing it. This one might be
clearer and faster:
next LOOP if $number % 2;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 28 Aug 1998 14:45:11 -0500
From: andy barfoot <abarfoot@eng.auburn.edu>
To: Jules <julius@clara.net>
Subject: Re: Hexdigit
Message-Id: <Pine.SOL.3.96.980828144046.14234A-100000@leahy.eng.auburn.edu>
It only works for numbers 10 through 15. (256 would become FF, which is
two hex digits long.)
Try
$hex_number = sprintf "%X", 256;
--
andy.barfoot@eng.auburn.edu
On Fri, 28 Aug 1998, Jules wrote:
> $hexdigit = ('a','b','c','d','e','f') [$digit-10];
>
> I tried that with $digit=265 so hexdigit hopefully will become FF or 255
> or, in perl, 0xfff and of course a print STDOUT "$digit is $hexdigit"; But
> it didn't work, I only get the output 256 is (null output for
> $hexdigit that is). So is it me or the book?
------------------------------
Date: Fri, 28 Aug 1998 20:02:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Hexdigit
Message-Id: <6s72ij$gnn$1@strato.ultra.net>
[ posted to usenet and courtesy e-mail sent to andy barfoot ]
andy barfoot <abarfoot@eng.auburn.edu> wrote:
->
->
-> It only works for numbers 10 through 15. (256 would become FF, which is
-> two hex digits long.)
->
-> Try
-> $hex_number = sprintf "%X", 256;
256 translates to 100 in hex.
hex FF is decimal 255.
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: Fri, 28 Aug 1998 16:35:15 -0400
From: Any more mini-dilemmas I should know about? <jefpin@bergen.org>
To: Jules <julius@clara.net>
Subject: Re: Hexdigit
Message-Id: <Pine.SGI.4.00.9808281626570.22725-100000@vangogh.bergen.org>
>$hexdigit = ('a','b','c','d','e','f') [$digit-10];
>and it claims that its a hex digit finder.
>
>I tried that with $digit=265 so hexdigit hopefully will become FF or 255
>or, in perl, 0xfff and of course a print STDOUT "$digit is $hexdigit"; But
>it didn't work, I only get the output 256 is (null output for
>$hexdigit that is). So is it me or the book?
it gives you a hexadecimal DIGIT. Meaning, one of:
0 1 2 3 4 5 6 7 8 9 a b c d e f
Of course, that should only be done for converting the numbers 10 through
15. :)
To convert ANY number from 0 to 15 to hex, do:
$hexdigit = (0..9,'a'..'f')[$digit];
Now... 'FF' is a hexidecimal number. That's a different case entirely.
--
By the pricking of my thumbs, something wicked this way comes.
- "MacBeth" (Shakespeare)
-- Jeff Pinyan | users.bergen.org/%7Ejefpin | techmaster@bergen.org --
NYPM | ICQ# 10222129 | 10222129@pager.mirabilis.com | qw[jeff] on EFnet
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$_=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print;}}
------------------------------
Date: Fri, 28 Aug 1998 21:50:57 +0200
From: Daniel Stridhammar <daniel@NOSPAMstridhammar.pp.se>
Subject: Re: How do you debug Perl scripts on an ISP?
Message-Id: <35E70A20.E5F3AABF@NOSPAMstridhammar.pp.se>
> How do you debug Perl scripts from your PC using only an FTP account and
> a standard www website account?
I don't. I use a webserver on my local computer for testing the scripts.
When I wish to check the syntax I use perl -c myscript.pl When it comes to
debug it's performed in a similar way. Check out the docs.
/Daniel
------------------------------
Date: 28 Aug 1998 19:58:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do you debug Perl scripts on an ISP?
Message-Id: <6s7252$im1$6@marina.cinenet.net>
Roger Hunnicutt (rhunnic@ainet.com) wrote:
: How do you debug Perl scripts from your PC using only an FTP account and
: a standard www website account?
Well, first, in my mind a 'standard www website account' allows telnet
logins, but then again I'm probably out of date in thinking that. :(
Here's the general pattern on how to develop CGIs for a remote box that is
telnet impaired:
* Test your app locally. CGI.pm makes this easier. Work out as many
problems as possible before uploading.
* Use CGI::Carp qw(fatalsToBrowser) to see error messages if something
goes wrong once on the server.
* Use debugging prints (optionally HTML-ized for legibility) to trace
what your code is up to on the server, should the above fail to
provide enough data.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 28 Aug 1998 21:28:54 GMT
From: Byron Brummer <zenin@bawdycaste.org>
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <904339549.217006@thrush.omix.com>
Mark-Jason Dominus <mjd@op.net> wrote:
: In article <904273351.65674@thrush.omix.com>,
: Byron Brummer <zenin@bawdycaste.org> wrote:
: > Better do that with append and read (+>>) or seek(FH, 0, 0) won't
: > work the way you need it to.
:
: Actually, I think you better do that with +<, or the write may not
: work the way you want it to.
Duh...you're right. I always forget the damn double file pointer
magic crap of O_APPEND as I almost never use it with readable
files, and I've yet to see an app that does for legitimate reasons.
: But who's counting?
That's ok, your alternative that I was replying to wasn't portable
anyway (truncate isn't available everywere). <grin>
More reasons why sysopen() is far better then open() for cases
like this. You can make it do what you want without having to
worry about bypassing magic you don't need.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Fri, 28 Aug 1998 20:01:34 GMT
From: marad@usa.net
Subject: mod_perl configuration
Message-Id: <6s72au$7gi$1@nnrp1.dejanews.com>
I'm not sure if this is the best news group for this post, but I can't find
anything better...
After many hassles, I successfully complied Apache 1.3.1 for Linux with
mod_perl, but I still can't seem to get it to actually run scripts. Instead,
it just displays the script. I have searched the newsgroups and FAQs over and
over, but nothing seems to work. My srm.conf looks like this:
AddHandler cgi-script .cgi #Do I need this line? Is it in the way?
Alias /perl/ /usr/apache/share/perl/
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Location>
My access.conf looks like this:
<Directory /usr/apache/share/perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Directory>
<Files *.pl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Files>
Permissions on the scripts are 755, and the rest of Apache is working fine.
The answer is probably obvious, yet I don't know it...
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 28 Aug 1998 20:40:54 GMT
From: baughj@rpi.edu (Justin Baugh)
Subject: Need Help with Perl Script
Message-Id: <35e7149c.2283750@usenet.rpi.edu>
Hi there,
I have been writing a online registration script for
Genericon, a small college-based sci-fi and anime convention here at
Rensselaer. I was wondering if someone could help me with it, I've
been having terrible problems. Being somewhat new to Perl, I can't be
sure if I've made some terrible error somewhere or I'm just not seeing
something, but it will NOT work on a webserver - I always get the 500
Server Error, and the Apache logs say "Premature end of script
headers" - but I swear I'm sending out the headers a-ok. When I run
the script from command line it works okay, in the sense that the CGI
libs say "Offline mode - enter pairs (name=value)".
Anyways, here is the script. If anyone could possibly help please
drop me a line at baughj@rpi.edu. Thanks in advance.
-jdb
#!/usr/bin/perl
#
#
# Genericon Registration Script v1.0_
#
# (C) 1998 Dark Shadow Corporation
#
# Description: What do you think it does, smartguy?
# No, really, it actually processes form
# information and does a lot of neato stuff
# with it. Um, writes logfiles and opens
# pipe to your local friendly sendmail.
#
#
# begin GENERICON-REG
use CGI;
use Text::Wrap;
$longfile = ">>/var/log/genericon/reglog"; # don't remove the
>>!!
$vendor = ">>/var/log/genericon/vendorlog"; # This means you!
$shortfile = ">>/var/log/genericon/shortlog";
$Text::Wrap::columns = 60; # settings for
wrap
$pre1= "\t";
$pre2= "";
$email = "genericon\@netherworld\.stu\.rpi\.edu"; # sendmail config
$email2 = "baughj\@rpi\.edu";
$sendmail = "/usr/sbin/sendmail -t -n";
# error handling subroutine defined here.
#
# crapout (int errornumber);
#
# this subroutine will return appropriate 500 error messages
# should all hell break loose.
#
# i'll make this work later.
#sub crapout ($) {
# my $errornum;
# if ($errornum eq 1) {
# print "Content-type: text/html", "\n";
# print "Status: 500 Server Error";
# print <<End_ErrMsg;
#<title>Genericon Script - Unexpected Error #1</title>
#<h1>The script has encountered error number 1:</h1><br><br>
#<center><i>Cannot open logfiles for writing</i></center><br><br><br>
#Please send email to baughj\@rpi.edu with the content of this error
#message.
#End_ErrMsg
#print STDERR "Genericon Script v 1.0_ - Can't open logfiles!";
#die("ACK!!");
#}
#} # end sub crapout
CGI::ReadParse(); # decode form
return
# make sure everything but comments and vendor has values
#if ($in{name} eq "" OR $in{addr1} eq "" or $in{
if ($in{vendor} eq "Yes") { # output to vendor log
# write to vendor log - NOTE!! vendors don't appear
# in the short "quickie" log!
open VENDLOG, $vendorlog or die ("Logfiles? We don't need no
steenking vendor logfiles!");
print VENDLOG "\n\n";
print VENDLOG "Name : $in{name}\n";
print VENDLOG "Address : $in{addr1}\n";
print VENDLOG " $in{addr2}\n";
print VENDLOG "City/State/Zip : $in{city}, $in{state}
$in{zip}\n";
print VENDLOG "Email Addr : $in{email}\n";
print VENDLOG "Telephone : $in{tele}\n";
print VENDLOG "Registration Fee : $in{option}\n";
print VENDLOG "I am a vend0r : $in{vendor}\n";
print VENDLOG "My comments : \n\n";
print VENDLOG wrap($pre1,$pre2,$in{comments}),"\n";
print VENDLOG "\n\n ----End of registration----\n";
}
else { # not a vendor, so write to short/long logfiles
open SHORT, $shortfile or die ("Logfiles? We don't need no
steenking logfiles!");
open LONG, $longfile or die ("Logfiles? We don't need no steenking
logfiles!");
# print to long logfile
print LONG "\n\n";
print LONG "Name : $in{name}\n";
print LONG "Address : $in{addr1}\n";
print LONG " $in{addr2}\n";
print LONG "City/State/Zip : $in{city}, $in{state}
$in{zip}\n";
print LONG "Email Addr : $in{email}\n";
print LONG "Telephone : $in{tele}\n";
print LONG "Registration Fee : $in{option}\n";
print LONG "I am a vend0r : $in{vendor}\n";
print LONG "My leet comments : \n\n";
print LONG wrap($pre1,$pre2,$in{comments}),"\n";
print LONG "\n\n----End of registration----\n";
# print to short logfile
print SHORT "\n\n";
print SHORT "Name : $in{name}\n";
print SHORT "Address : $in{addr1}\n";
print SHORT " $in{addr2}\n";
print SHORT "City/State/Zip : $in{city}, $in{state}
$in{zip}\n";
print SHORT "Registration Fee : $in{option}\n";
print SHORT "\n\n----End of registration----\n";
}
#some sendmail action
open (SENDMAIL, "| $sendmail");
print SENDMAIL <<Mail_Headers;
From: $in{name} <$in{email}>
To: $email2
Cc: $email
Subject: Genericon Registration
X-Mailer: Genericon Registration CGI v1.0 by DShadow
X-Remote-Host: $ENV{'REMOTE_ADDR'}
$in{comments}
\n
Mail_Headers
#output some mad crazy thanks html
print "Content-type: text/html\n\n";
print <<ThanksHTML;
<html>
<head>
<title>Thanks for registering!</title>
</head>
<body bgcolor=#000000 text=#FFFFFF>
<font face="Arial>
<center><b><font size=+1>Thanks for
registering!</font></b></center><br><br><br>
An invoice will be mailed to you. You can either send a check or
money order back
to us, or you can pay at the door. If you have any questions, please
email
yaddayadda\@rpi.edu.<Br><br>
<a href="index.html">Back to the Genericon XII Homepage</a>
</body>
</html>
ThanksHTML
# maybe send confirmation email here?
# end GENERICON-REG
--------------------perl follows
------------------------------
Date: Fri, 28 Aug 1998 17:03:48 -0400
From: "Matt" <splinter@monmouth.com>
Subject: Re: Need Help with Perl Script
Message-Id: <6s76bv$5pf$1@news.monmouth.com>
A 500 Server error usually means anyone of these:
You have the permissions set wrong on your perl file. chmod 755
You have a syntax error in your script...like a semi-colon out of place
You edit your script in a DOS editor and control M's get stuck in there
What it usually is for me is a syntax error. When I check the system error
log
it tells me what line I misplaced a ; or something.
But what 500 "Malformed Header" means is that it never was able to print
your correct header and instead the browser got a nasty raw error and
couldn't recognize it.
You can run your script with the -w -T options...hopefully the browser will
accept errors as HTML then.
-Matt
------------------------------
Date: Fri, 28 Aug 1998 20:48:55 GMT
From: selitskiy@my-dejanews.com
Subject: Re: Perl <-> Database interface module
Message-Id: <6s753n$b62$1@nnrp1.dejanews.com>
In article <35E5057C.3B3B8393@ar.com.au>,
dante@ar.com.au wrote:
> Howdy... I've tried searching through Dejanews archives and also CPAN
> for info about this, but came up very very empty...
>
> I've got this Btrieve database, and I'd like to be able to read from and
> hopefully write/update it using Perl. I'd be interested to hear any info
> about this. Is there a module around to help with this, like for other
> database formats?
>
> So far I've come up with a way of "sort of" reading the database, but
> only because I know the field widths, and their relation between each
> other, but it would be really good if there was a proper way of doing it
> as my method is very slow (but it works for the purpose at the moment,
> but I'd like to "expand" the purpose of what I'm using the Btrieve db
> for).
>
> If not... from what I gather, and I still don't know too much about
> Btrieve yet, but are there other ways to read/update Btrieve databases
> from Linux, perhaps using C/C++? Any suggestions, pointers of where to
> go would be appreciated.
You can find Btrieve client for Linux and corresponding server communication
module for Btrieve/NT on:
http://www.geocities.com/SiliconValley/Horizon/5151
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 28 Aug 1998 19:59:12 GMT
From: indhiraa@hotmail.com
Subject: Re: Perl Cookbook, does anyone have it?
Message-Id: <6s726g$77p$1@nnrp1.dejanews.com>
In article <904327048.892016@sparc.tibus.net>,
Aidan Rogers <aidan@salvador.blackstar.co.uk> wrote:
> If anyone wants to order the Perl Cookbook, you could order it from
> http://www.blackstar.co.uk/
>
> I don't want to sound like I'm advertising here, but the book will be
> shipped for free worldwide, and most of our US customers get their orders
> within a week. Plus the site is written in Perl (partly by me :)
>
> Aidan
>
www.bookpool.com - These folks give a 34% discount on the cookbook.
They do have it in stock.
Indira.
(PS: I am not marketing for these guys)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 29 Aug 1998 05:54:41 +0900
From: No.unsoiliciteds@dead.end (Norman UNsoliciteds)
Subject: Re: Perl Docs.. forget the original post (Author)
Message-Id: <No.unsoiliciteds-2908980554410001@cs11i33.ppp.infoweb.or.jp>
In article <35E638D8.92F48F09@chesco.com>, maierc@chesco.com wrote:
> !. Do <"WE"> want better docs?
well the set response to any criticism of the bundled docs is "Please feel
free to submit any changes you feel fit."
OK here is an example:- Perl FAQ 2
<<
What are the Perl newsgroups on USENET? Where do I post questions?
The now defunct comp.lang.perl newsgroup has been superseded by the
following groups:
comp.lang.perl.announce Moderated announcement group
comp.lang.perl.misc Very busy group about Perl in general
comp.lang.perl.modules Use and development of Perl modules
comp.lang.perl.tk Using Tk (and X) from Perl
comp.infosystems.www.authoring.cgi Writing CGI scripts for the Web.
There is also USENET gateway to the mailing list used by the crack Perl
development team (perl5-porters) at
news://genetics.upenn.edu/perl.porters-gw/ .
>>
At no point does it explain any the information about how you should
behave in these groups - it tells you how to get here and seems to suggest
you can post questions - but it doesn't have all the diatribe that usually
follows newbies posting.- this should be included (IMO) However I suggest
that this be in a document of the READ ME FIRST kind
Another example, PERLDOC -F PRINTF on my port of Perl (Mac) doesn't do
anything. Why? the answer can be found (sort of) in perl FAQ3
<<
Why don't perl one-liners work on my DOS/Mac/VMS system?
The problem is usually that the command interpreters on those systems have
rather different ideas about quoting than the Unix shells under which the
one-liners were created. On some systems, you may have to change
single-quotes to double ones, which you must NOT do on Unix or Plan9
systems. You might also have to change a single % to a %%.
For example:
# Unix
perl -e 'print "Hello world\n"'
# DOS, etc.
perl -e "print \"Hello world\n\""
# Mac
print "Hello world\n"
(then Run "Myscript" or Shift-Command-R)
# VMS
perl -e "print ""Hello world\n"""
The problem is that none of this is reliable: it depends on the command
interpreter. Under Unix, the first two often work. Under DOS, it's
entirely possible neither works. If 4DOS was the command shell, I'd
probably have better luck like this:
perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>""
Under the Mac, it depends which environment you are using. The MacPerl
shell, or MPW, is much like Unix shells in its support for several quoting
variants, except that it makes free use of the Mac's non-ASCII characters
as control characters.
I'm afraid that there is no general solution to all of this. It is a
mess, pure and simple.
>>
For those of you that didn't spot it and it would be easy to overlook it
as it isn't the main thrust of the FAQ at this point, the Mac version
didn't have the "perl -e" part but requires you to use a key combination
to run the script. I was flamed for having the temerity to ask what these
of quoted one liners like PERL -F MAN(5) meant. I don't have PERLDOC, how
can I know about it as it itsn't written in the documentation (platform
dependant I know but I use Perl like anyone else)
Something else I suspect may make the docs difficult to follow at times is
shown up by these snippets from PERLFUNC, how ever is a widely used style
throughout the Perl Man:
<<
The last command is like the break statement in C (as used in loops); it
immediately exits the loop in question.
>>
<<
If you specify "<&=N", where N is a number, then Perl will do an
equivalent of C's fdopen() of that file descriptor; this is more
parsimonious of file descriptors.
>>
<<
If you want a "real" C open() (see in the open(2) manpage on your system),
then you should use the sysopen() function. This is another way to
protect your filenames from interpretation.
>>
Using the C functions as a shorthand way of explaining the same functions
in Perl requires a foreknowledge of C which not everyone has (though the
purist might be appalled to know this).
> 2. Can someone knowledgable... explain how to accomplish it in a way
> that any changes through perl evolution willl allow these changes to
> follow along?
I hope so.
--
The Dinosaurs were so stupid, they couldn't
even devise the means of thier own extinction,
they had to wait for Nature to do it for them.
------------------------------
Date: 28 Aug 1998 15:39:32 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: posting to a program, receiving results
Message-Id: <x3y90k8aoaz.fsf@tigre.matrox.com>
"Dan Bassett" <dan@bns.com> writes:
>
> I am trying to write a perl program which will post variables to a program
> and then
> read back in the response from that program. The program is a binary
> executable.
> I can run the program from the prompt, but I just can't seem to make it work
> within
> perl.. Is this the correct way to execute a program within perl?
>
> Here's what I have so far:
>
>
> open (RESULTS, "program variable1 variable2" |")
you have one too many quotes .. this should be:
open (RESULTS, "program var1 var2 |")
> or die "The program cannot be found.\n";
>
> $status=<RESULTS>;
>
> close RESULTS;
>
> print "Here is the status: $status";
>
>
> Any feedback would be apprecaited...
Another way to do that would be:
$command = "program var1 var2";
$status = `$command`;
>
> Regards,
>
> Dan
> dan@bns.com
>
>
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Fri, 28 Aug 1998 17:18:34 -0400
From: Alejandro Lay <gt2214a@prism.gatech.edu>
Subject: Problem with sending an array to a subrutine
Message-Id: <35E71EAA.A50D103F@prism.gatech.edu>
Hi and thanks in advance for any help.
I would appreciate that any responses be mailed to me.
Yes I have read the documentation, but still haven't found the solution.
I am fairly new to perl, and I am not a native english speaker, maybe
that's why I couldn't find the answer to this.
The problem is that I have a "|" delimited database which I read in and
then perform many selection operations on it, the problem I am having is
that when trying to pass an array to a subrutine, the array becomes
empty. If I do it without the subroutine, it works fine, but it would
make the code too big and would be easier just to hard code the
database to the script. Any ideas on how to solve this, and an
explication of what is happening wrong would be greatly appreciated.
The database is:
# numero | perfil | foto | sexo | edad | tipoamigos
1|a|no|h|33|ninguno
6|m|si|m|18|locos
<SNIP>...
The code:
<SNIP>...
# at this point I know the users are in @usuarios since since I can
# print tehm out
# print @usuarios;
@usuarios = &depurar(@usuarios,"numeq",4,$fields{edad});
<SNIP>...
### depurar, removes entries from an array that do not match parameters
### param 0 - original array
### param 1 - type of comparison
### param 2 - field number
### param 3 - value to compare
sub depurar {
@ArrayAProc = $_[0];
$TipoComparacion = $_[1];
$NumDelCampo = $_[2];
$ValorDelCampo = $_[3];
# at this point there are no elements in the array, neither in
# @ArrayAProc or in $_[0];
# print @ArrayAProc;
# print $_[0];
@retArray = ();
$len = 0;
for ($u=0;$u<=$#ArrayAProc;$u++){
@tempLineaSUB = split(/\|/, $ArrayAProc[$u]);
if ( $TipoComparacion eq "numeq" ) {
if ($tempLineaSUB[$NumDelCampo] == $ValorDelCampo) {
$retArray[$len] = $ArrayAProc[$u];
$len ++; }
}
elsif ( $TipoComparacion eq "numgteq" ) {
if ($tempLineaSUB[$NumDelCampo] >= $ValorDelCampo) {
$retArray[$len] = $ArrayAProc[$u];
$len ++; }
}
elsif ( $TipoComparacion eq "numlteq" ) {
if ($tempLineaSUB[$NumDelCampo] <= $ValorDelCampo) {
$retArray[$len] = $ArrayAProc[$u];
$len ++; }
}
elsif ( $TipoComparacion eq "texteq" ) {
if ($tempLineaSUB[$NumDelCampo] eq $ValorDelCampo) {
$retArray[$len] = $ArrayAProc[$u];
$len ++; }
}
}
return @retArray;
}
------------------------------
Date: 28 Aug 1998 13:26:14 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: problem with substr function
Message-Id: <ob90k9arp5.fsf@alder.dev.tivoli.com>
bolesbr1@memorialmed.com writes:
> push @array, (split ' ', substr ($line, 105, 12);
>
> In this example, this works fine as long as $line is at least 117 characters,
> but if it is only 100 characters @array doesn't get anything pushed into it.
> I would like @array to get a value of "0" or at least undef if $line is
> shorter than 105 characters. Any suggestion would be greatly appreciated!
how about:
push @array, (length($line) > 105)
? (split ' ', substr ($line, 105, 12))
: 0;
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: 28 Aug 1998 21:13:45 GMT
From: John_Cavanaugh@NOSPAM.hp.com
Subject: Pydb/DDD. An interesting idea for a GUI perl debugger....
Message-Id: <6s76i9$6aa@canyon.sr.hp.com>
I just saw this on freshmeat
http://news.freshmeat.net/1998/08/28/#904288977
Basically its a modified version of pdb (pythod debugger) that allows a
nice interconnect with DDD. If you are unfamiliar with DDD its a totally
kick-butt graphical debugger.
I thought it would be soooo very cool if the same approach could be done
to create a perl interface to DDD. Talk about a kick butt debugging
environment for Perl.
No, Im not volunteering to implement this. But I would be willing
to alpha test if someeone else were to implement.
-----------------------------------------------------------------------
John Cavanaugh Hewlett-Packard Company
Project Engineer 1400 Fountaingrove Pkwy
EESof Division Santa Rosa, CA 95403-1799
Email: cavanaug@sr.hp.com Phone: 707-577-4780
707-577-3948 (Fax)
-----------------------------------------------------------------------
It is the mind that maketh good or ill,
That maketh wretch or happy, rich or poor.
-- Edmund Spenser
-----------------------------------------------------------------------
------------------------------
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 3578
**************************************