[16415] in Perl-Users-Digest
Perl-Users Digest, Issue: 3827 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 27 21:05:29 2000
Date: Thu, 27 Jul 2000 18:05:13 -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: <964746313-v9-i3827@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 27 Jul 2000 Volume: 9 Number: 3827
Today's topics:
ActiveState perl OLE events question... sbhide@my-deja.com
Re: Advanced Perl Programming -- Dated? (Marcel Grunauer)
Re: Critiques, please (Tim Hammerquist)
how to process all fields on a form <phil.taylor@bigfoot.com>
Re: how to process all fields on a form <elephant@squirrelgroup.com>
Re: How to use "touch" in perl <lr@hpl.hp.com>
I need a magic spell! <dotel@nf.sympatico.ca>
Re: I need a magic spell! (Marcel Grunauer)
Is this a bogus -w warning? (Robert Goff)
Re: Is this a bogus -w warning? <lr@hpl.hp.com>
Re: Linked list etc. <sumus@aut.dk>
Re: Making and extracting from XML-like string <jeff@vpservices.com>
Re: Need to change @INC <bart.lateur@skynet.be>
Re: newb Q, Our perl guy left!! <jtoy@tcgfinancial.com>
Re: newbie question: rearanging data files <lr@hpl.hp.com>
Re: nntp client <billy@arnis-bsl.com>
Re: pattern match (Keith Calvert Ivey)
Perl->CGI->Textarea anomaly thewolf23_2000@my-deja.com
Programming Perl -3d: should I get one ? <billy@arnis-bsl.com>
Q: Perl & MS Personal Web Srvr <dfarrell@informix.com>
QUICK Help. h2xs Extending Perl Question kangchenjunga@my-deja.com
Re: regex email blocker <s2mdalle@titan.vcu.edu>
Re: Reserved word <chuckwNOchSPAM@silverlink.net.invalid>
Re: Reserved word <chuckwNOchSPAM@silverlink.net.invalid>
Re: Reserved word (Abigail)
Re: return value of `eval "use lib"' <sumus@aut.dk>
Re: SSI (Robert Goff)
Re: Suggestion for syntax change <elephant@squirrelgroup.com>
Re: Suggestion for syntax change <elephant@squirrelgroup.com>
Re: what is the best way to search multiple files? <lr@hpl.hp.com>
Re: Writing HTML within Perl <lr@hpl.hp.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Jul 2000 23:29:42 GMT
From: sbhide@my-deja.com
Subject: ActiveState perl OLE events question...
Message-Id: <8lqgl1$ce7$1@nnrp1.deja.com>
I am using the OLE "WithEvents" facility to get event callbacks
from a COM server. If I exit the application (with exit call) from this
function, the COM server seems to hang. why is this?
I thought when exit is called all the reference counts added by
perl are released. isn't it? This problem seems to be happening only
when I exit the application in the event callback.
any help appreciated,
suraj
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 23:58:08 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Advanced Perl Programming -- Dated?
Message-Id: <slrn8o1jds.jcv.marcel@gandalf.local>
On Thu, 27 Jul 2000 19:01:47 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>Marcel Grunauer wrote:
>
>>Can of worms.
>
>Well, yes. But the situation as it is now is pretty confusing for
>programmers coming from other languages.
a) you would break loads of programs
b) there's a logic and elegance to the present situation
c) such a fundamental change might be pretty confusing for existing
Perl programmers
d) frankly I don't care what people coming from other languages
find confusing. Did someone ask you whether you like Python's
blocking-by-indenting scheme? Or Java's object straitjacket?
If one wants to program in Perl, one should do so. If one doesn't like
it or finds it too confusing, well, there are other languages.
Even though there's been a call for redesign with Perl 6, it should
be a redesign for Perl programmers, not for programmers coming from
other languages.
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Thu, 27 Jul 2000 23:13:28 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Critiques, please
Message-Id: <slrn8o1h27.1ii.tim@degree.ath.cx>
On 27 Jul 2000 12:36:57 GMT, Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl>
wrote:
> On Thu, 27 Jul 2000 10:08:01 GMT, Marcel Grunauer <marcel@codewerk.com> wrote:
>
> Which word makes most sence. Seek is comething you do to a disk unit
> to locate the heads on a certain cylinder. Rewind is what you do
> to a reel of tape.
>
> Villy
To my (oft-twisted) mind, rewind() makes the most sense when applied to
files. Files (like most tapes) have a beginning and an end. Disk-drives
have no physical end or beginning; just dimensions.
--
-Tim Hammerquist <timmy@cpan.org>
Our proper bliss depends on what we blame.
-- Alexander Pope
------------------------------
Date: Fri, 28 Jul 2000 00:00:25 +0100
From: "Philip Taylor" <phil.taylor@bigfoot.com>
Subject: how to process all fields on a form
Message-Id: <8lqfm4$ehk$1@news6.svr.pol.co.uk>
I'm trying to work out how to process all textfields submitted by a form, I
want to cater for all conditions ie zero - many fields.
I have looked at cgi.pm and the best I can come up with is this:-
assuming $cgi is a reference to CGI.pm then doing something like
$parameters = $$cgi{'.parameters'};
and take advantage of the ".paramaters" attribute. The problem, apart from
being a bit messy is that $parameters contains the submit button and
anything else on the form.
Is there a better way to achieve this using CGI.pm? Is there a way to filter
out only certain types of form widgets.
I considered naming the textfields in an identifiable way but it's not
ideal.
Any help appreciated
Phil
------------------------------
Date: Fri, 28 Jul 2000 00:31:29 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: how to process all fields on a form
Message-Id: <MPG.13eb71bc5f0e833a989697@news>
Philip Taylor writes ..
>I'm trying to work out how to process all textfields submitted by a form, I
>want to cater for all conditions ie zero - many fields.
>
>I have looked at cgi.pm and the best I can come up with is this:-
>
>assuming $cgi is a reference to CGI.pm then doing something like
>
>$parameters = $$cgi{'.parameters'};
>
>and take advantage of the ".paramaters" attribute. The problem, apart from
>being a bit messy is that $parameters contains the submit button and
>anything else on the form.
>
>Is there a better way to achieve this using CGI.pm? Is there a way to filter
>out only certain types of form widgets.
the HTML concept of a text field and a button field and a dropdown list
field is purely a display concept .. by the time these values get
through the CGI they're all textual name/value pairs
you will need to distinguish them via some other means .. but you seem
to already know that
>I considered naming the textfields in an identifiable way but it's not
>ideal.
it's essentially the only option
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 27 Jul 2000 14:51:42 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to use "touch" in perl
Message-Id: <MPG.13ea4ec77700b62c98abfa@nntp.hpl.hp.com>
In article <so17jvgb3j124@corp.supernews.com> on Thu, 27 Jul 2000
20:41:35 GMT, Greg Bacon <gbacon@HiWAAY.net> says...
> In article <1eeg96o.10h3f3e1uhjkxsN%otto.wyss@bluewin.ch>,
> Otto Wyss <otto.wyss@bluewin.ch> wrote:
>
> : I'd like to set the modification time of files to the value of a
> : reference file. While in a shell I could use touch, i.e.
> :
> : touch -r foo bar
> :
> : How can I accomplish this in perl? It seems I'm to stupid to figure out
> : how to call touch in perl or to find the right built-in function.
>
> Read at the documentation for the system() operator in the perlfunc
> manpage.
If each of the files already exists, then the utime() function is better
than going to an external command. You also need the times of the
reference file in epoch seconds (as returned by stat()).
perldoc -f utime
perldoc -f stat
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 28 Jul 2000 00:00:57 GMT
From: "Kevin" <dotel@nf.sympatico.ca>
Subject: I need a magic spell!
Message-Id: <3980ccd8.0@209.128.1.3>
Does anyone have an easy and exact perl script to clone the contents of one
directory to another?
I just want to copy a directory using perl or even perphaps the file::copy
module.
Please help!
------------------------------
Date: Fri, 28 Jul 2000 00:00:03 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: I need a magic spell!
Message-Id: <slrn8o1jhg.jcv.marcel@gandalf.local>
On Fri, 28 Jul 2000 00:00:57 GMT, Kevin <dotel@nf.sympatico.ca> wrote:
>Does anyone have an easy and exact perl script to clone the contents of one
>directory to another?
(cd $origdir; tar cf - .) | (cd $destdir; tar xvf -)
No Perl needed.
Must be copying-directories-week.
--
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: 27 Jul 2000 23:15:24 GMT
From: robert@goff.com (Robert Goff)
Subject: Is this a bogus -w warning?
Message-Id: <8lqfqc$9du$1@207.66.2.156>
I got a new -w warning today:
Found = in conditional, should be == at
/home/httpd/mill/cgi-in/MLSOffer.pm line 306.
Here's the code:
if ( my $buyer_email = 'robert@goff.com' ) {
... do stuff with $buyer_email...
}
This is a technique I've been using for months and this is the first time
I've seen this complaint. Is it because of the constant on the right side?
(The constant is just there for debugging; the production code will have a
method call there). Is there anything wrong with this? Is there a better
way to do it?
--
Clones are people, two.
===============================================
Robert Goff beast@avalon.albuquerque.nm.us
Technical Writer/Editor, Webmaster 505-564-8959
------------------------------
Date: Thu, 27 Jul 2000 16:48:49 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Is this a bogus -w warning?
Message-Id: <MPG.13ea6a3b6e32521e98abfe@nntp.hpl.hp.com>
In article <8lqfqc$9du$1@207.66.2.156> on 27 Jul 2000 23:15:24 GMT,
Robert Goff <robert@goff.com> says...
> I got a new -w warning today:
>
> Found = in conditional, should be == at
> /home/httpd/mill/cgi-in/MLSOffer.pm line 306.
I assume you looked this up in perldiag before posting here.
> Here's the code:
>
> if ( my $buyer_email = 'robert@goff.com' ) {
> ... do stuff with $buyer_email...
> }
>
> This is a technique I've been using for months and this is the first time
> I've seen this complaint. Is it because of the constant on the right side?
> (The constant is just there for debugging; the production code will have a
> method call there). Is there anything wrong with this? Is there a better
> way to do it?
The following code legitimately assigns the result of a function to a
variable, then tests for truth (so there is no warning):
if ( my $buyer_email = f() ) {
... do stuff with $buyer_email...
}
However, with the constant assignment the truth value is known during
compilation, so the compiler is warning you about a possible semantic
error. As that is what you apparently really meant (for test purposes),
either ignore or suppress the warning, or assign the constant to a
variable.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 Jul 2000 01:30:51 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Linked list etc.
Message-Id: <7la7up5g.fsf@macforce.sumus.dk>
Pjtg0707@Netscape.net (Pjtg0707) writes:
> Is there any resources on the web where I can get to to either look at some
> codes or get a module for setting up linked lists and buffers?
Dunno, but generally these structures are very simple to implement in perl.
And usually you don't want linked lists for it at all - not in perl.
> I have some stock ticker data I'd like to read in, arrange them in correct
> temperal order in a hash table ( hash in a hash in a hash etc...).
Sounds to me like you need an array (possibly of hashes) to keep things
ordered (check functions push, pop, shift and unshift) and maybe a hash
in parallel in case you need dictionaryness (lookups) too.
Try it and ask again (posting your attempts) if you fail (or if you insist on
using a linked structure).
--
Jakob
------------------------------
Date: Thu, 27 Jul 2000 16:23:34 -0700
From: Jeff Zucker <jeff@vpservices.com>
To: Sasa.Danicic@eurodyn.com
Subject: Re: Making and extracting from XML-like string
Message-Id: <3980C476.7B7B7E75@vpservices.com>
[courtesy cc to poster]
Sasa Danicic wrote:
>
> Hi,
>
> I 've have to use an output made by some database query and to create a
> XML-like string:
>
> <PERSON>
> <JOE>field_1</JOE>
> <MARY>field_2</MARY>
> ...
> <STEVE>field_n</STEVE>
> </PERSON>
> <EDUCATION>
> <STUDENT>student_name</STUDENT>
> <PROFESSOR>professor_name</PROFESOR>
> ....
> <SCHOOL>school_name</SCHOOL>
> </EDUCATION>
You may want to go directly to the XML modules like XML::Parser,
XML::XPath or XML::Simple, but since you are dealing with databases
anyway, you may want to try DBD::RAM which allows you to easily go back
and forth between XML tags and database columns. You can use defaults
for simple XML or set a variety of tag-to-column mappings for more
complex XML. You can use it to convert the XML to some other database
format, or to work directly on the XML file itself using DBI and SQL
commands.
--
Jeff
------------------------------
Date: Thu, 27 Jul 2000 22:45:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Need to change @INC
Message-Id: <8he1osgosnmiado11iu0v5l1e651uc9mbo@4ax.com>
Etienne Laverdiere wrote:
>Hi all, may anyone tell me How can I change the @INC? (In a NT system?)
>I must put this line into it:
>
>%INTERSHOP%\bin\perl -I %INTERSHOP% -I %INTERSHOP%\lib perlfile.pl
If this is the command line, and INTERSHOP is an environment variable,
then it looks to me like %INTERSHOP% (the value of the environment
variable) and %INTERSHOP%\lib (it's lib subdirectory) will be added to
@INC. See perlrun. Does that answer your question?
You can set the environment variable PERL5LIB, or PERLLIB if that's not
used, to these libraries. Again, see perlrun.
And on a script-bvy-script basis, you can use
use lib $ENV{INTERSHOP}, "$ENV{INTERSHOP}/lib";
--
Bart.
------------------------------
Date: Thu, 27 Jul 2000 18:22:35 -0400
From: jtoy <jtoy@tcgfinancial.com>
Subject: Re: newb Q, Our perl guy left!!
Message-Id: <3980B62B.FD58DBAC@tcgfinancial.com>
But I'm not whining, I'm reading these delightful posts that came to my original
post asking a simple question. Please show me whining
Abigail wrote:
> jtoy (jtoy@tcgfinancial.com) wrote on MMDXXII September MCMXCIII in
> <URL:news:3980B000.D8446A70@tcgfinancial.com>:
> @@ BTW, sorry for talking like this, but what do you expect from a python user?
>
> I'd expect a Python user to take his whining to comp.lang.python.
>
> Abigail
> --
> perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
--
Jason Toy
toyboy@toy.eyep.net
jtoy@tcgfinancial.com
http://toy.eyep.net
------------------------------
Date: Thu, 27 Jul 2000 16:37:28 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbie question: rearanging data files
Message-Id: <MPG.13ea6790d9e472cf98abfd@nntp.hpl.hp.com>
In article <8losm9$i57$1@mamenchi.zrz.TU-Berlin.DE> on Thu, 27 Jul 2000
10:44:55 +0200, berndt zeitler <berndt.zeitler@tu-berlin.de> says...
> Hi Perlers,
> I'm a newbie to Perl as you could see in the subject.
Putting 'newbie' in the Subject causes many potential responders to
filter out your post.
> I would like to sort a bunch of data files that are similar to the listing
> below,
> but don't realy know where to start. The single ones ( 1 ) are also
> sometimes ( -1 ).
> This is what the files look like:
Even with your follow-up attempt to correct for line folding, there is
still so much here that it hurts the eyes. If you present a datafile
where each line has fewer elements and fits within 70 or so characters,
possibly someone (including me) might be inclined to take a further
look.
> and this is what i want it to look like:
...
> 4.000 54,5 57,7 54,5 3,3
> 5.000 53,8 56,8 53,8 3,1
> A-Net 61,8 65,9 61,8 4,1
> Lin 65,5 72,1 65,5 6,6
>
> The first row is the frequency. In every second row pair there is a "S" and
> a 1 (or -1) pair.
Because there is so much impenetrable input, the correlation to your
desired output isn't clear to me, though undoubtedly it is to you. Cut
it down!
> I can load the file into an array:
>
> $datafile = "file001.txt";
> open(DATAFILE,"$datafile") || die "can't open $datafile";
The quotes on $datafile are superfluous; the diagnostic should include
$!.
> @alldata=<DATAFILE>;
This is correct only if you cannot process the file line-by-line.
> and get the frequency:
>
> @freq=split(/\s*\"S\s*\"/,@alldata[1]);
Quotes aren't regex metacharacters, so don't escape them. The argument
should be a scalar, not an array slice. Use the '-w' flag to warn you
of such things.
And here is where you lose me.
> and i was thinking of putting each row pair:
>
> "S" 50.0 "S" 63.0 "S" 80.0 "S" 100 "S" 125 "S" 160 "S" 200
> "S" 250 "S" 315 "S" 400 "S" 500 "S" 630 "S" 800 "S" 1000
> "S" 1250 "S" 1600 "S" 2000 "S" 2500 "S" 3150 "S" 4000 "S" 5000
> 1 45.1 1 47.1 1 48.6 1 61.0 1 51.0 1 49.1 1 57.7
> 1 51.1 1 49.8 1 48.3 1 48.8 1 42.7 1 42.5 1 41.8
> 1 45.7 1 48.0 1 48.4 1 51.4 1 54.2 1 54.5 1 53.8
>
> into a hash array,
>
> %FreqIeq=@alldata[1,2];
> %FreqLeq=@alldata[7,8];
> %FreqLw=@alldata[10,11];
> %FreqLk=@alldata[16,17];
Now array slices might make sense, but I'm not able easily to correlate
them to your mass of data.
> print"$FreqIeq{@freq}";
>
> but this doesn't seem to work like this.
>
> do i have to transpose it and use qw() too?
I doubt about the transpose, but who knows? qw() is a word-quoting
mechanism, which is irrelevant here.
> please help me out on this, or tell me where i can find some more
> information and what functions i should look at.
Help us to help you by simplifying the input and clarifying the problem
description.
> thanks a lot in advance.
> ciao for now,
Tschüß! (I hope I spelled that right. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 27 Jul 2000 17:20:30 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: nntp client
Message-Id: <3980B5AE.5E8F56B3@arnis-bsl.com>
Chris Morris wrote:
>
> Does anyone know of a script that will act as a newsreader?
>
There are some NNTP-related modules on CPAN.
Go to http://search.cpan.org/ and search for 'nntp'.
Ilja.
------------------------------
Date: Thu, 27 Jul 2000 23:15:54 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: pattern match
Message-Id: <3980c15a.925703@news.newsguy.com>
Jimmy Lantz <jimmy.lantz@ostas.lu.se> wrote:
>open(DATA, "<$file") or die "cannot read FILE";
>@lines=<DATA>;
>close(DATA);
>
>foreach $line (@lines)
>{
Why read the whole file into an array if you're going to process
it line by line? There's no point in using memory
unnecessarily. Make it
open(DATA, "<$file") or die "cannot open $file: $!";
while ($line = <DATA>) {
# Do whatever with line
}
close DATA;
or, better (more Perlish) still, use the default $_ instead of
$line:
while (<DATA>) {
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Fri, 28 Jul 2000 00:01:00 GMT
From: thewolf23_2000@my-deja.com
Subject: Perl->CGI->Textarea anomaly
Message-Id: <8lqifq$dne$1@nnrp1.deja.com>
Why won't my Textarea "-default=>" value work when I hit my "Submit"
button? In the following example the Textarea should be: "Submit
Section" after hitting the "Submit" button, but it doesn't change from
the initial default of "Else Section".
To see this in action you can either copy the following code to a
server and run it or go to this URL:
http://cgi-bin.spaceports.com/~jerry/TextAreaErr.pl
Perl Code:
#!/usr/local/bin/perl -w
use strict; # enforce variable declarations and quoting
use CGI;
#-------------------------------
# Global Variable Declaration
#-------------------------------
my $q = new CGI;
#---------- Main Program ---------
print $q->header,
$q->start_html();
# Start Input Form
print $q->start_form();
if ( $q->param('submit') )
{
print "Textarea should be: Submit Section<BR>".
$q->textarea( -name=>'textarea',
-default=>"Submit Section",
-rows=>2,
-columns=>45);
} else {
print "Textarea should be: Else Section<BR>".
$q->textarea( -name=>'textarea',
-default=>"Else Section",
-rows=>2,
-columns=>45);
}
print "<BR>".$q->submit(-name=>'submit',
-value=>'Submit');
print $q->end_form();
print $q->end_html;
#------ End of Main Program ------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 17:05:21 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Programming Perl -3d: should I get one ?
Message-Id: <3980B221.1009393B@arnis-bsl.com>
Hi All !
Should I get the new Programming Perl book ?
(yes, I have the previous edition).
Comments from readers are welcome!
The reason I post this question is that I leave US soon
and maybe will be not be able to look myself at this book
at a bookstore. But I still have time to order it
from Amazon or, say, Bookpool.
So - should I ?
Tks in advance,
Ilja.
------------------------------
Date: Thu, 27 Jul 2000 17:49:50 -0600
From: "Daniel M. Farrell" <dfarrell@informix.com>
Subject: Q: Perl & MS Personal Web Srvr
Message-Id: <3980CA9E.BD7FC881@informix.com>
Hey ..
Re: Running Perl in Web like environment on
stand alone Win 95 PC.
Got Perl for Win 95 installed and running.
(Can "perl filename.cgi" from the DOS prompt
all day long.)
Eventual goal was to get to the point that I
could test all of my HTML and Perl CGI
scripts from my Win 95 PC.
I have Microsoft Peronal Web Server (PWS)
installed on my Win 95 PC. PWS came with
Microsoft Front Page version 3.0.2.926. Personal
Web Server seems to work fine. I have HTML
forms and graphics being served.
Question: Is it possible to execute Perl CGI scripts
in this type of environment ? Is anyone else doing
this ?
Some of the PWS docs mention that CGI scripts are
supported. In some areas the doc specifically mentions
(only) Active-X type script configuration.
------------------------------
Date: Thu, 27 Jul 2000 22:55:48 GMT
From: kangchenjunga@my-deja.com
Subject: QUICK Help. h2xs Extending Perl Question
Message-Id: <8lqelk$b2d$1@nnrp1.deja.com>
Hi
I am trying to embed some C code into Perl but
when I run the script through perl I get a error in loading shared
libraries:/usr/lib/perl5/site_perl/i386-linux/auto/Encrypt/Encrypt.so.
Additonal information is as follows. The call
to h2xs -x -n Encrypt /somepath/encrypt.h.
encryp.h is just a one line prototype as follows
extern char* Encrypt( char *Key, char *Data, int DataSize);
The Makefile.PL that was generated is below.
I did not know what to do as far modification goes. A book have said
that you you must
modify the LIB lines abd the OBJECT lines (But there are no OBJECT
lines). I don't know what
to put for the LIB lines.
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Encrypt',
'VERSION_FROM' => 'Encrypt.pm', # finds $VERSION
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '- DHAVE_SOMETHING'
'INC' => '', # e.g., '- I/usr/include/other'
);
I will be happy to provide any additonal information if requested
Thanks
Kang
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 18:52:52 -0500
From: "David Allen" <s2mdalle@titan.vcu.edu>
Subject: Re: regex email blocker
Message-Id: <8lqhus$opd$1@bob.news.rcn.net>
In article <02062860.7141b2ce@usw-ex0104-031.remarq.com>, Samay
<samay1NOsaSPAM@hotmail.com.invalid> wrote:
> Hi Anyone knows any email service which blocks the email based upon your
> regular expressions.. So you don't have to delete the junk mails?
Check out the latest Perl Jornal (www.tpj.com) and Mail::Audit from CPAN.
This should help you out.
--
David Allen
http://opop.nols.com/
----------------------------------------
Yogi Berra, upon hearing his wife say she had been to see
"Doctor Zhivago," said, "What's the matter with you _now_?"
------------------------------
Date: Thu, 27 Jul 2000 15:24:59 -0700
From: chuckw <chuckwNOchSPAM@silverlink.net.invalid>
Subject: Re: Reserved word
Message-Id: <12185187.7d77ac6e@usw-ex0102-084.remarq.com>
>,, You're confusing perl with the name of a potential pragma,
>,, e.g. as in
>,,
>,, use strict;
>,,
>,, Cap. the first letter, and all should be well
>,,
>,, use Scrubber;
>
Thanks, that worked!
>Excuse me? If you make a file 'scrubber.pm', "use scrubber;"
>will work. There's nothing special about the capatalized file
>names.
Sorry Abagail, you are wrong. Try it yourself. Create a file
named "scrubber.pm" and put the following in it:
package scrubber;
sub new {
my $self;
bless ($self, scrubber);
return($self);
}
1;
Now create a file with the following to test it:
#!/usr/bin/perl -w
use lib ".";
use scrubber;
You consistently get the following:
Unquoted string "scrubber" may clash with future reserved word
at scrubber.pm line 6.
This all goes away when I simply uppercase the "S" in "scrubber".
> But as I said before, there's no need to idle speculation. It
> only generates postings like this.
So dismissive... You could have simply asked for the code I
overlooked...
-Chuck
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Thu, 27 Jul 2000 15:28:27 -0700
From: chuckw <chuckwNOchSPAM@silverlink.net.invalid>
Subject: Re: Reserved word
Message-Id: <0fcf3a6c.c7ff66b9@usw-ex0104-028.remarq.com>
No Tony, you were right, As I posted before:
>,, You're confusing perl with the name of a potential pragma,
>,, e.g. as in
>,,
>,, use strict;
>,,
>,, Cap. the first letter, and all should be well
>,,
>,, use Scrubber;
>
Thanks, that worked!
>Excuse me? If you make a file 'scrubber.pm', "use scrubber;"
>will work. There's nothing special about the capatalized file
>names.
Sorry Abagail, you are wrong. Try it yourself. Create a file
named "scrubber.pm" and put the following in it:
package scrubber;
sub new {
my $self;
bless ($self, scrubber);
return($self);
}
1;
Now create a file with the following to test it:
#!/usr/bin/perl -w
use lib ".";
use scrubber;
You consistently get the following:
Unquoted string "scrubber" may clash with future reserved word
at scrubber.pm line 6.
This all goes away when I simply uppercase the "S" in "scrubber".
> But as I said before, there's no need to idle speculation. It
> only generates postings like this.
So dismissive... You could have simply asked for the code I
overlooked...
-Chuck
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: 27 Jul 2000 19:05:53 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Reserved word
Message-Id: <slrn8o1g28.vcg.abigail@alexandra.foad.org>
chuckw (chuckwNOchSPAM@silverlink.net.invalid) wrote on MMDXXII September
MCMXCIII in <URL:news:12185187.7d77ac6e@usw-ex0102-084.remarq.com>:
== >,, You're confusing perl with the name of a potential pragma,
== >,, e.g. as in
== >,,
== >,, use strict;
== >,,
== >,, Cap. the first letter, and all should be well
== >,,
== >,, use Scrubber;
== >
==
== Thanks, that worked!
==
== >Excuse me? If you make a file 'scrubber.pm', "use scrubber;"
== >will work. There's nothing special about the capatalized file
== >names.
==
== Sorry Abagail, you are wrong. Try it yourself. Create a file
== named "scrubber.pm" and put the following in it:
Which of course has *NOTHING* to do with it being a filename, or a package
name. You're using a bareword. Perl warns you about using barewords,
unless it starts with a capital letter.
Try this:
#!/opt/perl/bin/perl -w
print STDOUT Foo, "\n"; # No warning!
print STDOUT foo, "\n"; # Warning!
__END__
See? No filenames or package names involved.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: 28 Jul 2000 01:21:27 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: return value of `eval "use lib"'
Message-Id: <8zunupl4.fsf@macforce.sumus.dk>
Bart Lateur <bart.lateur@skynet.be> writes:
> Jakob Schmidt wrote:
>
> No. But postponing "use lib" implies that you intend to postpone loading
> some other library files as well;
True. I didn't think of that.
> unless you're loading them with
> require() instead of use()? For those files, it may apply.
Right. Generally I would try to use require(); import(); in stead of
eval( use() ); for that purpose. I'd avoid any avoidable eval().
The only reason to use an eval in this constext is if you want to handle the
situation when things fail and live with it in stead of just dying.
Plus the case where it's actually not the require() bit but the import()
bit that's tricky. Like in the OP's situation where use lib LIST will fail
but require lib; import lib LIST will go ahead an not even reveal the
error condition by return values. In that case
eval "use lib LIST"; @_ and die @_;
is probably the best solution when you want to die on failure (as does the OP)
--
Jakob
------------------------------
Date: 27 Jul 2000 23:08:31 GMT
From: robert@goff.com (Robert Goff)
Subject: Re: SSI
Message-Id: <8lqfdf$9du$0@207.66.2.156>
user@domain.com (Aaron Andersen) wrote in <397F4C1F.D1FEE9D6@domain.com>:
>> > On my web site my pages use SSIs to pull in some information.
>> > However, my search cgi generates its own output, so even if I put
>> > SSIs in that output they are never processed.
>I found something that I think should work at
>http://search.cpan.org/search?dist=CGI-SSI but I have no idea what to do
>now. Can anybody tell me how to set it up?
You don't say whether you're using *nix or Winblows, but you want to
install and use CGI::SSI. On *nix, fire up the CPAN module using a command
like 'perl -MCPAN -e shell' and enter 'help' to check out the commands
available. Using ActiveState perl on Windows, use the 'ppm' command and
enter 'help' to check out the commands.
--
Clones are people, two.
===============================================
Robert Goff beast@avalon.albuquerque.nm.us
Technical Writer/Editor, Webmaster 505-564-8959
------------------------------
Date: Thu, 27 Jul 2000 23:11:02 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Suggestion for syntax change
Message-Id: <MPG.13eb5ede556bace989695@news>
Ilmari Karonen writes ..
>In article <MPG.13eaa2e8babbb2cb989692@news>, jason wrote:
>>HOWEVER .. it doesn't solve the behaviour that Keith is proposing where
>>within list index context the negative arguments of '..' are evaluated
>>first (to be indices relative to the end of the list) and THEN the '..'
>>is evaluated to produce a forward list
>
>..for which I've already proposed a better (less klugy) alternative,
>namely having a special variable contain the last index of the list
>for the innermost surrounding [].
I don't see anything kludgy about changing the evaluation order of the
already magic negative index .. think about it
(LIST)[-1]
already has a meaning .. in fact -1 in list index context already has
the meaning of your proposed $# variable .. so $# is completely
redundant
the only problem currently is that
(LIST)[0..-1]
does the '..' first and THEN does the special meanings for the negative
indices .. try
(LIST)[-2..-1]
and you will get the last two elements (assuming your list has at least
two elements) .. ie. it first does the '..' giving
(LIST)[-2,-1]
and THEN it performs the negative index magic (for a 5 element list it
makes the following conversion)
(LIST)[3,4]
what Keith and I are talking about is simply increasing the evaluation
precedence of the magic negative index .. so that
(LIST)[0..-2]
for a 5 element list first becomes
(LIST)[0..3]
and THEN the '..' is done giving
(LIST)[0,1,2,3]
>This wouldn't break existing code, which Keith's proposal might do.
this is a valid point .. but I don't think there would be a lot of code
that relied on [0..-1] becoming an empty list .. so the breakages would
be few
>It also involves less magic, and is therefore easier to understand.
our point is that the negative index magic is ALREADY THERE .. a
negative index already provides an index relative to the end of the list
.. so what you're proposing is that
(LIST)[-1]
and
(LIST)[$#]
have the same meaning .. why bother when you can just increase the
evaluation precedence of an already magical negative index so that '..'
is more DWIMy
actually .. here's an even better option which will not break existing
code .. allow parenthesis to increase the negative index evaluation
order (hope you're still reading Keith) .. actually forget it - I'll
post this new idea in another followup
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 27 Jul 2000 23:31:33 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Suggestion for syntax change
Message-Id: <MPG.13eb63ab608bd9d4989696@news>
Keith ..
Ilmari actually brings up a reasonable point that the new behaviour
could break existing scripts that rely on (LIST)[0..-2] to return an
empty list .. so here's an idea which seems very DWIMy to me
allow parenthesis to increase the negative index evaluation order .. ie.
old behaviour remains
(LIST)[0..-2]
creates an empty list
(LIST)[0..(-2)]
for a 5 element list creates
(LIST)[0..3]
which evaluates as expected .. that's very DWIMy because it's like '..'
has higher precedence than the special negative index evaluation .. but
if you use parens then the negative eval is done first
it's so DWIMy that you've probably gone and tried it out to see if it
already works (I juse had to re-test it before saying...) .. it doesn't
work at the moment - at least in 5.005_03
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 27 Jul 2000 15:36:15 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: what is the best way to search multiple files?
Message-Id: <MPG.13ea593ae2831ae398abfb@nntp.hpl.hp.com>
In article <8lq67a$4fe$1@nnrp1.deja.com> on Thu, 27 Jul 2000 20:31:38
GMT, dakotamitchell@my-deja.com <dakotamitchell@my-deja.com> says...
> Here is my situation:
> I have an input file which contains some 170,000 unique records.
> I also have 36 additional files (labeled filename1, filename2, ...,
> filename36) in which the records from the input file are contained but
> each record is not in each file. I need to take the input file, read
> through it record by record, then find all of the matches in the 36
> files for each record and output to another file.
...
> Currently I can make this work by reading the input file one line at a
> time and then grepping for that record in each of the other 36 files.
> If a match is found, I right the value from that file to the output file
> otherwise I output "00". The trouble is that based on my estimates, it
> will take about 30 hours for the script to parse through 170,000
> records. I have to think that there is a better way to do this as grep
> isn't particularly fast.
...
> This way, I am grepping through 36 files each time I read a new record
> in from the input file. Any help would be appreciated.
Your help is in perlfaq4: "How can I tell whether a list or array
contains a certain element?"
Read each of the 36 files into its own hash, creating an array of 36
hashes. Then for each input line, search the array for the matching
elements.
Sketch of output loop:
while (<IN>) {
chomp;
my $matches;
for my $file (0 .. 35)
{ $matches .= $hashes[$file]{$_} || '00' }
print $matches != 0 ? ($_, $matches) : '0' x 8, "\n";
}
If you don't have enough memory to hold all of the 36 files, then for
each file reuse a hash, and reread the input file to search that hash
for each input line. Or read the input file into a big array and keep
scanning it.
The memory/speed tradeoffs are up to you to manage. But the whole thing
should run in a few minutes, not in many hours.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 27 Jul 2000 16:08:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Writing HTML within Perl
Message-Id: <MPG.13ea60b978191df398abfc@nntp.hpl.hp.com>
In article <slrn8o1cch.vcg.abigail@alexandra.foad.org> on 27 Jul 2000
18:03:05 EDT, Abigail <abigail@foad.org> says...
> Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
> MCMXCIII in <URL:news:kc91os0hn4isj9o1n4mulvc5nlkdr4fgfv@4ax.com>:
> //
> // I use this... and it works
> //
> // print qq!
> // <HTML>
> // text
> // </HTML>
> // !;
>
> Untill you put an exclamation mark in your HTML.
Paired delimiters () {} [] <> are better. Then you don't get in trouble
unless you have an unmatched delimiter in the text, which is far less
likely.
But here-docs are better yet, of course.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
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 3827
**************************************