[23267] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5487 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 11 14:06:11 2003

Date: Thu, 11 Sep 2003 11:05:12 -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           Thu, 11 Sep 2003     Volume: 10 Number: 5487

Today's topics:
        Building perl on mandrake linux <kalinabears@iinet.net.au>
    Re: Building perl on mandrake linux <abigail@abigail.nl>
        caturing ftp standard output while using system() and c (Nathan Pryor)
    Re: caturing ftp standard output while using system() a <thens@NOSPAMti.com>
    Re: caturing ftp standard output while using system() a <jwillmore@cyberia.com>
    Re: caturing ftp standard output while using system() a <dave.nospam@ntlworld.com>
        CGI and admin tasks <kevin.ratcliffe@ntlworld.com>
    Re: CGI and admin tasks (Greg Bacon)
        close("all open files") - possible? <jon.rogers@tv.tu>
    Re: close("all open files") - possible? <jwillmore@cyberia.com>
    Re: close("all open files") - possible? (Greg Bacon)
        Converting DBM to other DB file type <archi3@archiventure.net>
    Re: Converting DBM to other DB file type <jwillmore@cyberia.com>
        Direct experience of text manipulation in Perl/TCL? (Selwyn Leeke)
    Re: Direct experience of text manipulation in Perl/TCL? <abigail@abigail.nl>
    Re: Direct experience of text manipulation in Perl/TCL? <jwillmore@cyberia.com>
    Re: dynamic access to multidimensional array nobull@mail.com
        execution of script from button (Bharat)
    Re: execution of script from button <bharnish@technologist.com>
    Re: execution of script from button <postmaster@castleamber.com>
        IO:Select - what did I do wrong? <dodgynewsgroups@ewildgoose.demon.co.uk>
    Re: IO:Select - what did I do wrong? (Greg Bacon)
    Re: IO:Select - what did I do wrong? <Ed+nospam@ewildgoose.demon.co.uk@>
    Re: IO:Select - what did I do wrong? (Greg Bacon)
    Re: My perl script is "Killed" - Ran out of memory (Marcus Brody)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 12 Sep 2003 00:19:48 +1000
From: Sisyphus <kalinabears@iinet.net.au>
Subject: Building perl on mandrake linux
Message-Id: <3f608533$0$23594$5a62ac22@freenews.iinet.net.au>

Hi,

This is my first attempt to build perl on linux.
I ran (as per the 'INSTALL' file instructions):

rm -f config.sh Policy.sh
sh Configure -de
make
make test
make install

Actually, I didn't get to run the second step ('sh Configure -de'). It 
started automatically when the first step had completed. 'perl -V' 
output indicates that Configure was run *with* those args. I see that 
the perl that came with the OS was built with '-des' args.

Everything seemed to proceed fine but there are 3 things that puzzle me.
Firstly the perl executable weighs in at around 1 megabyte - which 
strikes me as being rather inflated (especially given that the perl 
executable that came with the OS is around 10 kb).

Secondly, I can't find a perl shared library anywhere ('.so'), though I 
expected there to be one alongside the perl executable in the 
/usr/local/bin folder. 'perl -V' tells me that 'libperl=libperl.a', 
which suggests to me that I've managed to build a static perl. Is that 
what I want ? (I was expecting a dynamic perl - which is what I've 
always had on Win32.)

Thirdly, 'perl -V:cc' outputs 'cc', though I expected 'gcc'. Is there 
any reason that I should be using 'gcc' instead of 'cc' - and if so, how 
do I specify which compiler to use ?

I notice that threads, ithreads and multiplicity are all undef, which is 
another point of difference between the perl I built and the perl that 
came with the OS. I've never made use of threading, so I guess it 
doesn't matter for the present, but it might be handy to know how to 
configure them in for the future.

Anyway .... advice, any pointers to relevant documentation, etc, 
gratefully accepted.

I would provide a copy of my 'perl -V' if I could work out how to copy 
from either the console or a text file to this (Mozilla) newsreader - 
but I haven't yet managed to do that - which is bloody frustrating - but 
I'm not about to transcribe it, and attachments are, I believe, frowned 
upon.

Oh, yeah, in case it's relevant I should also mention that I built my 
perl from the ActiveState source distribution (build 806).

Cheers,
Rob







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

Date: 11 Sep 2003 14:59:19 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Building perl on mandrake linux
Message-Id: <slrnbm13e6.6gp.abigail@alexandra.abigail.nl>

Sisyphus (kalinabears@iinet.net.au) wrote on MMMDCLXIII September
MCMXCIII in <URL:news:3f608533$0$23594$5a62ac22@freenews.iinet.net.au>:
`'  
`'  Anyway .... advice, any pointers to relevant documentation, etc, 
`'  gratefully accepted.

Instead of answering your question, I'll point you to the documentation.
With the source comes a file INSTALL, a file README, and a whole bunch of
README.xxx files, where xxx is one of many platforms; the latter files
contain platform specific information.



Abigail
-- 
#!/opt/perl/bin/perl -w
$\ = $"; $SIG {TERM} = sub {print and exit};
kill 15 => fork for qw /Just another Perl Hacker/;


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

Date: 11 Sep 2003 09:17:31 -0700
From: mrtortoise@yahoo.com (Nathan Pryor)
Subject: caturing ftp standard output while using system() and cron
Message-Id: <2605bae1.0309110817.4e49e3c2@posting.google.com>

I need to capture all standard output of an ftp session that is run
inside a perl program.  Short example:

#!/usr/bin/perl
system("ftp -i ftp.gnu.org > results");

I use a .netrc file to list the commands for the ftp session:

machine         ftp.gnu.org
login           anonymous
password        mrtortoise@yahoo.com
macdef          init
lcd /tmp
ls
pwd
bye

I have no problems capturing all standard output, both local and
remote, when I run the script from the command line.  However, when I
run the script using a cron job only the standard output from the
remote host shows up in the file.  In my real script I am using "mput"
to send several files to the remote host so I need to see the local
standad output in order to verify all files transferred successfully. 
Any suggestions?

Perl version: This is perl, v5.6.1 built for i386-linux


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

Date: Thu, 11 Sep 2003 21:53:51 +0530
From: Thens <thens@NOSPAMti.com>
Subject: Re: caturing ftp standard output while using system() and cron
Message-Id: <20030911215351.394eb2d6.thens@NOSPAMti.com>

On 11 Sep 2003 09:17:31 -0700
mrtortoise@yahoo.com (Nathan Pryor) wrote:

# I need to capture all standard output of an ftp session that is run
# inside a perl program.  Short example:
# 
# #!/usr/bin/perl
# system("ftp -i ftp.gnu.org > results");

  Why dont you use Net::FTP and save yourself the trouble of Portability
and other issues. 

  The thumb rule is use perl modules wherever you can.

Regards,
Thens.



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

Date: Thu, 11 Sep 2003 17:18:04 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: caturing ftp standard output while using system() and cron
Message-Id: <20030911131805.1ee8dadc.jwillmore@cyberia.com>

On 11 Sep 2003 09:17:31 -0700
mrtortoise@yahoo.com (Nathan Pryor) wrote:
> I need to capture all standard output of an ftp session that is run
> inside a perl program.  Short example:
> 
> #!/usr/bin/perl
> system("ftp -i ftp.gnu.org > results");

You're redirecting STDOUT to a file ('>') - use 'tee' to see both
STDERR and STDOUT -and- redirect STDOUT to a file ;)

<snip>
> I have no problems capturing all standard output, both local and
> remote, when I run the script from the command line.  However, when
> I run the script using a cron job only the standard output from the
> remote host shows up in the file.  In my real script I am using
> "mput" to send several files to the remote host so I need to see the
> local standad output in order to verify all files transferred
> successfully. Any suggestions?
<snip>

perldoc -q "Why can't I get the output of a command with system()?"
perldoc -q "How can I capture STDERR from an external command?"

So, basically, you could do ...
==untested==
#notice there's no '> results'
open(CMD, "ftp -i ftp.gnu.org |");
my @results = <CMD>;
close CMD;

You could also look at the Net::FTP module ;)

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
A language that doesn't have everything is actually easier to
program in than some that do.   -- Dennis M. Ritchie 


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

Date: Thu, 11 Sep 2003 18:19:42 +0100 (BST)
From: "Dave Saville" <dave.nospam@ntlworld.com>
Subject: Re: caturing ftp standard output while using system() and cron
Message-Id: <qnirfnivyyragyjbeyqpbz.hl2m0um.pminews@text.news.ntlworld.com>

On Thu, 11 Sep 2003 21:53:51 +0530, Thens wrote:

>On 11 Sep 2003 09:17:31 -0700
>mrtortoise@yahoo.com (Nathan Pryor) wrote:
>
># I need to capture all standard output of an ftp session that is run
># inside a perl program.  Short example:
># 
># #!/usr/bin/perl
># system("ftp -i ftp.gnu.org > results");
>
>  Why dont you use Net::FTP and save yourself the trouble of Portability
>and other issues. 
>
>  The thumb rule is use perl modules wherever you can.

Assuming you know that there *is* one :-)

Regards

Dave Saville

NB switch saville for nospam in address




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

Date: Thu, 11 Sep 2003 18:02:38 +0100
From: Kevin Ratcliffe <kevin.ratcliffe@ntlworld.com>
Subject: CGI and admin tasks
Message-Id: <MU18b.47$R24.40285@newsfep1-win.server.ntli.net>

Hi

I am attempting to write a script that can add email accounts that my
boss can use, with a nice html interface.  I've done the easy bit,
creating the form.  I was going to write a script that writes all the
user details to a file, and then a cron job runs another script that
reads the file and adds the account.  But I would like something more
immediate.  But the CGI scripts do not have the priveliges to create
accounts.  I understand that there will be great security risks in
having the script run suid.  Has anybody any ideas?

I am new to perl, but pick things up quickly.

Kev



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

Date: Thu, 11 Sep 2003 18:02:39 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: CGI and admin tasks
Message-Id: <vm1e5vj5kf17dc@corp.supernews.com>

In article <MU18b.47$R24.40285@newsfep1-win.server.ntli.net>,
    Kevin Ratcliffe  <kevin.ratcliffe@ntlworld.com> wrote:

: I am attempting to write a script that can add email accounts that my
: boss can use, with a nice html interface.  I've done the easy bit,
: creating the form.  I was going to write a script that writes all the
: user details to a file, and then a cron job runs another script that
: reads the file and adds the account.  But I would like something more
: immediate.  But the CGI scripts do not have the priveliges to create
: accounts.  I understand that there will be great security risks in
: having the script run suid.  Has anybody any ideas?

It would almost certainly be better to leave the two separate.  One
way to increase responsiveness would be to run a daemon that watches
some rendezvous point rather than your current cronjob.  Your privileged
account creater *must* treat its input as untrusted.

Please, please, please be *very* careful.  Read the perlsec manpage
several times.  Turn on taint checking.  Check your input thoroughly.
Borrowing a vivid description from Ross Anderson[*], you're now
programming Satan's computer.  Keep that in mind.

[*] See http://www.ftp.cl.cam.ac.uk/ftp/users/rja14/satan.pdf

Greg
-- 
This advice is not a substitute for independent thought
    -- Mark-Jason Dominus, "Program Repair Shop"


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

Date: Thu, 11 Sep 2003 17:13:43 +0200
From: jon rogers <jon.rogers@tv.tu>
Subject: close("all open files") - possible?
Message-Id: <bjq2sn$cn8$1@news.gu.se>

Hi

I have a problem with my Perl script not deleting all - but only some -
temporary files it is supposed to delete. The r/w file status is 777.

The only thing I can think of is that I have unclosed file handles laying
around in the code. Is there some easy way of closing all open file handles
in one go, or will I have to track them down one by one?

Thanks,

J


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

Date: Thu, 11 Sep 2003 16:54:04 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: close("all open files") - possible?
Message-Id: <20030911125400.490033da.jwillmore@cyberia.com>

On Thu, 11 Sep 2003 17:13:43 +0200
jon rogers <jon.rogers@tv.tu> wrote:
> I have a problem with my Perl script not deleting all - but only
> some - temporary files it is supposed to delete. The r/w file status
> is 777.

And your error is ($!) when trying to delete them?

> 
> The only thing I can think of is that I have unclosed file handles
> laying around in the code. Is there some easy way of closing all
> open file handles in one go, or will I have to track them down one
> by one?

If you use IO::File to open/read/write/close the files, when you
'undef' the file handle, the file will close.

Having said that, what do you mean by "temporary"?  Are these files
you open or are opened using IO::File?

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
It wasn't that she had a rose in her teeth, exactly.  It was more
like the rose and the teeth were in the same glass. 


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

Date: Thu, 11 Sep 2003 17:44:23 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: close("all open files") - possible?
Message-Id: <vm1d3nmjh9sj05@corp.supernews.com>

In article <bjq2sn$cn8$1@news.gu.se>,
    jon rogers  <jon.rogers@tv.tu> wrote:

: I have a problem with my Perl script not deleting all - but only
: some - temporary files it is supposed to delete. The r/w file
: status is 777.
: 
: The only thing I can think of is that I have unclosed file handles
: laying around in the code. Is there some easy way of closing all open
: file handles in one go, or will I have to track them down one by one?

Can you provide a *small* example that demonstrates the problem?

Greg
-- 
When the people find that they can vote themselves money, that will
herald the end of the republic.
    -- Ben Franklin


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

Date: Thu, 11 Sep 2003 10:48:00 -0400
From: "Archi3" <archi3@archiventure.net>
Subject: Converting DBM to other DB file type
Message-Id: <3f60b45c$1@news.greennet.net>

I have an older program which stores information in a dbm file...is there a
way to convert this file into something Windows based or that can data
transferred into SQL?

I appreciate any help.
archi3@nospamarchiventure.net




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

Date: Thu, 11 Sep 2003 17:00:07 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Converting DBM to other DB file type
Message-Id: <20030911130014.3ca0f9b9.jwillmore@cyberia.com>

On Thu, 11 Sep 2003 10:48:00 -0400
"Archi3" <archi3@archiventure.net> wrote:
> I have an older program which stores information in a dbm file...is
> there a way to convert this file into something Windows based or
> that can data transferred into SQL?
> 
> I appreciate any help.

As you get each record from the dbm file, you can then insert the
record into your new database using DBI.  Or, you can loop through
each dbm record and write it to a CSV file - then, using your database
client, you can insert the records into your database (because _most_
databases will allow you to update/insert/etc. records from a CSV
file).

Since you have given little information about what your doing (code,
database your going to use, what you have tried so far), this is all I
can offer.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
For perfect happiness, remember two things:  (1) Be content with 
what you've got.  (2) Be sure you've got plenty. 


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

Date: 11 Sep 2003 06:13:36 -0700
From: selwyn.leeke@camcon.co.uk (Selwyn Leeke)
Subject: Direct experience of text manipulation in Perl/TCL?
Message-Id: <f6ba12d3.0309110513.ae61ea9@posting.google.com>

As a little project, I'm trying to investigate the differences between
TCL and Perl(something never before attempted), especially in terms of
their text manipulation capabilities.

Having used a lot more Perl, I was previously under the impression
that Perl was a lot better for text manipulation, but looking at the
commands available, it seems that TCL actually has more core
functionality.  Since this discovery, however, Ive been told that
Perl's text manipulation is much easier to use than TCL's.

Does anyone have any direct experience with any "heavy-duty" text
manipulation in either Perl or TCL?  I would be interested to hear
some opinions on how easy each is, and maybe hear from some people who
have used both and can give me a direct comparison...

Thanks-
-Selwyn


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

Date: 11 Sep 2003 15:06:57 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Direct experience of text manipulation in Perl/TCL?
Message-Id: <slrnbm13sh.6gp.abigail@alexandra.abigail.nl>

Selwyn Leeke (selwyn.leeke@camcon.co.uk) wrote on MMMDCLXIII September
MCMXCIII in <URL:news:f6ba12d3.0309110513.ae61ea9@posting.google.com>:
;;  As a little project, I'm trying to investigate the differences between
;;  TCL and Perl(something never before attempted), especially in terms of
;;  their text manipulation capabilities.

You too? Is it "Perl vs TCL" week?

;;  Having used a lot more Perl, I was previously under the impression
;;  that Perl was a lot better for text manipulation, but looking at the
;;  commands available, it seems that TCL actually has more core
;;  functionality.  Since this discovery, however, Ive been told that
;;  Perl's text manipulation is much easier to use than TCL's.

TCL is far easier to use. TCL is faster, and has much more core
functionality. I wouldn't even bother learning Perl, it's a dying
language. Just look how slow the progress of perl6 is! 3 years 
have passed, and Larry still hasn't figured out how perl6 is going
to look like, let alone it will ever be implemented. Besides, no
serious OS vendor would supply a write-only language like Perl
with its OS, they all prefer TCL. Furthermore, TCL programmers are
in much higher demand than Perl programmers; even Cobol programmers
are more wanted than Perl programmers.

;;  Does anyone have any direct experience with any "heavy-duty" text
;;  manipulation in either Perl or TCL?  I would be interested to hear
;;  some opinions on how easy each is, and maybe hear from some people who
;;  have used both and can give me a direct comparison...

Processing text in Perl is a pain. It lacks decent parsing tools
(yeah, there's perl6 vaporware...), all it has is a slightly beefed
up sed. Man, I could tell you about the times I couldn't do something
simple in Perl, and had to use a gazillion badly documented, buggy
modules to get it done.



Abigail
-- 
perl -Mstrict -we '$_ = "goto U.print chop;\n=rekcaH lreP rehtona tsuJ";U1:eval'


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

Date: Thu, 11 Sep 2003 17:04:59 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Direct experience of text manipulation in Perl/TCL?
Message-Id: <20030911130507.6c6d2b94.jwillmore@cyberia.com>

On 11 Sep 2003 06:13:36 -0700
selwyn.leeke@camcon.co.uk (Selwyn Leeke) wrote:

> As a little project, I'm trying to investigate the differences
> between TCL and Perl(something never before attempted), especially
> in terms of their text manipulation capabilities.
> 
> Having used a lot more Perl, I was previously under the impression
> that Perl was a lot better for text manipulation, but looking at the
> commands available, it seems that TCL actually has more core
> functionality.  Since this discovery, however, Ive been told that
> Perl's text manipulation is much easier to use than TCL's.
> 
> Does anyone have any direct experience with any "heavy-duty" text
> manipulation in either Perl or TCL?  I would be interested to hear
> some opinions on how easy each is, and maybe hear from some people
> who have used both and can give me a direct comparison...

There's a thread already started this week (Perl vs TCL) - see my
comments.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Veni, Vidi, Visa. 



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

Date: 11 Sep 2003 10:15:39 -0700
From: nobull@mail.com
Subject: Re: dynamic access to multidimensional array
Message-Id: <4dafc536.0309110915.271cbcd8@posting.google.com>

Abigail <abigail@abigail.nl> wrote in message news:<slrnblsghc.e97.abigail@alexandra.abigail.nl>...
> Brian McCauley (nobull@mail.com) wrote on MMMDCLXI September MCMXCIII in
> <URL:news:u94qzlzzrm.fsf@wcl-l.bham.ac.uk>:
> &&  Abigail <abigail@abigail.nl> writes:
> &&  
> && >     my $elem = do {local $" = "]["; eval "\$AoA [@ind]"};
> &&  
> &&                      [...] looks amazingly elegant at one level
> &&  but is actually aborrently ugly to an experienced programmer.
> 
> I guess I'm not an experienced programmer then.

"When I was a child I spoke as a child I understood as a child I
thought as a child; but when I became a man I put away childish
things." I Cor. xiii. 11.

20 years ago I was a child and I was an inexperienced programmer (~5y)
and my language of choice was "Beeb BASIC"[1].

It happens that Beeb BASIC has an EVAL() function very similar to
Perl's eval().

It was also worth noting that the Beeb had only 7K of user RAM in it's
highest resolution/depth graphics modes so anything that saved a byte
was good.

I used to delight in things like this.

Now I program for a living.

Now I maintain code written by others.

Now I code libraries that are reused.

Now I code that others maintain.

Now I don't do things like that execpt under very special
circumstances (like scripts that I know are to be used once and thown
away).

> && I trust you _were_ joking.
> 
> I wasn't.

Oh dear.

> Being able to do stuff like this is what makes Perl Perl.

Agreed.

> I really hate dogma's like "you can't use string eval".

Me too.

> Restricting
> yourself to part of the language is something for the FWP mailinglist,
> but a serious programmer should use the full power of the language.

Using the full power of the language does not mean that when there is
a choice of tools you use a technique just because you haven't used it
for while.
 
> And the whining "but if @ind comes from the outside, it's dangerous"
> gets old fast.

Using eval here is not ugly because it is insecure. It's very hard to
explain the real reason.  Which is why people usually end up saying
"it's dangerous".  But that's not the real reason.

It's not really a security problem since if you've got tainting on
@ind can't come from an external source unless it's been laundered, in
which case it's probably been laundered with /^(\d+)$/ so that's OK.

It is ugly because it blurs the code/data divide for no beniefit.

The eval approach is not really any shorter (if you reduce the refs
approach to it's minimum inlined form too), and the eval approach is
certainly slower.

timethese 100000 => {
    eval => sub {
        my $elem = do {
            local $" = "][";
            eval "\$AoA [@ind]";
        };
    },
    refs => sub {
        my $elem = \@AoA;
        $elem = $elem->[$_] for @ind;
    },
}

Benchmark: timing 100000 iterations of eval, refs...
      eval:  6 wallclock secs ( 5.84 usr +  0.06 sys =  5.90 CPU) 
            @ 16949.15/s (n=100000)
      refs:  1 wallclock secs ( 0.59 usr +  0.00 sys =  0.59 CPU) 
            @ 169491.53/s (n=100000)

Blurring the code/data line is a very powerfull tool and I think many
people are undely scared of using it when it is sensible to do so. 
Indeed that is to be topic of my talk in Belfast.

But I don't think this is a case when it is sensible.  One of my major
tasks over the next few months is to pin down exactly why I think
that.

> 'unlink $file' is dangerous if $foo comes from the outside
> as well, but that's no reason to not use unlink. I'm fully aware that if
> you run on behalve of some other user (suid, CGI, etc) there are issues -
> issues that go much further than string eval.  But the vast majority of
> the programs I write runs under the same UID as the user invoking it. If
> the user wants to screw himself, he doesn't need my programs to do so.

If you take a look at Message-ID: <u9d78x4ave.fsf@wcl-l.bham.ac.uk>
http://groups.google.com/groups?selm=u9d78x4ave.fsf%40wcl-l.bham.ac.uk
and the thread containing it you will see that I'm usually on your
side of this argument.

[1] http://www.bbcbasic.com/


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

Date: 11 Sep 2003 10:42:21 -0700
From: bxg018400@yahoo.com (Bharat)
Subject: execution of script from button
Message-Id: <cdc9faa1.0309110942.4712c65a@posting.google.com>

Hi all:
I am a newbie in terms of PERL.

Here's what i want to do. I ahve a HTML page that has a button on it.
I want a user to click on that button, and when he does that, I just
want a simple unix sh script to be executed on a unix box.

What is the easiest way to do this?

Thanks,
Bharat


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

Date: Thu, 11 Sep 2003 17:46:21 GMT
From: Brian Harnish <bharnish@technologist.com>
Subject: Re: execution of script from button
Message-Id: <pan.2003.09.11.17.46.50.575204@technologist.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On Thu, 11 Sep 2003 10:42:21 -0700, Bharat wrote:

> Hi all:
> I am a newbie in terms of PERL.
> 
> Here's what i want to do. I ahve a HTML page that has a button on it.
> I want a user to click on that button, and when he does that, I just
> want a simple unix sh script to be executed on a unix box.
> 
> What is the easiest way to do this?

Um, the only reference to perl here is that you are new to it. I don't see
where perl fits into your problem: "HTML -> sh script". Try a general CGI
list.

 - Brian
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/YLUHiK/rA3tCpFYRAtMMAKCbCjBowcDxjh1j7749RokQudyijgCePYRK
An39fpTqTSWHxmORe7f9qtg=
=ZDHJ
-----END PGP SIGNATURE-----



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

Date: Thu, 11 Sep 2003 19:59:01 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: execution of script from button
Message-Id: <1063303251.284508@halkan.kabelfoon.nl>

Bharat wrote:

> Hi all:
> I am a newbie in terms of PERL.
> 
> Here's what i want to do. I ahve a HTML page that has a button on it.
> I want a user to click on that button, and when he does that, I just
> want a simple unix sh script to be executed on a unix box.
> 
> What is the easiest way to do this?
> 
> Thanks,
> Bharat

$ perldoc CGI

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



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

Date: Thu, 11 Sep 2003 17:23:44 GMT
From: "Ed W" <dodgynewsgroups@ewildgoose.demon.co.uk>
Subject: IO:Select - what did I do wrong?
Message-Id: <Ac28b.12779$Os1.86997@news.easynews.com>

Can't see what's wrong with this code... It's running under windows XP with
activestate perl 5.6.1 (which may well be part of the issue...).

The following code gives me an error:
Error in select: Bad file descriptor at io_select_test.pl line 11.

 ...However, it is pretty much straight out of the man pages.

The problem I am trying to solve is how to read from a bunch of sockets with
a blocking select, but also read from Stdin.  I guess I could make my select
only block for 1/2 sec or so and then poll stdin, but there must be
something better than this? (in fact I seem to have some probs doing
non-blocking input from stdin under win32... Is this normal, does it work
for other people...)

>>>>>

#!perl -w
use strict;
use warnings;
use IO::Socket;
use IO::Select;

my $r = IO::Select->new(\*STDIN);

$|=1;

    my ($rr) = IO::Select->select( $r )
        or die "Error in select: $!";

    print "Success";





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

Date: Thu, 11 Sep 2003 17:41:49 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: IO:Select - what did I do wrong?
Message-Id: <vm1cut68iasm85@corp.supernews.com>

In article <Ac28b.12779$Os1.86997@news.easynews.com>,
    Ed W <dodgynewsgroups@ewildgoose.demon.co.uk> wrote:

: Can't see what's wrong with this code... It's running under windows XP with
: activestate perl 5.6.1 (which may well be part of the issue...).
: 
: The following code gives me an error:
:
: [my $r = IO::Select->new(\*STDIN);]
:
: Error in select: Bad file descriptor at io_select_test.pl line 11.

According to the perlport manpage:

    select RBITS,WBITS,EBITS,TIMEOUT

        Only implemented on sockets. (Win32, VMS)

Hope this helps,
Greg
-- 
Although the South would have preferred any honorable compromise to the frat-
ricidal war which has taken place, she now accepts in good faith its consti-
tutional results, and receives without reserve the amendment which has already
been made to the constitution for the extinction of slavery. -- Robert E. Lee


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

Date: Thu, 11 Sep 2003 17:58:47 GMT
From: "Edward Wildgoose" <Ed+nospam@ewildgoose.demon.co.uk@>
Subject: Re: IO:Select - what did I do wrong?
Message-Id: <rJ28b.981019$Bf5.140355@news.easynews.com>


"Greg Bacon" <gbacon@hiwaay.net> wrote in message
news:vm1cut68iasm85@corp.supernews.com...
> In article <Ac28b.12779$Os1.86997@news.easynews.com>,
>     Ed W <dodgynewsgroups@ewildgoose.demon.co.uk> wrote:
>
> : Can't see what's wrong with this code... It's running under windows XP
with
> : activestate perl 5.6.1 (which may well be part of the issue...).
> :
> : The following code gives me an error:
> :
> : [my $r = IO::Select->new(\*STDIN);]
> :
> : Error in select: Bad file descriptor at io_select_test.pl line 11.
>
> According to the perlport manpage:
>
>     select RBITS,WBITS,EBITS,TIMEOUT
>
>         Only implemented on sockets. (Win32, VMS)
>
> Hope this helps,

Ahh nuts.  Thanks.  I hadn't thought to look in the perlport manpage.

Any suggestions for the best way to do this?  I thought either:

a) writing a socket interface into my code
b) converting to "wheel" type code, or perhaps wxwindows (since my GUI app
will be in this)
c) run a blocking select with timeout and check stdin occasionally

Anything else I should look at...?

Ta

Ed W




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

Date: Thu, 11 Sep 2003 18:03:54 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: IO:Select - what did I do wrong?
Message-Id: <vm1e8at702hf3a@corp.supernews.com>

In article <rJ28b.981019$Bf5.140355@news.easynews.com>,
    Edward Wildgoose <Ed+nospam@ewildgoose.demon.co.uk@> wrote:

: [...]
: 
: Anything else I should look at...?

Install an operating system? :-) :-) :-)

Greg
-- 
In a literary light, if UNIX is the Great Novel, Perl is the Cliffs Notes.
    -- Thomas Scoville


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

Date: 11 Sep 2003 08:59:48 -0700
From: dna@888.nu (Marcus Brody)
Subject: Re: My perl script is "Killed" - Ran out of memory
Message-Id: <1ab76986.0309110759.2ddd12fc@posting.google.com>

Thanks xho

I had already come to some of the comlusions you had suggested.  I
know have a 1st script which i envoke with ./1st.pl | gzip >
out.txt.gz, producing a 0.5gb file with everything I need.  This is
lines with gene_symbol (e.g. HMG1, not the long name, just the HGNC
one hopefully), id_number, result.

The second script (not written yet), will do a slow sorting routine (i
can think of quicker ways of doing it, but i fear they will eat
memory), which will basically cluster all the results with the same
symbol or id togethor.  E.g. looping over the file again and again,
with e.g. loop 1 takes the first id/name, and spits out results to
STDOUT with the same id/name.  If i pipe this to gzip, the resulting
file should still be 0.5gb, and is shouldnt run out of memory, as I
expect only 5000 experiments max for each gene.

I think this could work....

Thanks for all the help xhoI - I guess i was just trying to be greedy
and do everything at once :-)  Posted here hoping there was a quick
fix ;-)

To address a couple of your points:

>I don't see any key by experiment here!  Surely you can't just
>load all the different experiment results into one amorphous array,
>with no way to distinguish them.

Your right - there is no key by experiment.  All experiments for each
gene are in one amorphous array.  And you know what - I dont give a
damn.  Trust me, this is correct, for what I intend to do!!!


>I think this means you are going to have abandon in-memory hashes,
and
>go to hashes tied to disk, or parsing the data into a RDBMS (MySQL,
>Oracle), both of which will likely take more disk space than you seem
to
>have, or using system tools to manipulate flat files, or resorting to
>multi-pass methods.
[...]
>In summary, buy more disk space!


I think the above two points would offer the cleanest solution. 
However 1. I don't know any RDBMS (intend to learn, could be
useful...)  2. I'm skint ;-)  3.  I just wanna get this done - dont
care if it is inelegant, just correct.


Thanks again

MB


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 5487
***************************************


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