[17037] in Perl-Users-Digest
Perl-Users Digest, Issue: 4449 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 18:15:50 2000
Date: Wed, 27 Sep 2000 15:15:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970092923-v9-i4449@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Sep 2000 Volume: 9 Number: 4449
Today's topics:
Re: How to get length of scalar? <mcarruth@talk21.com>
Re: How to get length of scalar? <zaphod@psnw.com>
Re: How to get length of scalar? <uri@sysarch.com>
Re: How to get length of scalar? <anmcguire@ce.mediaone.net>
Re: How to get length of scalar? <flavell@mail.cern.ch>
How to ingnore case when updating DBM? jthornton@my-deja.com
Re: How to ingnore case when updating DBM? (Logan Shaw)
Re: How to ingnore case when updating DBM? <amonotod@netscape.net>
Re: How to ingnore case when updating DBM? stdenton@my-deja.com
how to read dir info ? <vioon@hotmil.com>
Re: inserting a binary scalar into a DBI blob (Logan Shaw)
Is this routine OK? <rick@iwtools.com>
Re: matching a date <lr@hpl.hp.com>
Re: MySQL vs. mSQL (Abigail)
Re: Non Blocking I/O wsprague100@yahoo.com
Re: Perl & SQL Server <hartleh1@westat.com>
PERL XS language for C extensions help sarmoon@my-deja.com
Re: Problem "no such file or directory"when executing P <amonotod@netscape.net>
Prompt pattern scarlzong@my-deja.com
Re: Questions about space-saving techniques (James Weisberg)
Re: Recommendations for Best Beginners book? <anmcguire@ce.mediaone.net>
Re: regexp woes w/ Text-BibTeX <jdhunter@nitace.bsd.uchicago.edu>
Re: remote machine call to registry... <amonotod@netscape.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Sep 2000 20:22:45 +0100
From: "Mark Carruth" <mcarruth@talk21.com>
Subject: Re: How to get length of scalar?
Message-Id: <8qthfc$26d$1@uranium.btinternet.com>
Why is it you people have such a problem with HTML. Either, get a decent
mail client for Windows, or if you use Unix and you are such a bloody genius
at it to go criticising other people, make yourself a f*c*i*g HTML parser
that will work on Windows.
You will notice that this message is in plain text for you "Challenged"
people.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7u2b28o07.fsf@home.sysarch.com...
did you actually have anything to say? or was it lost in the sea of html
crap?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 12:21:45 -0700
From: Zaphod <zaphod@psnw.com>
Subject: Re: How to get length of scalar?
Message-Id: <39D248C9.C823ADE8@psnw.com>
I have a perfectly good eMail client which parses html just fine!
However that has nothing to do with the fact that common news group
etiquette dictates the use of plain text messages only, thank you very
much!
Mark Carruth wrote:
>
> Why is it you people have such a problem with HTML. Either, get a decent
> mail client for Windows, or if you use Unix and you are such a bloody genius
> at it to go criticising other people, make yourself a f*c*i*g HTML parser
> that will work on Windows.
>
> You will notice that this message is in plain text for you "Challenged"
> people.
>
> --
> -----------------------------------------------
> Mark Carruth
> mcarruth@talk21.com
> "Uri Guttman" <uri@sysarch.com> wrote in message
> news:x7u2b28o07.fsf@home.sysarch.com...
>
> did you actually have anything to say? or was it lost in the sea of html
> crap?
>
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
> The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net ---------- http://www.northernlight.com
--
Zaphod
Technical Director
------------------------------------------------------------------------
TruckLoad2000 A Service of Acquisitions Services, LLC.
------------------------------------------------------------------------
Support: (559) 304-0882 2680 N. Marks suit 106
Direct: (559) 275-0493 Fresno, CA 93722
Toll Free: (866) 275-0493 http://www.TruckLoad2000.com
Fax: (559) 275-0529 email: zaphod@TruckLoad2000.com
========================================================================
========================================================================
------------------------------
Date: Wed, 27 Sep 2000 19:29:32 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to get length of scalar?
Message-Id: <x7lmwd8wh3.fsf@home.sysarch.com>
>>>>> "MC" == Mark Carruth <mcarruth@talk21.com> writes:
MC> Why is it you people have such a problem with HTML. Either, get a
MC> decent mail client for Windows, or if you use Unix and you are
MC> such a bloody genius at it to go criticising other people, make
MC> yourself a f*c*i*g HTML parser that will work on Windows.
get a clue, then get a life. you post jeopardy style as well.
MC> You will notice that this message is in plain text for you "Challenged"
MC> people.
you don't get that usenet is a plain text medium. and suggesting the
people use redmondware is so ludicrous.
(he wrote this and quoted it badly)
MC> did you actually have anything to say? or was it lost in the sea
MC> of html crap?
well, you didn't even read what i had to say. besides the html crap,
there was no content to you message. but i can expect that from twits
like you who think html is proper here.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 27 Sep 2000 15:14:35 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: How to get length of scalar?
Message-Id: <Pine.LNX.4.21.0009271503570.18852-100000@hawk.ce.mediaone.net>
On Wed, 27 Sep 2000, Mark Carruth quoth:
MC> Why is it you people have such a problem with HTML. Either, get a decent
MC> mail client for Windows, or if you use Unix and you are such a bloody genius
MC> at it to go criticising other people, make yourself a f*c*i*g HTML parser
MC> that will work on Windows.
Eh, sure, I always knew the answer was windows, I was just afraid to give
up my career as a sysadmin. Thank you for enlightening me, as I also
suspected that Usenet was a multi-part MIME medium. From now on I shall
post ony multi-part MIME messages.
MC> You will notice that this message is in plain text for you "Challenged"
MC> people.
I ... am .... sorr. You are breaking u....
MC> --
'-- '
[ snip of uri, turned upside down by a troll :-( ]
$usenet->plonk('Mark Carruth');
anm
--
# Andrew N. McGuire
my $j = [ [ qw+ 4A 75 73 74 20 61 0 +] => [ qw+ 6E 6F 74 68 65 72 0 + ] =>
,,,,,,,,, [ qw+ 20 50 65 72 6C 20 0 +] => [ qw+ 48 61 63 6B 65 72 A + ] ];
;;;;;;;;; print map chr(hex()) => map @$_ => map @$j->[$_-0xA], 0xA .. 0xD
------------------------------
Date: Wed, 27 Sep 2000 22:39:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to get length of scalar?
Message-Id: <Pine.GHP.4.21.0009272238080.1270-100000@hpplus03.cern.ch>
On Wed, 27 Sep 2000, Mark Carruth wrote:
> Why is it you people have such a problem with HTML.
It's called netiquette, but you've demonstrated that you wouldn't
understand. So, into the penalty box you go.
[f'ups]
------------------------------
Date: Wed, 27 Sep 2000 21:33:13 GMT
From: jthornton@my-deja.com
Subject: How to ingnore case when updating DBM?
Message-Id: <8qtp2p$li6$1@nnrp1.deja.com>
Do you know how I could modify the code below so that it will ingore
case when checking to see if an entry with the given e-mail address
already exits.
---- original code ----
dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
foreach ($first .. $last) {
$LIST{"$email"} = $realname unless $seen{$email}++;
}
dbmclose(%LIST);
---- what I tried (doesn't work) ----
dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
foreach ($first .. $last) {
$LIST{"$email"} = $realname unless $seen{/$email/i}++;
}
dbmclose(%LIST);
Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 27 Sep 2000 16:46:53 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How to ingnore case when updating DBM?
Message-Id: <8qtpsd$dn2$1@provolone.cs.utexas.edu>
In article <8qtp2p$li6$1@nnrp1.deja.com>, <jthornton@my-deja.com> wrote:
>Do you know how I could modify the code below so that it will ingore
>case when checking to see if an entry with the given e-mail address
>already exits.
>
>---- original code ----
>dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
>foreach ($first .. $last) {
> $LIST{"$email"} = $realname unless $seen{$email}++;
>}
>dbmclose(%LIST);
First, change your $LIST{"$email"} to $LIST{$email}, since the quotes
are wholly superfluous.
>---- what I tried (doesn't work) ----
>dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
>foreach ($first .. $last) {
> $LIST{"$email"} = $realname unless $seen{/$email/i}++;
>}
>dbmclose(%LIST);
The code
/$email/i
will try to match $_ against the pattern $email, only case
insensitively. It will return either a true or false value, and that
will be used as the index for lookups in your (tied) hash.
This doesn't sound useful.
In fact, there is no general way that you can do case-insensitive
lookups in a hash with mixed-case keys. (O.K., there is a way, but the
time required to do so is exponential with the number of characters in
the key for which there is more than one case...)
So, what you want to do instead is store only lowercase or only
uppercase keys in your hash, and then convert strings into lowercase
or uppercase versions before looking them up. So, do this instead:
$LIST{ lc $email } = $realname unless $seen{ lc $email }++;
Or something like that (you may want to store mixed-case versions in
your tied hash for all I know).
Hope that helps.
- Logan
------------------------------
Date: Wed, 27 Sep 2000 21:44:33 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: How to ingnore case when updating DBM?
Message-Id: <8qtpo0$m3n$1@nnrp1.deja.com>
In article <8qtp2p$li6$1@nnrp1.deja.com>,
jthornton@my-deja.com wrote:
> Do you know how I could modify the code below so that it will ingore
> case when checking to see if an entry with the given e-mail address
> already exits.
>
> ---- original code ----
> dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
> foreach ($first .. $last) {
> $LIST{"$email"} = $realname unless $seen{$email}++;
> }
> dbmclose(%LIST);
>
> ---- what I tried (doesn't work) ----
> dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
> foreach ($first .. $last) {
> $LIST{"$email"} = $realname unless $seen{/$email/i}++;
> }
> dbmclose(%LIST);
lc() or uc().
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 21:50:34 GMT
From: stdenton@my-deja.com
Subject: Re: How to ingnore case when updating DBM?
Message-Id: <8qtq37$mhk$1@nnrp1.deja.com>
In article <8qtp2p$li6$1@nnrp1.deja.com>,
jthornton@my-deja.com wrote:
> ---- what I tried (doesn't work) ----
> dbmopen(%LIST, "$db", 0644) or die "Can't open $db.";
> foreach ($first .. $last) {
> $LIST{"$email"} = $realname unless $seen{/$email/i}++;
Now that's something that Perl 6 needs! Except maybe it should be
@seen{/$email/i}
since in general a regex will match multiple strings.
Anyway, how about this:
$lowercase = lc $email;
$LIST{$lowercase} = $realname unless $seen{$lowercase}++;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 23:56:02 +0200
From: "qwerty" <vioon@hotmil.com>
Subject: how to read dir info ?
Message-Id: <8qtqga$j0t$1@tesla.a2000.nl>
I want to read a directory with only the subdirs
Right now i have something like this :
@dir = grep(!/\./, readdir(DIR));
closedir(DIR);
foreach $line(sort(@dir)){
print "<option>$line\n";
etc.
This filters out all the files which contains a dot and shows all
the directories. But if the directory contains a file without a
dot it is listed too, is there a way to show only the directories.
Heard and read about a -d option but could not find a solution.
Thanks.
------------------------------
Date: 27 Sep 2000 16:30:46 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: inserting a binary scalar into a DBI blob
Message-Id: <8qtou6$dk8$1@provolone.cs.utexas.edu>
In article <39d0ad7e$1_3@huge.aa.net>,
Xeno Campanoli <xeno@bigger.aa.net> wrote:
>I'm stumped this morning as to how to assign a binary Perl
>Perl scalar into an Oracle blob through the DBI interface.
>It complains whether or not I use $dbh->quote, and I cannot
>seem to find any other facility in the Perldoc DBI documentation.
>I'd expect a call like $dbh->binary($binarythingy) I suppose,
>but perhaps that's too easy.
Why not do something like this?
$dbh = blah blah blah;
$sth = $dbh->prepare (
qq{
insert into mytable
set blobfield = ?
where otherfield = ?
});
$sth->execute ($blobdata, $whereclausevalue);
Do "perldoc DBI" and read the part about placeholders for more info.
Hope that helps.
- Logan
------------------------------
Date: Wed, 27 Sep 2000 12:17:15 -0700
From: "Rick Freeman" <rick@iwtools.com>
Subject: Is this routine OK?
Message-Id: <hbh4tsk06irl1mmcbddo4dkq38hkqlil65@4ax.com>
I use this little routine quite a bit in various scripts to save data
to disk (in my quirky but useful datafile formats). I'm not very savy
about file locking and concurrent file accesses, though, and wonder if
I'm doing enough to avoid troubles. Would greatly appreciate feedback
on that issue and anything else you see here. I'm including the
routines I use to read the data files, as well, just for reference.
Of course, if anyone likes, feel free to use these :-)
Thanks,
Rick
# This function accepts a filename and reference to a string, array
# or hash, and saves it to disk. Arrays are newline separated,
# Hashes are separated with newlines for records and pipes for fields.
sub write_out {
my ($filename, $ref) = @_;
my $out;
if (ref $ref eq 'SCALAR') {
$out = $$ref;
} elsif (ref $ref eq 'ARRAY') {
foreach $line (@$ref) {
$out .= "$line\n";
}
} elsif (ref $ref eq 'HASH') {
foreach $key (keys %$ref) {
$out .= $key . "|" . $$ref{$key} . "\n";
}
} else { die('Write_out not designed to work with this input!') }
open(FILE, ">$filename.tmp") or die("Write_out couldn't open file,
$filename. $!");
flock FILE, 2;
print FILE $out;
close(FILE);
copy("$filename.tmp", "$filename") or die("Write_out couldn't copy
file, $filename.tmp $!");
unlink("$filename.tmp");
}
# Reads a newline separated array from disk
sub listit {
my $file = shift;
my @data = ();
open(HANDLE, "$file");
@data = <HANDLE>;
close(HANDLE);
chomp @data;
return @data;
}
# Reads Hash from disk
sub tableit {
my $file = shift;
my @data = listit($file);
my %data = ();
foreach $data (@data) {
($key, $value) = split(/\|/, $data, 2);
$data{$key} = $value;
}
return %data;
}
------------------------------
Date: Wed, 27 Sep 2000 12:30:55 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: matching a date
Message-Id: <MPG.143beac9890c6ba198adc8@nntp.hpl.hp.com>
In article <39D03E03.AC7DA890@ooc.com.au> on Tue, 26 Sep 2000 16:11:15
+1000, Derek Thomson <derek@ooc.com.au> says...
> Larry Rosler wrote:
> > In article <39CD6F43.87D2B2F6@ooc.com.au> on Sun, 24 Sep 2000 13:04:35
> > +1000, Derek Thomson <derek@ooc.com.au> says...
> > ...
> > > use Time::Local;
...
> > > eval { timelocal(0, 0, 0, $dd, $mm, $yyyy); };
> > >
> > > if (!$@) {
> > > print "$yyyy-$mm-$dd is okay\n";
> > > } else {
> > > print "$yyyy-$mm-$dd is not a valid date: $@";
> > > }
...
> I'm really reticent to say this, but isn't this wrong in the Perl
> Cookbook? That's where I grabbed the basic code from. You're right,
> though, looking at the Time::Local docs. I just trust Christiansen and
> Torkington implicitly.
>
> "Unexpected, this is" ;)
Mistaken, this is. The examples in Sections 3.2 and 3.7 show
timelocal() without error checking. The ParseDate function from
Date::Manip is used when error checking is desired.
> I suspect that the Cookbook example is incorrect WRT the year as well,
> if the Time::Local doc is right (year is year-1900).
Either year or year-1900 will work. This is a terrible misfeature
introduced in Time::Local to fix the Y2K nonproblem. It is described in
the module's documentation as perhaps being a bug.
> And if that's the code, day-of-month checking *is* too primitive in
> timelocal. I did think it would be stricter.
It should be stricter. Why don't you fix it, and submit a patch?
...
> OK, that does it. timelocal is no good for validation :(
As Christiansen and Torkington are aware.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 27 Sep 2000 20:14:32 GMT
From: abigail@foad.org (Abigail)
Subject: Re: MySQL vs. mSQL
Message-Id: <slrn8t4l6q.lo9.abigail@alexandra.foad.org>
Mark-Jason Dominus (mjd@plover.com) wrote on MMDLXXXIV September MCMXCIII
in <URL:news:39d23340.61f4$2ea@news.op.net>:
@@ In article <vel3tss8mrnigj46lp8vcq8ob2asmklkem@4ax.com>,
@@ Bart Lateur <bart.lateur@skynet.be> wrote:
@@ >PostGreSQL has transactions. MySQL does not. If it's important that your
@@ >data remains integer while being updated by more than just a few people
@@ >simultaniously, that probably will matter.
@@
@@ No, that's untrue. You are correct that MySQL has no transactions.
The most recent versions of MySQL do.
@@ But it doesn't need them because it does not have concurrent updates
@@ of the database; only one query executes at a time.
Eh? There are many reasons you want to have transactions even if there are
no concurrent updates.
@@ This brings with it many other disadvantages, but data corruption is
@@ not one of them.
That depends on your definition of corruption. You certainly can get
inconsistencies. Take for instance two tables, with a one-to-one
relationship. You have a new entity you want to insert, which means you
have to do two inserts, a row in each table.
Your first insert goes fine, but the second fails because your file
system is full. With a normal database, you would do a rollback of your
transaction, or alternatively, to a savepoint.
Without transactions, you lose.
Note also that inserting two dependent rows are two queries. If there are
no transactions, how's the database server going to know you have a second
query coming up?
Furthermore, transactions are not the right tool to prevent problems with
concurrency. You really don't want a query that's running for 24 hours
keeping anyone else from accessing the database. Concurrency problems are
prevented with locks. Pagelocks (on both data and index pages), possibly
escalating to table locks. Or for those who need cursors, rowlevel locks.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
------------------------------
Date: Wed, 27 Sep 2000 19:59:00 GMT
From: wsprague100@yahoo.com
Subject: Re: Non Blocking I/O
Message-Id: <8qtjhu$ggj$1@nnrp1.deja.com>
That is a good idea. However I am writing about 3 lines a second, so I
think the overhead would be extreme. What does everyone think?
Thanks,
W
In article <2xpA5.49$tA.5014@news010.worldonline.dk>,
Anders Lund <anders@wall.alweb.dk> wrote:
> wsprague@my-deja.com wrote:
>
> > Is there a way to non-blocking I/O without using syswrite etc? I am
> > trying to keep a log file and rotate it with logrotate, but my perl
> > program goes to sleep when logrotate deletes the logfile for a few
> > seconds.
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> Each time you wanat to add a line to the log, open it, then write,
then
> close it.
>
> -anders
>
> --
> [ the word wall - and the trailing dot - in my email address
> is my _fire_wall - protecting me from the criminals abusing usenet]
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 17:24:13 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Perl & SQL Server
Message-Id: <39D2657D.3F7B88E@westat.com>
Neb wrote:
>
> In the project I'm working on, I must be able to use SQL Server via ODBC to
> make my Perl program interact with a database. Can someone refer me to
> documentation about this?
Both ODBC.pm and DBI (with the appropirate DBD, in this case DBD::ODBC
seems a good choice) work. Nothing against ODBC.pm but I prefer the
later since if the database is changed in the future, you have less work
to do.
Henry Hartley
------------------------------
Date: Wed, 27 Sep 2000 19:04:06 GMT
From: sarmoon@my-deja.com
Subject: PERL XS language for C extensions help
Message-Id: <8qtgav$ddr$1@nnrp1.deja.com>
Hello out there,
I have a description here of a function I need to create a PERL
extension for:
int PersHierDelDir (PT_HIER_STAT_CB callBackfunc, void * callBackData,
PT_HIER_REQ requestStruct, PT_IPC_REQUEST *requestHandle);
INPUT:
callBackFunc is a pointer to a function in the client application that
will be called when results are returned from the DEX HIER API. The
callback function is responsible for processing the results.
callBackData is a pointer to data that the client application wishes to
pass to the callback function when it is invoked.
requestStruct is the request the client application is submitting to
the DEX HIER API. The request structure is built by means of the helper
functions described above.
requestHandle is a handle that identifies the request and is used by
the IPCManager to match up results with requests.
RETURNS: Success/fail.
DESCRIPTION: This function submits a request to delete the given path
directory. Note that the directory must be empty for the delete request
to succeed. The callback function in the argument list will be called
by the DEX HIER API when results are returned from the DEX.
I guess I have a few questions. First of all - what typemap/data
type combination do I use for a pointer to a function, such as
callBackfunc listed above and for Structures? Secondly, the CODE
section of the XSUB still seems a bit fuzzy to me from the explanations
given on www.perl.com in the XSUB tutorial (which is REALLY basic).
I'm not sure what exactly this section is supposed to
accomplish? Is it to create a wrapper for the "C" function, or
represent the "C" function in PERL. Here is what I have so far in my
*.xs file:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
# include files necessary for
API
#include <stdlib.h>
#include <string.h>
#include <PtStatus.h>
#include <IpcMgr.h>
#include <PHApi.h>
#include <PtGlobal.h>
#ifdef WIN32
extern "C" __declspec(dllexport) XS(boot_PerDex) ;
#else
extern XS(boot_PerDex) ;
#endif
MODULE = PerDex PACKAGE = PerDex
int PersHierDelDir(cbFunc, cbData, reqInfo, reqHandle)
dtype cbFunc # just using dtype for now till I find
out what to use.
void * cbData
dtype reqInfo
dytpe reqHandle
CODE:
int iRC = 0;
iRC = PersHierDelDir(cbFunc, cbData, reqInfo, reqHandle);
RETVAL = iRC;
OUTPUT:
RETVAL
Any help would be GREATLY appreciated, and thanks in advance...
P.S. Also - if I'm WAY off base here, please let me know - thanks again.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 19:51:58 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Problem "no such file or directory"when executing Perlscript
Message-Id: <8qtj4s$g2j$1@nnrp1.deja.com>
In article <39D22720.A729F195@mcd.alcatel.be>,
Paul Vandevelde <paul.vandevelde@mcd.alcatel.be> wrote:
> We have the following problem :in Unix.
> When making Perl-scripts, it sometimes happens that, when you execute
> it in the directory where the script resides, it gives the message
> "no such file or directory",. Reason is mostly that the current
> directory (.) is not in the PATH because Perl will not look in your
> current directory. So, we changed the path-statement, but got the same
> result.
<offtopic>
Aaaaggghhh! Never do that! It's not Perl that's not looking in your
current directory, it's *nix. It is a security measure. Just remember
to type /path/to/script.pl or ./script.pl.
</offtopic>
> We tried to find out by comparing other perlscripts, and found 1
> difference. The perlscript I am talking about was developped
> using Active Perl on Nt. When it was finished it was put back in IBM.
> We looked at the contents of the file and saw after each line a <CR>,
<offtopic>
Yeah, you have two choices: Either use an editor that recognizes Unix
format text files, and save as the format proper for the platform, or
use vi to remove the extra chars. I like UltraEdit, it recognizes both
file types, and saves to FTP.
</offtopic>
> also on the first line where in fact we
> give !#....perl to tell to the system where perl is.
That may be wrong... Try #!/usr/bin/perl or #!/usr/local/bin/perl,
whichever is more appropriate.
> I had the impression, that BASH is looking at the first line, to see
> where perl is, but this time its perl<cr>, can this be
> the reason of the message?
Possibly, if indeed the !# is a typo, that may be the problem. Else,
fix the !# first...
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 21:35:19 GMT
From: scarlzong@my-deja.com
Subject: Prompt pattern
Message-Id: <8qtp6n$lku$1@nnrp1.deja.com>
Hello,
I'm currently writing a script to access a D-Link 106 which can be
administrated through telnet. The telnet module fails at the login with
tyhe following error: "timed-out waiting for login prompt at
E:\tmp\isdn.pl line 7"
Using Dump_log I recorded the following output from D-Link:
E:\tmp>type dump.log
< 0x00000: ff fb 03 ff fb 01 0d 0a 50 61 73 73 77 6f 72
64 √. √...Password
< 0x00010: 3a 20 :
> 0x00000: ff fd 03 ff fd 01 ². ².
Anyone good att regular expressions able to help me to set the prompt
correctly (since I figure that is the problem) ?
Regards,
Sune
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 20:23:59 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Re: Questions about space-saving techniques
Message-Id: <zHsA5.5155$l35.125439@iad-read.news.verio.net>
First off, I'd like to thank those who've responded to my original
question. The input was most helpful. Now I'd like to address a couple
issues in response to Ben's suggestion below and I invite those who
responded initially (among others) to join in.
In article <QA8A5.9129$td5.1542660@news1.rdc2.pa.home.com>,
Ben Kennedy <bkennedy@hmsonline.com> wrote:
>"James Weisberg" <chadbour@wwa.com> wrote in message
>> I'm looking at both pack() and vec() but I am confused on how to go
>> about using them to serve this purpose
>
>To use pack and unpack, you could loop through the record array, and
>depending on the size of the number use the appropriate template. This
>avoids packing a small number (say 10) into a 4 byte long, since only one
>byte is really necessary. Assuming unsigned numbers -
>
>sub rec_compress {
> my(@array) = @_;
> my @back;
> foreach my $num (@array) {
> if ($num eq '') {
> push @back, '';
> } elsif ($num < 0) {
> die "No negative numbers\n";
> } elsif ($num < 256) {
> push @back, pack('C',$num);
> } elsif ($num < 65536) {
> push @back, pack('S',$num);
> } elsif ($num < 4294967296) {
> push @back, pack('L',$num);
> } else {
> die "Number too large\n";
> }
> }
> return @back;
>}
Ben, on the surface, I see the idea here is to store each element
in the @back array by packing it into the smallest datatype possible.
Let's assume the function above. When I write the line:
@{$DB{$date}{$object}{$interval}} = rec_compress(@record);
I find that this is still taking up a great deal of memory. Now
compare that to another suggestion posted earlier:
$DB{$date}{$object}{$interval} =
pack "l*", map {defined $_ ? $_ : -1} @record;
Here the record array is being flattened out into a string and
packed as one series of long ints. This method, I find, *greatly*
reduces the amount of memory in the hash records even though every
element is stored using a 4-byte int. And then when I want to recover
the record as an array I can write:
my @record = unpack("l*", $DB{$date}{$object}{$interval});
Assuming I don't care about translating the -1's back to undef's.
Nevertheless, while I cannot guarentee that *all* of the data in each
record fits below a 2-byte (2^16=65536) boundary, certainly most of it
does and thus the idea of packing elements individually is intriguing.
But as I say above, doing it with an array structure isn't saving me
any memory.
My idea, which is just in the "think-about" stage at this point,
might be to build a pack string of 40-chars which describe the size
of each element in the 40-field data set and instead of returning an
array, return the pack string. Then perhaps I could do something like
$packstring = rec_compress(@record);
$DB{$date}{$object}{$interval} =
pack "40a".$packstring, $packstring, @record;
The idea being that the first 40-chars of the record string
describes the packing of the next 40 elements so that I could write:
$packstring = unpack "40a", $DB{$date}{$object}{$interval};
my @record = unpack($packstring,
substr($DB{$date}{$object}{$interval}, 40));
And then, if I wrote that correctly, @record will unpack correctly
using $packstring as the reference instruction. So at this point it is
speculation whether or not the 40-bytes tacked on to the beginning of
the record string, for every record, saves more memory than simply
packing the whole record as a string of long ints as above. Certainly
I know this will take more processing time, but that I'm willing to
sacrifice for a significant memory savings.
Any ideas/responses thus far?
And one more thing about the following:
>and then to uncompress a record, look at the length of the data to determine
>what was used to pack it in
>
>sub rec_uncompress {
> my(@array) = @_;
> my @back;
> foreach my $num (@array) {
> if (length($num) == 1) {
> push @back, unpack('C',$num);
> } elsif (length($num) == 2) {
> push @back, unpack('S',$num);
> } elsif (length($num) == 4) {
> push @back, unpack('L',$num);
> } else {
> push @back, '';
> }
> }
> return @back;
>}
Is this portable? I believe assuming a 1-byte char is pretty portable
but assuming a 2-byte short might not be. If you pack a number < 65536 as
an unsigned short, are you gaurenteed to return 2 as its length on any
machine which doesn't store 2-byte shorts? If this is not portable, should
the uncompress function above refer to some global vars which know the
size of these datatypes:
if (length($num) == $SIZEOF_CHAR) {
push @back, unpack('C',$num);
} elsif (length($num) == $SIZEOF_SHORT) {
push @back, unpack('S',$num);
} elsif (length($num) == $SIZEOF_LONG) {
push @back, unpack('L',$num);
...
Any recommendations on setting these SIZEOF vars? Again, any followups
are most welcome.
--
World's Greatest Living Poster
------------------------------
Date: Wed, 27 Sep 2000 16:17:21 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Recommendations for Best Beginners book?
Message-Id: <Pine.LNX.4.21.0009271608220.18898-100000@hawk.ce.mediaone.net>
On 27 Sep 2000, Abigail quoth:
A> Lou Moran (lmoran@wtsg.com) wrote on MMDLXXXIV September MCMXCIII in
A> <URL:news:vq24ts876bsub945o2q228jq0u9fgs0kch@4ax.com>:
A> ][
A> ][ >Andrew Johnson's _Elements of Programming with Perl_ starts at a
A> ][ >pretty basic level, and teaches Perl as well as general programming.
A> ][ >I'm not sure whether it is suited for someone who has never programmed
[ snip ]
A> ][ Johnson's book CAN teach you to be a programmer. The first chapters
A> ][ do a "flow-charty thing" wherein you "think" about your program and
A> ][ then he gets into the actual syntax. This is the book, then go buy a
A> ][ bunch of O'reillys. If you get through EOPWP your next book could be
A> ][ Programming Perl 3rd Ed
A>
A> Flow charts are so fifties, and are so inviting to make spagetti programs.
A> A flow chart is the graphical equivalent of a goto.
I agree that flow charts are often useless, but somtimes they do provide
clarity, particularly in "visualizing" an algorithm. And I have never once
had a program flowchart invite me over for spaghetti. :-) Seriously though,
I think they have their uses, it just seems that many people OVERUSE them,
like bosses do status reports. :-)
anm
--
$ENV{PAGER} = 'cat';
system perldoc => '-t', '-F', $0;
=head1
Just another Perl Hacker
------------------------------
Date: 27 Sep 2000 13:17:11 -0500
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: regexp woes w/ Text-BibTeX
Message-Id: <1rem25pumw.fsf@video.bsd.uchicago.edu>
>>>>> "Daniel" == Daniel Chetlin <daniel@chetlin.com> writes:
Daniel> The lookbehind is _not_ an experimental feature, and is
Daniel> here to stay barring something bizarre. The `(?>' feature
Daniel> which you accidentally looked at in perlre _is_
Daniel> experimental.
Ok, I get it now. Thanks for the explanation; the analogy to the '$'
zero-width match was very helpful.
JDH
------------------------------
Date: Wed, 27 Sep 2000 19:01:34 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: remote machine call to registry...
Message-Id: <8qtg69$dbr$1@nnrp1.deja.com>
In article <8qt6ln$a3b$1@usenet01.srv.cis.pitt.edu>,
"J Joseph Yusko" <boogiemonster@usa.net> wrote:
> ok here is my dillemma. I'm trying to access the registry on a remote
> machine so i can delete a value. Is there a sample code where I can
make a
> call to remote machine's registry? please help. I'm stumped.
>
>
Check out Dave Roth's site, www.roth.net/perl, for cool NT/2000 modules,
code samples, and full donated scripts.
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4449
**************************************