[13154] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 564 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 17 09:09:38 1999

Date: Tue, 17 Aug 1999 06:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 17 Aug 1999     Volume: 9 Number: 564

Today's topics:
    Re: <== importing hash symbols from one package to anot (Anno Siegel)
    Re: Calling all PERL & DBI gurus <jpeterson@office.colt.net>
    Re: Calling all PERL & DBI gurus <rhrh@hotmail.com>
    Re: Calling all PERL & DBI gurus (Graham Ashton)
    Re: CGI.pm or here document for html <revjack@radix.net>
    Re: HARASSMENT -- Monthly Autoemail (Michael Rubenstein)
        Help Translating Apple IIe file vwcorrado@my-deja.com
    Re: Help Translating Apple IIe file <jpeterson@office.colt.net>
    Re: Killing Processes on NT... <carvdawg@patriot.net>
    Re: Killing Processes on NT... <flavell@mail.cern.ch>
    Re: Language survey (David Cantrell)
    Re: Newbie question: Creating a NT login script in Perl <purchase9@hotmail.com>
        Perl HTML to txt <js252@cus.cam.ac.uk>
    Re: Perl HTML to txt <jpeterson@office.colt.net>
        Perl Image Processing Help Needed! <webmaster@razorprices.wcq.com.au>
        Perl Image Processing Problems!! <webmaster@razorprices.wcq.com.au>
    Re: PERL jobs <jpeterson@office.colt.net>
    Re: Perl SUID script <flavell@mail.cern.ch>
        regular expression problem... perl_beginner@my-deja.com
    Re: regular expression problem... <gellyfish@gellyfish.com>
    Re: Running a perl process as service under Win NT <gellyfish@gellyfish.com>
    Re: Running a perl process as service under Win NT <c4jgurney@my-deja.com>
    Re: serial port / ioctl (Eric Bohlman)
    Re: tree structure (Michel Dalle)
    Re: Updating Tables using two seperate files (Michel Dalle)
        While we are on the subject of tainting.... (I.J. Garlick)
    Re: Why use Perl when we've got Python?! <gonzalo@aller.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 17 Aug 1999 11:08:50 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: <== importing hash symbols from one package to another ==>
Message-Id: <7pbfs2$49e$1@lublin.zrz.tu-berlin.de>

Bart Lateur <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
>Kevin Howe wrote:
>
>>Can anyone prove that Exporter can actually do this?
>
>>@EXPORT = qw(hash);
>
>Make this:
>
> @EXPORT = qw(%hash);
>
>I too think that the docs in Exporter.pm aren't clear on this. I
>actually had to find out through examining it's source code! Testing
>that it works, was of course the icing on the cake.

Indeed.  The Exporter doc is silent about the issue and the Camel
i(p. 404) has (as for most modules) just a reproduction of (some
version of) this.  The _Perl Cookbook_ does give a hint on p. 402:

        @EXPORT = qw(&F1 &F2 @List);
        @EXPORT = qw( F1  F2 @List);      # same thing
  ...
  The ampersand is optional in front of an exported function
  specification.

(BTW: The function specification is exported?  Beg your pardon?)
 
I was unable to find anything about this in _Effective Perl
Programming_.

I think this is severely underdocumented.  Since the leading &
is optional the rules are not evident, and because many modules
export only functions the examples people find may be misleading.

I intend to send a patch to perlbug (the maintainers of Export are
not mentioned in the source, maybe someone knows), suggesting to
include this in the Export pod before the line "Selecting What to
Export"

=head2 How to Export

The arrays C<@EXPORT> and C<@EXPORT_OK> in a module hold lists of
symbols that are going to be imported into the users name space by
default, or which they can request to be imported, respectively.  The
symbols can represent functions, scalars, arrays, hashes, or typeglobs.
The symbols must be given by full name with the exception that the
ampersand in front of a function is optional, e.g.

    @EXPORT    = qw(sub $scalar @array);
    @EXPORT_OK = qw(&function %hash *typeglob);

Anno


------------------------------

Date: Tue, 17 Aug 1999 10:03:30 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Calling all PERL & DBI gurus
Message-Id: <Srau3.126$u07.1130@news.colt.net>

Geoffrey Toogood <geoff@brainstorm.net.au> wrote:

[snip of CGI code that does a DBI select query]

> How do I retrieve the next 20 rows from the database where I left off in the
> other Script? (ie. retrieve  rows 20-40 from my SELECT query to the
> database.)

> Do I create some kind of reference to an aray or something? 

No :-). You are encountering a problem inherent to most web based development,
which is that there is no state maintenance. After you script executes it
forgets EVERYTHING. Any array reference would be useless, because anything it
might refer to is permanently wiped from your computer's memory as soon as the
CGI script has run.

You need to think laterally. You need to store some value in the resulting HTML
page that will tell the script, next time it runs, to ignore the first 20
results, and print the next twenty. A crude example would be to pass a variable
called, say 'startat' with a value, and then simply loop through the first
$startat results from you query, ignoring them, and THEN print the next twenty.

Your problem is not really a Perl problem, it is a problem with web based
application development.





------------------------------

Date: Tue, 17 Aug 1999 10:32:09 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Calling all PERL & DBI gurus
Message-Id: <37B92C18.85C9083F@hotmail.com>

Geoffrey Toogood wrote:

> How do I retrieve the next 20 rows from the database where I left off in the
> other Script? (ie. retrieve  rows 20-40 from my SELECT query to the
> database.)
> 
> Do I create some kind of reference to an aray or something?
> 
> AM I ON THE RIGHT TRACK?!!
 
More or less yes, 
If you do a select for the first twenty rows, 
save the last name value from your select and pass this in your url to
the script, and have your SQL more like:

Select name, whatever 
from table
where name >= 'passed value'
order by name;

so the script can more or less start from where it left off.

Richard H


------------------------------

Date: 17 Aug 1999 10:21:10 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Calling all PERL & DBI gurus
Message-Id: <slrn7ridsn.ai3.billynospam@wing.mirror.bt.co.uk>

In article <Srau3.126$u07.1130@news.colt.net>, Jon Peterson wrote:
>
>You need to think laterally. You need to store some value in the
>resulting HTML page that will tell the script, next time it runs, to
>ignore the first 20 results, and print the next twenty. A crude example
>would be to pass a variable called, say 'startat' with a value, and
>then simply loop through the first $startat results from you query,
>ignoring them, and THEN print the next twenty.

Better still, you could arrange your SQL statement so that it prints the
20 that you're interested in. If you have a unique column that you can
order your results on, you could use something like;

  ... WHERE name = ? AND foo > ? AND foo <= ?

and pass it the values of $start and $finish that you bunged into the
previous web page. If you don't have such a column, you could perhaps 
create a temporary table with the contents of your full SELECT
statement, and fill it up with your results. The temporary table could
have a unique column that contained your row number... (just a thought).

I'd strongly suggest that you start using the CGI.pm module. You can
then do things like this;

---cut---
#!/usr/bin/perl -w

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser); # prints error messages in browser
use DBI;

print header(); # replaces your "Content-type ..." stuff

# connect to database here

$start  = param('start')  ||  1;   # default to first row
$finish = param('finish') || 20;   # default to row 20

# stick the SQL and table that prints the results here

# now make a link to the next page
$start  += 20;
$finish += 20;
$url = url() . "?start=$start&finish=$finish";
print qq{<a href="$url">next page</a>\n};

# close database connection

---cut---

-- 
Graham

P.S. <billynospam@mirror.bt.co.uk> is a fully working address...


------------------------------

Date: 17 Aug 1999 12:46:48 GMT
From: revjack <revjack@radix.net>
Subject: Re: CGI.pm or here document for html
Message-Id: <7pbljo$g2n$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

support@gethits.com explains it all:

:COLOR="#B8DED2">.</FONT>prorated amount:</FONT></TD>

The PRORATED_AMOUNT environmental variable is not available on Timex
Sinclair servers.


------------------------------

Date: Tue, 17 Aug 1999 12:25:16 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37bb49d8.39263948@nntp.ix.netcom.com>

[posted and mailed]

On Tue, 17 Aug 1999 04:09:02 GMT, darsal@erols.com (Dave
Salovesh) wrote:

>Please, point me to a netiquette guide, your AUP, your TOS, a FAQ,
>something, just one well distributed source which says that posting to
>Usenet does not solicit, does not permit, email replies - just so I can
>understand your point of view.  If it's something that "everyone" knows
>because it's published somewhere the same "everyone" goes, I've never
>been there and I'd like to go - It might help me clear up some
>misunderstandings I have.
>
>But every source I've ever read with an opinion on the subject
>explicitly suggests that there are situations where replies to Usenet
>posts should be sent via email.
>
>If it's simply your view about what you like to see, then that's fine.
>Put it in your .sig, use a sub-address for your Usenet posts, and filter
>out anything that comes to that address.  Simple enough for most
>situations...

That's not the same thing.  John's already pointed out the
fallacy in asking for documentation that posting does not solicit
email, but that's not the whole story.

There's a culture here too.  In comp.lang.perl.misc some of the
regulars normally mail a copy of their posts.  I don't think
that's necessary, but I see nothing wrong with the practice
(excluding, of course, "stealth" mail).  There certainly are
circumstances in which going to mail is appropriate.

But this has nothing to do with what Tom is doing.  He is not
responding to articles -- he's harassing.  He's sending email to
someone who has asked that he stop.

The question we should be asking is not whether it is appropriate
to send email in response to a posting.  In general, it is.  The
question is whether it is appropriate to send email to someone
who has asked that it be stopped.  The answer to that is clearly
no.

Let's look at specifics.  I've copied this post to you by mail.
It would be unreasonable for you to complain about this.  If not
the norm, it's a reasonably common practice and you should have
recognized the possibility that someone would do this when you
posted.

But this doesn't mean you can't ask that I stop.  It would be
reasonable for you to ask that I not do it in the future and I
would certainly respect your wishes.  Your posting creates a
presumption that mail replies are welcome, but it is a
presumption that you do have the right to deny.

You should also have recognized the possibility that someone
would send you a mail followup without posting. Again, it would
be reasonable for you to request that this not be done.

What would not be reasonable would be for me to regularly send
you email, that is not a clear follow up to your post, stating my
opinions on how you should be posting.  Your post does not create
a presumption that you wish to see regular unsolicited mail.  You
should not even have to request that I not do this.

Suppose I started sending mail arguing that one should place the
reply before the quotes when replying to news articles.  Suppose
I said that I would continue to send this mail as long as you
were posting on usenet.  Do you think any of the regulars on
comp.lang.perl.misc would be arguing that by posting on usenet
you were soliciting mail?



------------------------------

Date: Tue, 17 Aug 1999 11:17:52 GMT
From: vwcorrado@my-deja.com
Subject: Help Translating Apple IIe file
Message-Id: <7pbgcr$ou0$1@nnrp1.deja.com>

Hey guys,

My wife inherited an old Apple IIe school library cataloging system
(Circulation Plus is the name of the system) that I need to convert to a
new Macintosh they are getting.  I can succesfully get the data out, but
it has embedded HEX stuff in it (along with some Apple IIe stuff, I'll
bet :).  I thought that Perl would be the right tool for the job.

Anyway, this would be my second Perl script and I need a little help
getting started.  Is there a fast/easy way to do file parsing in Perl?
The file is not very big (~6000 records) and I only need to do it once
(so performance is not an issue).

--
Thanx!
  Richard
  (rhurt@thepoint.*NOSPAM*.net)


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 17 Aug 1999 12:43:05 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Help Translating Apple IIe file
Message-Id: <tNcu3.132$u07.1230@news.colt.net>

vwcorrado@my-deja.com wrote:
> (Circulation Plus is the name of the system) that I need to convert to a
> new Macintosh they are getting.  I can succesfully get the data out, but
> it has embedded HEX stuff in it (along with some Apple IIe stuff, I'll
> bet :).  I thought that Perl would be the right tool for the job.

Yup!

> Anyway, this would be my second Perl script and I need a little help
> getting started.  Is there a fast/easy way to do file parsing in Perl?

Ah. There are many ways to do fast easy file parsing in Perl, but even in 
perl 'easy' is relative and your second script will probably not seem so 
easy after all....

A question to ask is "Is the hex stuff valuable? Do you just need to get rid
of it, or do you need to convert it into something different?"

Assuming that we are basically dealing with ASCII text, with a few unwelcome
lumps of binary data, then yes Perl is ideal, but its hard to say much more
without more detail on your precise task. I would suggest that you look at
Perl's regular expressions, and pop down to you bookshop to buy the llama
book ("learning Perl" from O'Reilly and Associates (it has a llama on the cover
you see)).




------------------------------

Date: Tue, 17 Aug 1999 06:35:59 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Killing Processes on NT...
Message-Id: <37B93B0F.84033FCE@patriot.net>




> Hi All, I seem to be facing a bit of a dillemma.  I am trying to kill
> a PERL process on NT using the %SIG signal handler hash.  In this SIG
> hash are many keys, some of the relevant ones include QUIT, BREAK, STOP,

As elephant so eloquantly points out, signals on NT are a no-go.  I'll add
as well,
so is forking...at least, with the ActiveState version of Perl.  If you get
the core
version and compile it yourself, you can get fork()...

So you want to kill a process, eh?  Okay.  Have you looked at
Win32::Process?
Or Win32::iProc?  Another thing you can try is using Named Pipes via Dave
Roth's Win32::Pipe module...you could have kill.pl send a pseudo-signal to
loop.pl...but you'd have to have some sort of event-driven coding so that
loop.pl
will detect the signal and stop what it was doing...

Remember, there are other ways around what you are trying to do.  Don't let
someone else's narrow-minded "read the FAQ" responses deter you...you may
just need a different perspective.



------------------------------

Date: Tue, 17 Aug 1999 12:55:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Killing Processes on NT...
Message-Id: <Pine.HPP.3.95a.990817125359.983H-100000@hpplus03.cern.ch>

On Tue, 17 Aug 1999, Harlan Carvey, CISSP wrote:

> Remember, there are other ways around what you are trying to do.  Don't let
> someone else's narrow-minded "read the FAQ" responses deter you

If in your opinion the FAQ is narrow-minded, then it's time for you to
submit your updated version for review. 




------------------------------

Date: Tue, 17 Aug 1999 11:02:29 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Language survey
Message-Id: <37ba4139.9781124@news.insnet.net>

On 15 Aug 1999 00:37:03 -0000, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) said:

>Sometimes I wish Perl wasn't so damn popular.  Is there a decent
>Forth interpreter for Linux?

Write one in perl :-)

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


------------------------------

Date: Tue, 17 Aug 1999 08:12:42 -0400
From: "SH" <purchase9@hotmail.com>
Subject: Re: Newbie question: Creating a NT login script in Perl
Message-Id: <37b9501e@news1.us.ibm.net>


elephant <elephant@squirrelgroup.com> wrote in message
news:MPG.12239b96173c6c6989c39@news-server...
> lcook@carolina.rr.com writes ..
> >What is the easiest way to create an NT login script where if the user
> >belongs to a particular local group, the login script will map a drive
> >for them?
>
> definitely with a text editor .. and don't listen to anyone who says
> otherwise !!
no I use Frontpage for my Perl scripts =-).

Stirling




------------------------------

Date: Tue, 17 Aug 1999 12:10:51 +0100
From: "J. Smith" <js252@cus.cam.ac.uk>
Subject: Perl HTML to txt
Message-Id: <Pine.SOL.3.96.990817120844.20914B-100000@ursa.cus.cam.ac.uk>


Does any one know of a available perl script that can stript HTML tags and
convert large documents into a .txt file?

Thanks on advance

James Smith




------------------------------

Date: Tue, 17 Aug 1999 12:37:46 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Perl HTML to txt
Message-Id: <uIcu3.131$u07.1230@news.colt.net>

J. Smith <js252@cus.cam.ac.uk> wrote:

> Does any one know of a available perl script that can stript HTML tags and
> convert large documents into a .txt file?

Yes, there lots of them. Here is the first one my search engine returned when
I did the very easy to craft search for 'perl' and 'html2txt':

http://www.cs.cmu.edu/People/rgs/tools.html

I have no idea how good it is or even if it works.

FYI your question is more appropriate in an HTML group than in a perl group (I
think...). In any case, almost any question about the existance of a bit of
software can be better answered by a search engine than a newsgroup, at least
in  my experience.



------------------------------

Date: Tue, 17 Aug 1999 22:57:21 +1000
From: David Rugendyke <webmaster@razorprices.wcq.com.au>
Subject: Perl Image Processing Help Needed!
Message-Id: <37B95C31.7879F2E@razorprices.wcq.com.au>

Hi,

I recently acquired a search engine which ranks the results in % eg.
99%..45% etc. I have been trying to find a way for ages to display a
small image of a bar graph underneath each % showing its score through
an image. I was planning to do this by having a whole picture of a graph

and if a score rank say 60% then only 60% of that image would be
displayed and so on for each result. If anyone could please show me how
i can do this as i dont have any experience in perl image processing i
would be extremely gratefull. Thanks,

David.



------------------------------

Date: Tue, 17 Aug 1999 22:59:52 +1000
From: David Rugendyke <webmaster@razorprices.wcq.com.au>
Subject: Perl Image Processing Problems!!
Message-Id: <37B95CC8.6FF3B1BB@razorprices.wcq.com.au>

Hi,

I recently acquired a search engine which ranks the results in % eg.
99%..45% etc. I have been trying to find a way for ages to display a
small image of a bar graph underneath each % showing its score through
an image. I was planning to do this by having a whole picture of a graph

and if a score rank say 60% then only 60% of that image would be
displayed and so on for each result. If anyone could please show me how
i can do this as i dont have any experience in perl image processing i
would be extremely gratefull. Thanks,

David.



------------------------------

Date: Tue, 17 Aug 1999 10:08:37 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: PERL jobs
Message-Id: <Fwau3.127$u07.1130@news.colt.net>

emilym4444@my-deja.com wrote:
> I've been doing Perl (with CGI) for a while and I
> think I am ready for a consulting instead of
> a permanent job.  Other than the commercial
> sites (DICE, NET-Temps) where can I find these
> kind of jobs?

Hmmm... I would investigate the various perl-mongers groups. Different groups
are more or less ameniable to job hunters/recruiters, so check to see which
ones might be suitable. I think you will find that the perl-mongers generally
offer good friendly support for folks making a living with Perl.

FYI your question was probably NOT very appropriate for this newsgroup...



------------------------------

Date: Tue, 17 Aug 1999 12:16:09 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl SUID script
Message-Id: <Pine.HPP.3.95a.990817120911.983C-100000@hpplus03.cern.ch>

On Tue, 10 Aug 1999, Dutch McElvy wrote:

> I am having trouble running a perl script set to suid. When I try to execute
> the script as another user I get permission denied. If I try to run the
> script with perl -w "script.pl" I get Too late for -T.

It seems you're having trouble with your newsfeed as well as with the
documentation. This same question was answered yesterday, pointing of
course to perldiag.

> !/usr/bin/perl -wT
> $ENV{PATH} = "/usr/sbin"';
> delete 

You're fooling us.  No way that would get as far as reporting the error
that you're describing. If you're planning to post actual code here,
find a way of pasting it exactly in the form that your little test case
is failing, else you waste everyone's time (including your own).




------------------------------

Date: Tue, 17 Aug 1999 09:22:41 GMT
From: perl_beginner@my-deja.com
Subject: regular expression problem...
Message-Id: <7pb9ks$kpo$1@nnrp1.deja.com>

I want to use RE to substitude a series of space at the start of the
line into a series of '&nbsp;'

something like   s/^( +)/&nbsp;{#of space match}/g

   Any solution? Thanks in advance.

Thanks...


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: 17 Aug 1999 10:52:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regular expression problem...
Message-Id: <37b930d1_1@newsread3.dircon.co.uk>

perl_beginner@my-deja.com wrote:
> I want to use RE to substitude a series of space at the start of the
> line into a series of '&nbsp;'
> 
> something like   s/^( +)/&nbsp;{#of space match}/g
> 


First thing that sprang to my head:

    $string =~ s/^( +)/'&nbsp;' x length $1/e;


/J\
-- 
"Over the years I've always had Max Factor in my box" - Tina Earnshaw,
Chief Make-Up Artist, Titanic


------------------------------

Date: 17 Aug 1999 10:42:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Running a perl process as service under Win NT
Message-Id: <37b92e6f_1@newsread3.dircon.co.uk>

Stefan Schulze <stefan.schulze@wildner.de> wrote:
> I just wrote a small tcp/ip-server that handles access to a custom database
> over
> the net. Now i'm planning to run the script as a service under Windows NT
> 4.0.
> Anyone out there who tried/did this? Is there a handy module to accomplish
> this task?
> 

This is discussed in the Win32 Specific FAQ that is part of the HTML
documentation that is installed with the lastest Activestate distributions.

See the section entitled:

   How do I run a Perl script as a Windows NT Service?

in the file perlwin32faq4.html on your very own hard disk.


/J\
-- 
"Report accuses Royal Opera House of 'arrogance and elitism'. Report
further alleges that Pope is Catholic. Report further claims that bears
may well indeed defecate in the woods" - Private Eye


------------------------------

Date: Tue, 17 Aug 1999 11:16:14 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Running a perl process as service under Win NT
Message-Id: <7pbg9p$otf$1@nnrp1.deja.com>

In article <37b9236b.0@news.touch.net>,
  "Stefan Schulze" <stefan.schulze@wildner.de> wrote:
> Now i'm planning to run the script as a service under Windows NT
> 4.0.

Use srvany.exe and instsrv.exe from the NT resource kit.

Two general issues which probably won't affect your script but do tend
to cause problems when setting up scripts as services on NT.

You can't access networked files from your service unless you log your
script in as a user and then you'll need to use UNC paths to get to
them - the default account for services (LocalSystem) only has guest
privaleges for network access.

You can't use OLE from your service unless you are logged in as
LocalSystem.

By design there is no way to have both network access and OLE (unless
anyone knows different).

HTH

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: 17 Aug 1999 09:21:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: serial port / ioctl
Message-Id: <7pb9jg$58l@dfw-ixnews5.ix.netcom.com>

F. Brekeveld (brekevel@worldonline.nl) wrote:
: I need to do some serial port programming and therefore need to use
: ioctl.
: 
: I have a RedHat 5.2 Linux machine, with standard perl 5.004.. installed.

If it's the perl that came with RH5.2, it's broken (RH included a buggy 
maintenance release for some reason or another).  Try upgrading to 5.005_03.


------------------------------

Date: Tue, 17 Aug 1999 10:58:12 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: tree structure
Message-Id: <7pbfe0$68a$1@news.mch.sbs.de>

In article <slrn7rdk2i.a5.abigail@alexandra.delanet.com>, abigail@delanet.com wrote:
>Michael Masouras (m.masouras@on-board-info.com) wrote on MMCLXXIII
>September MCMXCIII in
> <URL:news:934535498.6244.0.nnrp-13.c29fdfa7@news.demon.co.uk>:
>$$ I have a table that represents a tree structure. The table is dynamic and
>$$ there is no limit on the levels it can have.
>$$ 
>$$ It looks like this:
>$$ 
>$$ 1    2
>$$ 2    9
>$$ 9    4
>$$ 
>$$ If I have this in an array, how can I get all the relevant parents of a
>$$ child?
>$$ (e.g. I have $x = 4, how can I get 1, 2,9, 4)?
>
>
>package Algorithm::Graphs::TransitiveClosure;
[snip of 250+ lines]

Wow, that seems a bit excessive for a problem that can be solved with 
a simple while() loop...

#!/usr/local/bin/perl -w
while (<DATA>) {
        chomp;
        ($parent,$child) = split;
        $parent[$child] = $parent;
}
$child = 4; # replace this e.g. with a chomp($child = <STDIN>); statement
@path = ();
push(@path,$child);
while (defined($parent[$child])) {
        $child = $parent[$child];
        push(@path,$child);
}
print join(' ',reverse @path);
__DATA__
1       2
2       9
9       4

Of course, this only works if you have a unique parent,
it doesn't use strict, it's not a one-liner, etc.
So this is probably only worth a score of 5 out of 10.
If you're satisfied with that, use it :-)

Michel.


------------------------------

Date: Tue, 17 Aug 1999 11:01:04 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Updating Tables using two seperate files
Message-Id: <7pbfjc$68a$2@news.mch.sbs.de>

In article <7p4f0r$d3f$1@nnrp01.ops.uunet.co.za>, "Romiko" <rvdd@iafrica.com> wrote:
>Sorry dudes I missed the group?

There is a utility that comes with Perl, that translates awk scripts into Perl
scripts. It's called a2p (or a2p.exe in the ActiveState distribution).

Have you tried it out ?

Michel.


------------------------------

Date: Tue, 17 Aug 1999 09:39:01 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: While we are on the subject of tainting....
Message-Id: <FGLs51.CnK@csc.liv.ac.uk>

I happen to be doing the following in a CGI where it is frequently said
you should always use the -T option to turn tainting on. Every time I have
tried this I run into the backtick wall problem, ie. I am really not sure
how/what to use in place of a backtick call.

For instance I do

   my @ret = `$prog $opts 2>$errout`;

I used to use system (which according to perlsec is easier to make
secure), but stopped doing that after reading the perlfunc man page on the
system command. it specifically says...

   This is NOT what you want to use to capture the output from a command,
   for that you should use merely backticks or qx//,.....

However after reading the perlsec man page (essential reading for
tainting) it appears it's impossible to untaint backticks when -T is on.
Lower down there is a way of replacing the backtick command with a call to
exec (I think, this is where the confusion sets in on my part). I am
probably being dense here but I can not see how those 20 odd lines of code
can be used to replace the backtick call above.

I won't reproduce the code here as evryone should have it (it's about 267
lines down and starts use English;)

So can anyone enlighten me? I think I have understood the rest of the
tainting issues, but can't be sure as I can't get the script to run as it
gives the expected "Insecure dependency in `` while running with -T
switch" error.

TIA.

-- 
Ian Garlick



------------------------------

Date: Tue, 17 Aug 1999 11:52:02 +0100
From: Luis Gonzalo Aller Arias <gonzalo@aller.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B93ED2.84FA0831@aller.com>

Matt Curtin wrote:

>
> I strongly believe that the importance of learning curves is grossly
> overstated.  I wouldn't use Unix if learning curve were the criteria
> for goodness.  I wouldn't use English if learning curve were the
> criteria for utility.
>
> If learning curve were the One True Criterion, I'd use a Mac and speak
> Esperanto.  I might well be the most boring person alive.
>

Hi all,

    I love Perl, but I disagree here. That's not fair to Esperanto nor to Mac
people.
I know people that can do marvelous things with a Mac (and a lot that can't do
anything with a PC and linux... or winblows, or...) and people who can say
marvelous things in esperanto.

    Take esperanto... Its rules are very simple and regular. But you can use it
to make very expressive sentences, even poetry (just like in any natural
language). The simpleness of the rules doesn't limit the expresiveness of the
language... and it's wonderful when you can transmit your ideas to a
heterogeneus bunch of people from all over the world at the same level (and not
a LOW level).

    In a way it's like the periodic table... with protons, neutrons and
electrons and a few rules (ok, maybe not a few 8)), look what kind of things
(and not only things 8)) you can see. Maybe this is not a good analogy, but I
hope you'll get the picture...

    But, for me, there is no problem if the rules and the "elements" of a
language are more complex... I think that is good that Perl has so many ways to
express something,
It only happens that you have more choices... no more... no less... and
personally I prefer the Perl way (compared to Python, which actually I
discovered before).

    ps: By the way, I love Esperanto too... maybe I'm little bit subjective...
8)...

--

________________________
Luis Gonzalo Aller Arias
email: gonzalo@aller.com
http://gonzalo.aller.com





------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 564
*************************************


home help back first fref pref prev next nref lref last post