[12457] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6057 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 19 12:07:19 1999

Date: Sat, 19 Jun 99 09:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 19 Jun 1999     Volume: 8 Number: 6057

Today's topics:
    Re: 'use' not working on ISP's NT server <gellyfish@gellyfish.com>
        ActiveState Perl and use of PPM (Erol Bernstein)
    Re: cgi query error <gellyfish@gellyfish.com>
        Command Line Arguments <edmundp@bigfoot.com>
    Re: Command Line Arguments (Dave Cross)
    Re: Command Line Arguments (Larry Rosler)
    Re: connect() and firewall <gellyfish@gellyfish.com>
    Re: Cron alternative? <rootbeer@redcat.com>
    Re: Hex to Decimal?? <gellyfish@gellyfish.com>
        how to read a file reverse <ibrahim@ovayolu.freeserve.co.uk>
    Re: how to read a file reverse <rootbeer@redcat.com>
    Re: indexing into a hash (Mark-Jason Dominus)
        lexical formatting (util) for Perl? (Michael Nordberg)
    Re: lexical formatting (util) for Perl? <rootbeer@redcat.com>
    Re: looking for script to monitor acct abuse <gellyfish@gellyfish.com>
    Re: Need to edit cgi script using Windows PC, which pro <gellyfish@gellyfish.com>
    Re: newbie - NT <gellyfish@gellyfish.com>
    Re: Parsing bug in Perl? <rootbeer@redcat.com>
    Re: pattern match by column (Mark-Jason Dominus)
    Re: Perl and dialog <gellyfish@gellyfish.com>
    Re: Perl Module query <gellyfish@gellyfish.com>
    Re: Perl Module query <tchrist@mox.perl.com>
        Problem with stty, Perl and CGI <marco.anstett@okay.net>
    Re: Problem with stty, Perl and CGI <rootbeer@redcat.com>
    Re: Problems with MacPerl and modules (Paul J. Schinder)
    Re: replacing part of a tab-delimited string <tchrist@mox.perl.com>
    Re: replacing part of a tab-delimited string (JQ)
    Re: s/\s/ /g does not work for me... why??!! <gellyfish@gellyfish.com>
        Servermodul with fork <mtg@gmx.de>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 19 Jun 1999 13:51:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: 'use' not working on ISP's NT server
Message-Id: <7kg784$3pe$1@gellyfish.btinternet.com>

On Fri, 18 Jun 1999 09:21:30 +0100 Dave Cross wrote:
> 
> It's them. strict.pm has been a standard part of Perl for some
> considerable time. If it's not in the @INC path then someone has
> massively screwed up your Perl installation.
> 

In another thread someone describes a situation where the single
directory pointed to by @INC was found to be empty on inspection -
a massively screwed up installation I would say.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 19 Jun 1999 15:10:49 GMT
From: erol.bernstein@owl-online.de (Erol Bernstein)
Subject: ActiveState Perl and use of PPM
Message-Id: <376bb103.25295078@news.owl-online.de>

Hello yours,

I installed ActivePerl and was enjoyed about the fine documentation. 
But I have a problem, before installation of ActiveState-Perl, I could
use the Tk-package, because it was in @INC-path.

Now, a new @INC-path is set by Active-Perl.

In the directory c:\perl\lib\site, I have Tk.pm and a subdir called
Tk, furthermore a GD.pm, which I want to use.

Now, I tried to install these packages with 'ppm'-manager.

PPM>install /location c:\perl\lib\site Tk.pm

gives:

Error installing package 'Tk.pm': Could not locate a PPD file for
package Tk.pm

What's a PPD-file?

I'm a 'just one program a year'-writer ... or say everytime-beginner.

many thanks

salute
erol



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

Date: 19 Jun 1999 14:38:55 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: cgi query error
Message-Id: <7kga1v$3qf$1@gellyfish.btinternet.com>

On Thu, 17 Jun 1999 18:57:54 GMT Ryan Corder wrote:
> I checked the perldiag man page.  and didnt get anything out of it.
> 

What didnt you understand about :


       Can't call method """"%s"""" without a package or object
           reference
           (F) You used the syntax of a method call, but the slot
           filled by the object reference or package name
           contains an expression that returns a defined value
           which is neither an object reference nor a package
           name.

Essentially this means you are using the syntax :

   $query->param('blah')

but $query is not a valid CGI object .

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 19 Jun 1999 15:39:32 +0100
From: "Edmund Paddington" <edmundp@bigfoot.com>
Subject: Command Line Arguments
Message-Id: <376babce@newsread3.dircon.co.uk>

This may not at first look like a suitable posting for this newsgroup, but
it does concern perl and having spent all day reading FAQ's and manuals
without coming up with an answer, I hope someone can help me.

Someone has supplied me with a program (not written in Perl - it is in C I
believe).  They've told me that the program will call my script from the
command line with a line such as

'call1.pl conf 24 399'

where call1.pl is the name of my script and the arguments conf, 24 and 399
are results from the program which would need to be assigned to scalar
variables within my script.

Would this call work?  If not what would be the correct syntax for the line?
In either case, how do I assign the values to my variables.  The form
parsing routines which are all over the net don't seem to cover this.

I'm tearing my hair out with this, I hope someone can help.

Edmund




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

Date: Sat, 19 Jun 1999 15:11:27 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: Command Line Arguments
Message-Id: <376bb2db.26349215@news.demon.co.uk>

On Sat, 19 Jun 1999 15:39:32 +0100, "Edmund Paddington"
<edmundp@bigfoot.com> wrote:

>This may not at first look like a suitable posting for this newsgroup, but
>it does concern perl and having spent all day reading FAQ's and manuals
>without coming up with an answer, I hope someone can help me.
>
>Someone has supplied me with a program (not written in Perl - it is in C I
>believe).  They've told me that the program will call my script from the
>command line with a line such as
>
>'call1.pl conf 24 399'
>
>where call1.pl is the name of my script and the arguments conf, 24 and 399
>are results from the program which would need to be assigned to scalar
>variables within my script.
>
>Would this call work?  If not what would be the correct syntax for the line?
>In either case, how do I assign the values to my variables.  The form
>parsing routines which are all over the net don't seem to cover this.
>
>I'm tearing my hair out with this, I hope someone can help.

>From perldoc perlvar:

"@ARGV 

"The array @ARGV contains the command line arguments intended for the
script. Note that $#ARGV is the generally number of arguments minus
one, because $ARGV[0] is the first argument, NOT the command name. See
``$0'' for the command name."

hth,

Dave...

--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: Sat, 19 Jun 1999 08:17:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Command Line Arguments
Message-Id: <MPG.11d5543042ab7f69989c01@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <376babce@newsread3.dircon.co.uk> on Sat, 19 Jun 1999 
15:39:32 +0100, Edmund Paddington <edmundp@bigfoot.com> says...
 ...
> 'call1.pl conf 24 399'
> 
> where call1.pl is the name of my script and the arguments conf, 24 and 399
> are results from the program which would need to be assigned to scalar
> variables within my script.
> 
> Would this call work?  If not what would be the correct syntax for the line?
> In either case, how do I assign the values to my variables.  The form
> parsing routines which are all over the net don't seem to cover this.

>From perlvar (quoted in its entirety):

@ARGV 

    The array @ARGV contains the command line arguments intended for the
    script. Note that $#ARGV is the generally number of arguments minus
    one, because $ARGV[0] is the first argument, NOT the command name.
    See ``$0'' for the command name. 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 19 Jun 1999 14:21:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: connect() and firewall
Message-Id: <7kg91n$3po$1@gellyfish.btinternet.com>

On 16 Jun 1999 18:48:43 -0500 Abigail wrote:
> Marco Lazar (lazar@micro.ti.com) wrote on MMCXV September MCMXCIII in
> <URL:news:3767D887.1427175@micro.ti.com>:
> `` 
> `` So how do I get through the firewall ?
> 
> 
> You bribe your sysadmin.
> 

Or become the sysadmin ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 19 Jun 1999 08:39:02 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Cron alternative?
Message-Id: <Pine.GSO.4.02A.9906190837040.25127-100000@user2.teleport.com>

On Sat, 19 Jun 1999, RLD wrote:

> Thanks... I've spent a good deal of time this morning trying to look
> something up on "at" and you can imagine what searches bring up with that
> word :-)  Is there a clear explanation of this function?

Your system should have a manpage for it. The command 'man at' should
bring it up, in most cases. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 19 Jun 1999 14:44:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Hex to Decimal??
Message-Id: <7kgad5$3r7$1@gellyfish.btinternet.com>

On 18 Jun 1999 10:16:22 -0600 Daniel Grisinger wrote:
> tadmc@metronet.com (Tad McClellan) writes:
> 
>> seong joon bae (seongbae@students.uiuc.edu) wrote:
>> 
>> : How would you write a little script that converts hex to dec...?
>> 
>> 
>>    I would use an editor, such as vi or emacs, for writing scripts.
>> 
> 
> You're weak! Weak, I say!  Real men don't use brain-sucking,
> hand-holding, sissy programs like vi or emacs to program.  
> Real men use cat.
> 

I dont think so :

gellyfish@gellyfish:/home/gellyfish > dd if=/dev/tty of=myfile.pl
#!/usr/bin/perl -w

print 'Hello, World';
0+3 records in
0+1 records out

HTH

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 19 Jun 1999 16:13:12 +0100
From: "ibrahim" <ibrahim@ovayolu.freeserve.co.uk>
Subject: how to read a file reverse
Message-Id: <7kgc1r$h29$1@news4.svr.pol.co.uk>

I need to open a huge txt. file (4mb) every day and get only last 14 lines.
Format of file is same everyday.

I don't want to read whole file every day. Is there any way to read reverse
a file and get just 14 lines.

If you can help me I would be grateful.

Thanks in advance... birxan...




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

Date: Sat, 19 Jun 1999 08:57:53 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to read a file reverse
Message-Id: <Pine.GSO.4.02A.9906190846380.25127-100000@user2.teleport.com>

On Sat, 19 Jun 1999, ibrahim wrote:

> I need to open a huge txt. file (4mb) every day and get only last 14
> lines.

Maybe you want 'tail -14'. But you can very quickly and easily do this
from within Perl if you can put an upper limit on the number of characters
in the average line.

Say you know that no line is ever longer than 100 characters, a reasonable
assumption. Use seek() to move to 100 * (14 + 1) = 1500 characters before
eof, then use code like this.

    <FILE>;		# skip (possibly) partial line
    my @lines = <FILE>;			# grab last lines
    splice @lines, 0, @lines-14;	# keep only last 14
    # Optional safety check
    die "Oops, didn't find 14 lines" unless @lines == 14;

If you need those lines in reverse order, use the reverse() operator.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 19 Jun 1999 15:42:39 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: indexing into a hash
Message-Id: <7kgdog$a7q$1@monet.op.net>

In article <x7909qhvhn.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>and how do you delete entries by key?
>
>As a better solution, perl 5.005 has experimental support for
>pseudo-hashes which would allow for this.

Perlref:

       Perl will raise an exception if you try to delete keys
       from a pseudo-hash ... .


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

Date: Sat, 19 Jun 1999 14:54:45 GMT
From: michael@nordberg_remove_.net (Michael Nordberg)
Subject: lexical formatting (util) for Perl?
Message-Id: <376baf18.3180062@news.mindspring.com>


Aside from getting fancy with regexps, what would be among the easiest
ways to reformat some very poorly formatted (in terms of lexical
style) perl?  Is there something for perl that would be the eq' of the
unix formtatting util "indent"?  Do any of the emacs interfaces for
perl editting offer such a function?

-Nordberg


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

Date: Sat, 19 Jun 1999 08:42:14 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: lexical formatting (util) for Perl?
Message-Id: <Pine.GSO.4.02A.9906190840550.25127-100000@user2.teleport.com>

On Sat, 19 Jun 1999, Michael Nordberg wrote:

> Aside from getting fancy with regexps, what would be among the easiest
> ways to reformat some very poorly formatted (in terms of lexical
> style) perl?  

Have you seen the FAQ? Try section three. (And do you really think
"getting fancy with regexps" might be easier! :-)  Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 19 Jun 1999 14:03:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: looking for script to monitor acct abuse
Message-Id: <7kg7vq$3pk$1@gellyfish.btinternet.com>

On Fri, 18 Jun 1999 10:54:52 -0400 iha@cgocable.net wrote:
> I am looking for a script or an example of code that can track acct
> abuse (multiple ip's using the same username) by reading an apache web
> log file, and sending an alert email to the admin We are running a
> 5,000+ mysql jobs database
> 

Perl is probably the language of choice for a task like this.

You will probably want to open the log file, read it in in line by line,
use some regular expression to parse each line and identify the ones
you are interested in.

You will probably need the information that can be found in the documents:

  perlsyn
  perlop
  perlfunc
  perlre

You should also look at the perlfaq documents.

Thes are all part of the Perl distribution.

If after you have read these documents and have attempted to solve your
problem and still cant get it to work or perhaps dont understand what it
says in the manpages then you might post back the smallest snippet of
code that you are having difficulty with.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 19 Jun 1999 13:19:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need to edit cgi script using Windows PC, which prog to use
Message-Id: <7kg5cc$3oc$1@gellyfish.btinternet.com>

On Fri, 18 Jun 1999 14:06:37 -0700 David Cassell wrote:
> [courtesy cc sent to poster]
> 
> Mark Austin wrote:
>> 
>> Actually, I just need to change the baseline (URL) address of a Perl cgi
>> script.
>> Is it safe to do this in Notepad or Wordpad, I've heard that (if you use the
>> wrong progam) it adds some stuff that the Unix box will not like.
> 
> Yes, most win32 and MS-DOS programs place the win32 'newline' (which is
> two characters) on the ends of lines.  Not a problem.  

Of course it might be a problem if he uses Wordpad and doesnt save the
file as 'text' ... ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 19 Jun 1999 13:05:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie - NT
Message-Id: <7kg4j1$3o9$1@gellyfish.btinternet.com>

On Sat, 19 Jun 1999 06:00:13 GMT Kim Crompton wrote:
> 
> %1 is not a valid Windows NT application.
>

This is a problem with the setup of your webserver - In the Win32 FAQ
that is installed with Activestate Perl there is a document describing
how to go about setting up various HTTP servers to work with Perl.  If
you are still having problems you will want to ask this question in the
group comp.infosystems.www.servers.ms-windows.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 19 Jun 1999 08:32:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Parsing bug in Perl?
Message-Id: <Pine.GSO.4.02A.9906190831150.25127-100000@user2.teleport.com>

On Sat, 19 Jun 1999, Bart Lateur wrote:

> Sean McAfee wrote:
> 
> >NNTP-Posting-Date: Sat, 19 Jun 1999 04:05:47 EDT
> 
> I don't believe this. Are you guys really posting in the middle of the
> night? Tom Phoenix's reply dates from 2 AM local time. Jesus. 

Is it because me's reply dates from 2 AM local time. Jesus that you came
to see me today? Please go on.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 19 Jun 1999 15:56:17 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: pattern match by column
Message-Id: <7kgehu$aae$1@monet.op.net>

In article <377045d4.3446378@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Abigail wrote:
>
>>s/^(.{79})0101/${1}9999/;
>
>Doesn't work if one of the first 79 characters is a newline. 

That is a feature.  The original querent wanted to replace a string in
columns 80-83.  If there is a newline before that, then the string at
character posistions 80-83 is not in columns 80-83.



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

Date: 19 Jun 1999 13:02:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and dialog
Message-Id: <7kg4dj$3o6$1@gellyfish.btinternet.com>

On Sat, 19 Jun 1999 05:39:50 -0600 storm wrote:
> I'm trying to improve our adduser script with perl and want to use
> dialog to add menus to a couple places.  I'm using RedHat 5.2, dialog
> 0.6 and perl version 5.004004 (?).
> 
> The dialog readme says, in part, "*  New dialog.pl perl interface to
> dialog.  Makes using dialog from perl simple and powerful."
> 
>   Anyone know how to do this?  Please reply via Email, I don't get much
> time to browse the newsgroups.
> 

If you want to something like this you might want to cut out the middleman
and get the Curses and Curses::Widgets modules from CPAN - they will
probably will do everything that you want. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 19 Jun 1999 13:36:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Module query
Message-Id: <7kg6cv$3p7$1@gellyfish.btinternet.com>

On Fri, 18 Jun 1999 21:21:29 GMT j_raff@my-deja.com wrote:
> Is there a simple way to determine what modules are loaded on a server
> with out asking the ISP or Admin?
> Like walking the @INC looking for files that end with ".pm".

If you have telnet access to your server then you will want to use
the pmtools that others have pointed out - if not then you might want
to use the following - it does however rely on *some* modules being 
installed :


#!/usr/bin/perl

use File::Find;
use CGI;
use Pod::Html;

my $query = new CGI;

print $query->header;

if ( $podfile = $query->param('podfile') )
  {
    open(STDERR,'>/dev/null') || die "really cant cope with that -$!\n";
    if(chdir("/tmp")) # my system prefers that
      {
        pod2html("--infile=$podfile","--noindex");
       }
  }
else
  { 
   $query->start_html("Perl Installation Details"),"\n";

print <<EOX;
    <H1>
      Perl Installation details
    </H1>
Perl version : $] <BR>

\@INC is :
EOX

print join("<BR>\n",@INC);

print "Installed modules: <BR>\n";

find(\&wanted,@INC);

sub wanted
{
  if ($File::Find::name =~ /\.pm$/)
   {
      open(MODFILE,$File::Find::name) || return;
      while(<MODFILE>)
       {
         if (/^ *package +(\S+);/)
           {
            print qq|<A HREF="findlibs.pl?podfile=$File::Find::name">|,
                  $1,"</A><BR>\n";
            last;
           }
       } 
   }
}
print "</BODY></HTML>\n";
}
__END__

I hadnt tested for a while and it appears to do something I cant remember
it doing with respect to the version numbers - perhaps I will fix it up
someday - time allowing ....


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 19 Jun 1999 09:37:42 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Module query
Message-Id: <376bb946@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Jonathan Stowe <gellyfish@gellyfish.com> writes:
:If you have telnet access to your server then you will want to use
:the pmtools 

pmtools are at http://language.perl.com/misc/pmtools-1.00.tar.gz

--tom
-- 
"If the people are given the power to vote themselves bread and
 circuses, then they will."        - Cicero


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

Date: Sat, 19 Jun 1999 16:57:24 +0200
From: Marco Anstett <marco.anstett@okay.net>
Subject: Problem with stty, Perl and CGI
Message-Id: <376BAFD4.9BBF6C92@okay.net>

Hello,

i tried to show the information stty gives me about the serial interface
on a webpage. When I started it via CGI I only got information for the
stty options  '--help' and '-version'. When I started the programm on
the shell it everything is okay.

I already checked the flags of stty and changed them so, that anyone
could do anything with that file. But that didn't help either.

Can anyone help me with these?

My system: Linux 6.0, Apache Webserver

Thanks you so far.
Marco



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

Date: Sat, 19 Jun 1999 08:44:25 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem with stty, Perl and CGI
Message-Id: <Pine.GSO.4.02A.9906190843370.25127-100000@user2.teleport.com>

On Sat, 19 Jun 1999, Marco Anstett wrote:

> When I started it via CGI I only got information for the stty options
> '--help' and '-version'. When I started the programm on the shell it
> everything is okay.

So, you don't have a Perl problem. You should probably check with the
docs, FAQs, and newsgroups about programs running in the CGI environment.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 19 Jun 1999 14:07:42 GMT
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: Problems with MacPerl and modules
Message-Id: <OuNa3.291$4e1.19581@iad-read.news.verio.net>

In <376B1110.63FF87B7@h2net.net> Mark Johnson <mjohnson@h2net.net> writes:

>Hi,

>I'm relatively new to Perl and totally new to MacPerl.  My problem lies
>in how to
>install modules.  It's probably a simple solution, but it's driving me
>crazy!

>Situation:  I'm trying to use a perl script that requires libwww.
>Several sources
>(including the author of the aforementioned script) say that the latest
>version
>of MacPerl (5.2.0r4, which I'm using) comes with libwww, but when I run
>my script I get an error saying that the LWP package can't be found.

MacPerl comes with an old version of libwww-perl.  If you'r script
says it can't be found, MacPerl probably didn't get installed
correctly.  Try reinstalling it.  You should wind up with a file
LWP.pm in your lib folder.

>OK, maybe
>it's not included, so I tried downloading the latest LWP package and its

>prerequisites from CPAN.  I installed them where I thought they needed
>to
>go (lib folder), but the best I did was get an error saying that LWP
>failed to return
>a true value. (?)

Because you put Unix text files in your lib folder.  MacPerl can
*only* use Perl in Mac text format.  Just like any other 5.004 Perl,
which wants scripts in the native text format.  Scripts on CPAN are
usually stored in Unix format.

>What the hell am I doing wrong?  I managed to install the required
>modules AND run
>the script on my Unix machine at work, so I know the script is
>functional (and the script
>includes versions for unix, mac and windows).  I need to run the script
>on my mac because
>it involves syncing to my Palm Pilot, which I can't easily do at work.

Do yourself a *big* favor.  Go to Chris Nandor's web site,
<http://pudge.net/macperl>, and get his cpan-mac package.  After that,
don't use any other way of installing modules other than the CPAN
module or the installme script.  (Since CPAN needs about 30 Mb free
RAM, you may not be able to run it on older Macs.  But installeme
should run.)  The scripts do all the things that are necessary to
properly install modules under MacPerl, like text conversion and
autosplitting.

>I've checked several MacPerl web sites and the included documentation
>(which is not
>very thorough when it comes to modules, unfortunately) and am getting
>nowwhere!

>Any help would be GREATLY appreciated!

>-Mark

>P.S.  If it helps, the script is "Showtimes", a local movie
>theater/showtime app for
>the Pilot, and can be found at:  http://jrray.visionart.com/showtimes/

>--
>Mark A. Johnson            \ "In the future, employees will either be
>super-
>Denver, CO                  \  stars or perspiration wipers. Those who
>aren't
>mjohnson@h2net.net           \  qualified to do either will become
>managers."
>mark.z.johnson@lmco.com       \      - Prediction #35, The Dilbert
>Future
>_______________________________\_____________________________________________

>=====-----       http://www.h2net.net/p/mjohnson/index.html
>-----=====


--
Paul J. Schinder 
NASA Goddard Space Flight Center 
schinder@leprss.gsfc.nasa.gov 


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

Date: 19 Jun 1999 08:37:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: replacing part of a tab-delimited string
Message-Id: <376bab20@cs.colorado.edu>

In comp.lang.perl.misc, 
    pigs_can_fly@mindless.com (JQ) writes:
:I have a tab-delimited string:
:$string = "one	two	three	four";

That's not tab-delimited.  That's not even whitespace-delimited.
Do you know what delimited means?

--tom
-- 
"Though a program be but three lines long,
someday it will have to be maintained."


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

Date: Sat, 19 Jun 1999 14:58:56 GMT
From: pigs_can_fly@mindless.com (JQ)
Subject: Re: replacing part of a tab-delimited string
Message-Id: <376caf3e.77815066@news.cyberway.com.sg>

Tom Christiansen <tchrist@mox.perl.com> wrote:

>In comp.lang.perl.misc, 
>    pigs_can_fly@mindless.com (JQ) writes:
>:I have a tab-delimited string:
>:$string = "one	two	three	four";
>
>That's not tab-delimited.  That's not even whitespace-delimited.
>Do you know what delimited means?
>
>--tom

Pardon my English.

I have a string:
$string = "one	two	three	four";

with [tab] characters between "one", "two", "three", and "four".


Thanks


JQ


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

Date: 19 Jun 1999 13:40:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: s/\s/ /g does not work for me... why??!!
Message-Id: <7kg6l2$3pa$1@gellyfish.btinternet.com>

On Fri, 18 Jun 1999 16:05:03 -0700 Luis F. Salas wrote:
> 
> I am using $comments = param('comments');
> and that's why I am trying to change the \n to a mere blank space, but
> so far I
> have been unsuccessful. I am including the'##' myself, so that is not a
> problem.
> ^M is...
> 

$comments =~ s/\cM//g;

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 19 Jun 1999 16:18:36 +0200
From: Matthias Teege <mtg@gmx.de>
Subject: Servermodul with fork
Message-Id: <87btec8e9v.fsf@moon.fgh.net>


Moin,

I'm looking for a interactive server modul in Perl wich is a merger of
the sample at perldoc perlipc page 11 and perldoc perlipc page 20/21.

If I send a command to the server the server forks, send the answer
back and then dies.

How can I implement the fork mechanism in in this code?

#!/usr/local/bin/perl5 -w
use IO::Socket;
use Net::hostent;              # for OO version of gethostbyaddr

$PORT = 9002;                  # pick something not in use

$server = IO::Socket::INET->new( Proto     => 'tcp',
                                 LocalPort => $PORT,
                                 Listen    => SOMAXCONN,
                                 Reuse     => 1);

die "can't setup server" unless $server;
print "[Server $0 accepting clients]\n";

while ($client = $server->accept()) {
  $client->autoflush(1);
  print $client "Welcome to $0; type help for command list.\n";
  $hostinfo = gethostbyaddr($client->peeraddr);
  printf "[Connect from %s]\n", $hostinfo->name || $client->peerhost;
  print $client "Command? ";
  while ( <$client>) {
    next unless /\S/;       # blank line
    if    (/quit|exit/i)    { last;                                     }
    elsif (/date|time/i)    { printf $client "%s\n", scalar localtime;  }
    elsif (/who/i )         { print  $client `who 2>&1`;                }
    elsif (/cookie/i )      { print  $client `/usr/games/fortune 2>&1`; }
    elsif (/motd/i )        { print  $client `cat /etc/motd 2>&1`;      }
    else {
      print $client "Commands: quit date who cookie motd\n";
    }
  } continue {
     print $client "Command? ";
  }
  close $client;
}

Thanks
Matthias


-- 
Matthias Teege -- mtg@gmx.de
make world not war
PGP-Key auf Anfrage



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 6057
**************************************

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