[16676] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4088 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 21 21:06:20 2000

Date: Mon, 21 Aug 2000 18:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966906315-v9-i4088@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 21 Aug 2000     Volume: 9 Number: 4088

Today's topics:
        authorisation script required (Kevin)
        Cansomeone please explain this hash error? <webqueen@my-deja.com>
    Re: Cansomeone please explain this hash error? <tina@streetmail.com>
    Re: cmd.exe on Perl for NT 4 <abe@ztreet.demon.nl>
    Re: driver <weiguo@263.net>
        FTP module trouble <mike@hulenbend.net>
    Re: Help! How to solve the problem? (David Efflandt)
    Re: HELP: TEXTAREA field and newlines <heinsius@u.washington.edu>
    Re: help: wanted perl programmer london (David H. Adler)
    Re: how to generate unreadable from readable perl code (Craig Berry)
        IO::Socket::INET and $SIG{'ALRM'} <basil.achermann@bluewin.ch>
    Re: Membership management <timewarp@shentel.net>
    Re: newbie question about "uninitialized variables" <lr@hpl.hp.com>
    Re: newline and carriage return problems <flavell@mail.cern.ch>
    Re: newline and carriage return problems flanagab@hqamc.scott.af.mil
        Perl + Administration of NT4 <Alessandro.Augusto@br.bosch.com>
    Re: sending mail with mailx (Randal L. Schwartz)
        system() output screwing up redirection. swan_daniel@my-deja.com
    Re: system() output screwing up redirection. swan_daniel@my-deja.com
    Re: This is my last question, I swear!!!!!!!!!! (HillFam2)
        Updating textfile problem... <musicfan@punitiveart.com>
    Re: Variable vanishing? <timewarp@shentel.net>
    Re: Variable vanishing? <smerr612@mailandnews.com>
    Re: Variable vanishing? <smerr612@mailandnews.com>
    Re: Variable vanishing? <tina@streetmail.com>
    Re: Variable vanishing? <mauldin@netstorm.net>
    Re: Variable vanishing? <tina@streetmail.com>
    Re: Variable vanishing? <tina@streetmail.com>
    Re: Variable vanishing? <r28629@email.sps.mot.com>
        writing data out to a database wtih CGI.pm (a question  (Eric White)
    Re: writing data out to a database wtih CGI.pm (a quest <tina@streetmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 22 Aug 2000 00:38:18 GMT
From: REMOVEMEmelonmisc@iname.com (Kevin)
Subject: authorisation script required
Message-Id: <39a1cb2b.4534975@news.ozemail.com.au>

hi all

i am looking for a scrip that does the followiong

has different login and passwords, and each login and password
redirects to a different url

i have searched on the web, most scripts are way to complex for what i
need

thanks for any help in advance

kev


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

Date: Mon, 21 Aug 2000 23:47:20 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Cansomeone please explain this hash error?
Message-Id: <8nsf23$mkm$1@nnrp1.deja.com>

 untie attempted while 1 inner references still exist at ./sweep.pl line
406 (#1)

Inspecting the hash after the updates look like its working fine..

My hash is populated with hashrefs (hash of hash)..

Hug,
WQ


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Aug 2000 00:37:09 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Cansomeone please explain this hash error?
Message-Id: <8nshvk$8s0s3$8@ID-24002.news.cis.dfn.de>

hi,
webqueen, queen of the web <webqueen@my-deja.com> wrote:
>  untie attempted while 1 inner references still exist at ./sweep.pl line
> 406 (#1)

> Inspecting the hash after the updates look like its working fine..

this is warning. perldoc perldiag says:
untie attempted while %d inner references still exist
           (W) A copy of the object returned from tie (or tied)
           was still valid when untie was called.

HTH,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Tue, 22 Aug 2000 01:52:19 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: cmd.exe on Perl for NT 4
Message-Id: <u0f3qs4kbi9bdvb0loilvjsra7l26c6eht@4ax.com>

On Mon, 21 Aug 2000 19:36:02 GMT, djberg96@my-deja.com wrote:

> Hi all,
> 
> I can't seem to get a stinkin' console to display in Win32.  I'm
> actually trying this from a perl/tk pull-down menu, but I've also tried
> it in a non-tk script so that shouldn't matter (should it?).
> 
> I've tried a basic system command:
> system("$SystemRoot\\system32\\cmd.exe"); # Double backslash necessary
> 
> But that only generates a shell within a shell, it doesn't actually
> create a new console window.

OT, but ok:

use the 'start' command:

	system 'start', '/WAIT', "$SystemRoot/system32/cmd.exe";

type: 
	help start

And if you're pulling $SystemRoot out of the environment, you might
aswell use $ENV{COMSPEC}.

-- 
Good luck,
Abe


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

Date: Mon, 21 Aug 2000 13:52:06 +0800
From: "weiguo" <weiguo@263.net>
Subject: Re: driver
Message-Id: <8nqg0t$1suf$1@news.cz.js.cn>

For mSQL, you should use DBD::mSQL.
For MS SQL server, you should use DBD::ODBC.
You can download them from http://www.cpan.org/modules/by-module/DBD/ .

weiguo
weiguo@263.net
from Beijing, PR China


Troy Rasiah <troyr@vicnet.net.au> wrote in message
news:o_0o5.3623$Vb.95618@ozemail.com.au...
> does anyone know how i would connect a perl script to MSQL Database
>
> Is it using DBD::mSQL or DBD::ODBC
>
> where can i download these drivers from....
>
> if they are the ones?
>
> Thanks
>
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
>
>




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

Date: Mon, 21 Aug 2000 17:10:47 -0500
From: "mike" <mike@hulenbend.net>
Subject: FTP module trouble
Message-Id: <8ns9b4$oju3@news1.lmtas.lmco.com>

I am very poor working with modules and I obviously have some problems here,
I think in the way I am attempting to call Net::Cmd.

I guess  " @ISA = qw(Net::Cmd); " is an array of commands that I can use,
but I don't understand how they should be applied.

Any help is appreciated.

Mike

     #! /usr/bin/perl -w
     #
     # this is ftp_ex.pl
     #
     # this code connects to the mainframe and processes commands
     #

     use Net::FTP;
     use Net::Cmd;

     my $username = "\myid";
     my $password = "mypass";
     my $host = "tn3270.mainframe.com";

     my $ftp = Net::FTP->new("$host", Debug => 1);

     unless ( $ftp->login($username, $password) )
      {
      print "Not in\n";
      }
      else
      {
      print "Logged in\n";
      }

     @ISA = qw(Net::Cmd);

     $ftp->qw("edit");                        #tso edit command
     $ftp->qw("mike.data");               #the name of the file

     $ftp->qw("input");                      #input is a  subcommand of edit
     $ftp->qw("this is a text line");     #here is the text
     $ftp->qw("save");                      #save is a subcommand of edit
     $ftp->qw("end");                       #end the edit session

     $ftp->quit;

here is the output :::


     Net::FTP: Net::FTP(2.33)
     Net::FTP:   Exporter
     Net::FTP:   Net::Cmd(2.11)
     Net::FTP:   IO::Socket::INET
     Net::FTP:     IO::Socket(1.1603)
     Net::FTP:       IO::Handle(1.1505)

     Net::FTP=GLOB(0xc72a4)<<< 220-TCPFTP IBM MVS V3R2 at
     mainframe.com, 14:
     37:21 on 2000/08/21
     Net::FTP=GLOB(0xc72a4)<<< 220 Connection will close if idle
     for more than 5 minu
     tes.
     Net::FTP=GLOB(0xc72a4)>>> user myid
     Net::FTP=GLOB(0xc72a4)<<< 331 Send password please.
     Net::FTP=GLOB(0xc72a4)>>> PASS ....
     Net::FTP=GLOB(0xc72a4)<<< 230 myid is logged on.  Working
     directory is "myid.".
     Logged in

     Can't locate auto/Net/FTP/qw.al in @INC (@INC contains:
     /applocal/lib/perl5/5.00
     502/sun4-solaris /applocal/lib/perl5/5.00502
     /applocal/lib/perl5/site_perl/5.005
     /sun4-solaris /applocal/lib/perl5/site_perl/5.005 .) at
     ftp_cmd.pl line 31

     Net::FTP=GLOB(0xc72a4)>>> QUIT
     Net::FTP=GLOB(0xc72a4)<<< 221 Quit command received. Goodbye.




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

Date: Tue, 22 Aug 2000 00:33:49 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Help! How to solve the problem?
Message-Id: <slrn8q3ij9.bb5.efflandt@efflandt.xnet.com>

On Mon, 21 Aug 2000 11:27:46 GMT, hewuma@yahoo.com <hewuma@yahoo.com> wrote:
>I have a question.
>My scripts run successfully in Linux. When run it in browser? Small one
>is running well. But for the
>large perlscript, I got following error message:
>The page cannot be displayed
>The page you are looking for is currently unavailable. The Web site
>might be experiencing technical difficulties, or you may need to adjust
>your browser settings.
>
>(snip)
>
>Cannot find server or DNS Error
>Internet Explorer
>How to solve the problem?
>Hope anybody can answer my question
>Hewu

What error do you get when you run ./scriptname.cgi from the shell on
Linux?  If there is no error, you do not have a Perl problem.

You either have a DNS problem, a CGI problem or a webserver configuration
problem, none of which has anything to do with Perl.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Mon, 21 Aug 2000 08:42:23 -0700
From: Nigel Heinsius <heinsius@u.washington.edu>
Subject: Re: HELP: TEXTAREA field and newlines
Message-Id: <B5C69BEF.19C7%heinsius@u.washington.edu>

Thanks all...

> From: Jim Mauldin <mauldin@netstorm.net>
> Organization: Mauldin Consulting
> Newsgroups: comp.lang.perl.misc
> Date: Mon, 21 Aug 2000 02:45:34 GMT
> Subject: Re: HELP: TEXTAREA field and newlines
> 
> Perry Winkle wrote:
>> 
>> I've got a TEXTAREA field into which users may unfortunately type
>> newlines. I need to get rid of the newlines so that I can get
>> everything onto a single line.
>> 
>> For some reaso, this is not working for me:
>> 
>> $textblock =~ s/\n\n/<P>/;
>> $textblock =~ s/\n/<BR>/;
>> 
>> $textblock (VALUE) still shows up as:
>> 
>> <INPUT TYPE=hidden NAME=bio_info VALUE="Here is line 1
>> <BR>
>> <BR>Here is line 2">
>> 
>> How can I get this on one line? I've tried the /m and /s modifiers, but
>> I'm not really sure how to set up the expression.
> 
> I don't know what your data looks like, but that should work as long as
> you use the /g modifier to catch them all:
> 
> $textblock =~ s/\n\n/<P>/g;
> $textblock =~ s/\n/<BR>/g;
> 
> You could also do it in one step:
> 
> $textblock = "Here is some information that I entered in a textbox
> but then I scrolled off the screen and decided to enter some
> newlines so that I could read what I've written.
> 
> Now I want to start a new idea so I enter two newlines to
> really set it off from the previous paragraph";
> 
> $textblock =~ s/(\n)(\1?)/$2?"<p>":"<br>"/eg;
> print $textblock;  # all on one line
> 
> -- Jim



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

Date: 21 Aug 2000 22:46:56 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: help: wanted perl programmer london
Message-Id: <slrn8q3cb0.sv.dha@panix6.panix.com>

On Mon, 21 Aug 2000 17:22:27 GMT, eldras@my-deja.com <eldras@my-deja.com> wrote:

>html, javascript and web knowledge. london only

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
America leads the world in shocks.
	- Gil Scott-Heron


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

Date: Mon, 21 Aug 2000 22:01:57 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <sq39ml7j87v54@corp.supernews.com>

Martien Verbruggen (mgjv@tradingpost.com.au) wrote:
: I underlined a crucial part of my remark. I know fully well that parsing
: Perl source in general is hard. However, _if_ you want to obfuscate
: variables, you can write the code in such a way that it is easily
: parseable. And you can do so without much trouble. Perl is hard to parse
: because it allwos so many things. In real life code very few of the hard
: to parse things occur.

Right.  I'd suggest the following constraints would make the task easy, or
at least much easier:

1) No variables of different types with the same name (@foo and $foo)
2) No use of the type indicators $@% in other contexts
3) No use of typeglobs
4) If you want to obfuscate function names too, requiring & would make
   this a lot easier

: Besides, anyone who uses %, @ or $ as a separator for s///, tr///, m//
: or qq and related operators, should be taken outside behind the shed,
: and summarily shot :)

Several times.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Every force evolves a form."
   |              - Shriekback


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

Date: Tue, 22 Aug 2000 01:49:38 +0200
From: Basil Achermann <basil.achermann@bluewin.ch>
Subject: IO::Socket::INET and $SIG{'ALRM'}
Message-Id: <39A1C003.2DEE7B27@bluewin.ch>

I'm writing a small perl script that should connect to a server over the
Internet. If the server's not online (timeout), the program should do
some error processing.


Here's my "connect" function :


sub connect
{
  my($address, $port) = @_;

  eval
  {
    $SIG{'ALRM'} = sub { die "timeout" };
    alarm $DEF_Timeout;

    $rem =IO::Socket::INET->new(PeerAddr =>$address,
                            PeerPort =>$port,
                            Proto    =>'tcp');

    alarm 0;
    $SIG{'ALRM'} = 'DEFAULT';
  };

  etc.
}


But on the alarm signal, the OS produces an ordinary:
   [1]   -   Alarm clock             ./abc.pl

Instead of invoking my sub, the script is being quit. If I put something
like

    while(){};

instead of

    $rem =IO::Socket::INET->new();

the alarm works correctly. Also, if I let the program run on other
machines (same system: SunOS 5.6), everything works fine. Anyone knows
how to solve that problem?

Thanks in advance,
Tom



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

Date: Mon, 21 Aug 2000 18:14:26 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Membership management
Message-Id: <39A1A9C2.D674B5B4@shentel.net>

nicros -

I have just completed a system for a siteof mine that allows me to add users
and passwords, edit them, and remove them, as well as create email aliases
for them. I did this because the server admin tools to perform these
operations that my hosting company provides really suck. If you are unable
to find what you are looking for, let me know and I can cobble something
together that would probably suit your needs  for you for a very reasonable
$$$. To do this, I would need a lot more specific info about your server in
so far as the specific encryption routine used and locations of critical
files. I don't want to sound like I am trying to bleed $$$ out of you but to
make a 'universal' script would be rather difficult because of the many
different configurations of servers out there. Not to say that such a script
does not exist, but should you find yourself in a jam and are in need of
one, I can customize something that will work for you.

Albert Dewey

nicros@my-deja.com wrote:

> I posted this earlier, I forgot to specify that this is for a linux
> system (RH 6.2) running Apache...
>
> I am looking for a free or shareware membership management package that
> will be useable for a non-technical person.  It would need to control
> multiple users via a simple hmtl page (this user will not have root
> access), and any other features are a bonus, like any kind of tracking.
>
> It can be either a .htaccess parser/manipulator or deal directly with a
> db (mysql is my choice), and my preference (hence the post to this
> group) would be a perl utility.
>
> Before I reinvent the wheel, does anyone have any suggestions on what is
> the best or most standard script/module for this? What is the most
> popular, professional, etc.
>
> Thanks!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Mon, 21 Aug 2000 16:11:46 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbie question about "uninitialized variables"
Message-Id: <MPG.140b570a749819a98acb3@nntp.hpl.hp.com>

[Who knows how many potential readers won't see your post, because of 
the 'newbie' in its Subject.]

In article <39a19a64.28263165@news.earthlink.net> on Mon, 21 Aug 2000 
21:39:28 GMT, Jon S. <jonceramic@nospammiesno.earthlink.net> says...

 ...

> I've been declaring my "my" variables at the start of my scripts with
> a my($foo1, $foo2); declaration.

Many people prefer to declare them where they are first needed.

> The problem I just saw on a script was that, if I never gave the
> variables a value, but used them in an if statement condition, I was
> getting a "use of unitialized variable" error.  

Not in a simple Boolean test.   See below.

 ...

> I've gotten around this using 
> $foo1='';
> $foo2='';

  my ($foo1, $foo2) = ("") x 2;

> But, I've got to think there is a better/different/more standard way.
> Did I miss a FAQ listing on this one?  If so, RTFM's are greatly
> appreciated.

I don't think so.

> Also, other than having -w generate the error (I assume it's -w and
> not use strict;), is there any real danger to using uninitialized
> variables?

The danger is that the suppression of warnings might hide other errors.

>             (These variables are used as true/false holders, but I
> only have code to set them to false (i.e. "no").  If they don't equal
> "no" later on, I assume they're "yes"s.)

It would be more usual to leave the false variables alone and assign 
values to the true ones.  Then oue could test simply by:

    if ($foo) { ... }

which would draw no warning if false (uninitialized), because in a 
simple Boolean test undef (uninitialized) is an acceptable 'false' 
value.

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


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

Date: Mon, 21 Aug 2000 23:54:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: newline and carriage return problems
Message-Id: <Pine.GHP.4.21.0008212348110.24813-100000@hpplus03.cern.ch>

On Mon, 21 Aug 2000 flanagab@hqamc.scott.af.mil wrote:

> I am trying to get the complete output of the TEXTAREA in a field of my
> database, however, I need to *retain* the CRs in the field.  The problem
> is that Perl keeps trying to translate the CRs into CRLFs. 

With respect: you're so totally confused that you don't even seem to
be able to describe your problem clearly.

CR and LF are control characters which, should you so choose, you can
read in binary mode and process in any way you see fit.

> The LF is
> not acceptable, since this is interpreted as EOR.

If you choose to read a data stream as text, then its platform-
dependent behaviour in Perl is well-defined, but perhaps it's not what
you want.

You'll also find it easier to conduct a reasonable conversation on
usenet if you don't try to stand on your head.  Cite the specific
point in the previous discussion which you believe to be germane to
the issue, and then type your response to it.  Excise everything which
seems to you to be irrelevant.  Then we'll all have a better idea of
how your reasoning is working, and thus be better able to assist.


[comprehensive history of usenet omitted at this point]

-- 

      A patent application requires an implementation, 
      which is impossible due to the lack of sufficently 
      dense material to make one that would work.
       - Glenn Randers-Pehrson discussing specification for a clue-stick



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

Date: Mon, 21 Aug 2000 22:41:09 GMT
From: flanagab@hqamc.scott.af.mil
Subject: Re: newline and carriage return problems
Message-Id: <8nsb61$i6v$1@nnrp1.deja.com>

I've already tried that.  I want to take our the lf.

$lf = chr(10);
$stuff =~/$lf//g;

This will result in no change in the string.  I *think* what is
happening, is that the characters are being deleted, but something is
causing another one to be inserted back in.  I suspect this is what is
happening, because if I change the replacement to something besides an
empty string, I will see the new string, but AFTER the character I
searched for.  For example:

$stuff =~ s/\x0a/stuff/g;

 ...where $stuff is \x0d\x0a123

Will yield the result:

\x0d\x0astuff123

Any more ideas?

In article <39A1A5BF.A4B0D20F@shentel.net>,
  Albert Dewey <timewarp@shentel.net> wrote:
> I am not sure which chr( ) item is which but try one of these two -
>
> $cr = chr(13);
> $Description =~ s/$cr//g;
>
> or
>
> $cr = chr(10);
> $Description =~ s/$cr//g;
>
> I have always used these in pairs and never took the time to remember
which
> one was which. One or the other of the two codes above might do what
you
> want. Try them out and see if you don't get the results you are
looking for.
>
> Albert Dewey
>
> flanagab@hqamc.scott.af.mil wrote:
>
> > I am trying to get the complete output of the TEXTAREA in a field of
my
> > database, however, I need to *retain* the CRs in the field.  The
problem
> > is that Perl keeps trying to translate the CRs into CRLFs.  The LF
is
> > not acceptable, since this is interpreted as EOR.
> >
> > The <BR> idea would work if all I wanted to do was display the data
on
> > the web, but that's not the purpose.  Do you have any other ideas?
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 21:29:21 -0300
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Perl + Administration of NT4
Message-Id: <39A1C961.9237B20E@br.bosch.com>

Hello,

I am looking for tutorials, papers, articles or sites about how can
I use perl to help administrate my NT network.

Things that I would like to do:
* remotely set values to the registry
* remotely start/stop services
* modify acls
* etc

I have been looking for this help, but Its has been hard to find.
Can someone help me pointing me to the right direction.

Thanks,
Alessandro



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

Date: 21 Aug 2000 16:37:28 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: sending mail with mailx
Message-Id: <m1lmxqdw3r.fsf@halfdome.holdit.com>

>>>>> "tequila" == tequila  <cgibert@tequila-rapido.fr> writes:

tequila> I have a problem with mailx.

tequila> I must use this program on solaris with perl and It doesn't work (mail
tequila> is not sent although the syntax  I use works for sendmail on Unix)
tequila> Do you know  what's wrong with it...

Yes, you're using sendmail-style stuff (address in headers, headers on
STDIN) with mailx (address on command line, no headers can be
specified, STDIN is entire body).  In other words, they have entirely
different philosophies and cannot be interchanged.  You lose. :)

And the real problem is THIS:

tequila>     print MAIL "$contenu \n";

Ouch ouch ouch ouch... What if $contenu has a line that begins with
a tilde!?  You now have a big BIG BIG security hole.

Don't use mailx for ANYTHING.  Don't.  Not from a program.  Don't.
Send via sendmail or SMTP, but not mailx.  Don't.  Am I making myself
clear?  Just say no.  Don't.  Got it?  Don't.

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 21 Aug 2000 23:10:19 GMT
From: swan_daniel@my-deja.com
Subject: system() output screwing up redirection.
Message-Id: <8nscsd$k7p$1@nnrp1.deja.com>

system() output??  I must be crazy!  From what I understand, system()
has no output other than a return code.

Here's the lines in question:

print "Location: http://$IPADDR/traffic/index${time}.html", "\n\n";

system("/usr/local/bin/ipacsum --timeframe \"$forminput\"  --gif
$TRAFDIR --gif-index /home/httpd/html/traffic/index${time}.html --png-
caption-in-index  --png-asis --fixed-quantity M --png-height 480 --png-
width 640 2>&1 > /dev/null");

The web browser out put reads "Internal server error..."

/var/log/httpd/error_log reads "malformed header from script. Bad
header=IP accounting summary: /home/httpd/cgi-bin/ipac.cgi"

Somehow, output from the script is getting back and screwing with my
redirection.  So I tried an alternate format:

@ipacsum=("/usr/local/bin/ipacsum"," --timeframe"," today"," --gif","
$TRAFDIR"," --gif-
index"," /home/httpd/html/traffic/index${time}.html\n"," 2>&1","
>"," /dev/null");
system(@ipacsum);

Still the same thing.  perldoc -f system wasn't of much help, and I
havn't found anything like this in the dejanews archives...

Anyone have any ideas?

Thanks in advance,
Dan.




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 23:19:30 GMT
From: swan_daniel@my-deja.com
Subject: Re: system() output screwing up redirection.
Message-Id: <8nsddh$krd$1@nnrp1.deja.com>

And as an addendum, I also tried the following format:

system("/usr/local/bin/ipacsum --timeframe \"$forminput\"  --gif
$TRAFDIR --gif-index /home/httpd/html/traffic/index${time}.html --png-
caption-in-index  --png-asis --fixed-quantity M --png-height 480 --png-
width 640 2>&1 > /dev/null");

-This simply didn't execute.

Thoughts?



In article <8nscsd$k7p$1@nnrp1.deja.com>,
  swan_daniel@my-deja.com wrote:
> system() output??  I must be crazy!  From what I understand, system()
> has no output other than a return code.
>
> Here's the lines in question:
>
> print "Location: http://$IPADDR/traffic/index${time}.html", "\n\n";
>
> system("/usr/local/bin/ipacsum --timeframe \"$forminput\"  --gif
> $TRAFDIR --gif-index /home/httpd/html/traffic/index${time}.html --png-
> caption-in-index  --png-asis --fixed-quantity M --png-height 480 --
png-
> width 640 2>&1 > /dev/null");
>
> The web browser out put reads "Internal server error..."
>
> /var/log/httpd/error_log reads "malformed header from script. Bad
> header=IP accounting summary: /home/httpd/cgi-bin/ipac.cgi"
>
> Somehow, output from the script is getting back and screwing with my
> redirection.  So I tried an alternate format:
>
> @ipacsum=("/usr/local/bin/ipacsum"," --timeframe"," today"," --gif","
> $TRAFDIR"," --gif-
> index"," /home/httpd/html/traffic/index${time}.html\n"," 2>&1","
> >"," /dev/null");
> system(@ipacsum);
>
> Still the same thing.  perldoc -f system wasn't of much help, and I
> havn't found anything like this in the dejanews archives...
>
> Anyone have any ideas?
>
> Thanks in advance,
> Dan.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Aug 2000 00:56:59 GMT
From: hillfam2@aol.com (HillFam2)
Subject: Re: This is my last question, I swear!!!!!!!!!!
Message-Id: <20000821205659.09119.00000190@ng-md1.aol.com>

Its clear you have the data in a file, so after you read the data into an
array, then use the sort function.


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

Date: Mon, 21 Aug 2000 17:52:03 -0700
From: musicfan <musicfan@punitiveart.com>
Subject: Updating textfile problem...
Message-Id: <agj3qs8ju9rf04752ph081r6ai31v5n1da@4ax.com>

Sigh.  OK, here is the relevant code.  It outputs the  proper info
when I use the debugger, but when I run it from the web page it
doesn't actually execute the 

print PEOPLE "$name|$password|$clickthrough\n";

line properly (e.g. the db file doesn't change at all, however when I
run it through the debugger, the "testing purposes only" line reflects
the proper record has been changed.)

I'm just trying to change field3 to a 1 if field1 is equal to the
username passed by the browser!  



open(PEOPLE, "+<$datafile");
@PEOPLE=<PEOPLE>;

			 foreach $rec(@PEOPLE){

($name,$password,$clickthrough)=split(/\|/,$rec);


			 	if ($name eq $username){
			 	   $clickthrough='1'
				   }
# next line is for testing purposes only
print "$name|$username|$password|$clickthrough\n";
			 	

print PEOPLE "$name|$password|$clickthrough\n";	

			 }

#print "Location: http://localhost/default.asp\n\n";
close(PEOPLE);


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

Date: Mon, 21 Aug 2000 18:06:26 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Variable vanishing?
Message-Id: <39A1A7E2.2454CBB4@shentel.net>

Steve -

>>> Couldn't open file /archive/20000523142707-20000703111734.log <<<

The main thing that I notice here is that the specified file location given
starts with a forwardslash '/' which means you are looking in a directory
that starts at root. I am assuming that you are actually trying to look in a
sub directory below where the cgi program lives. Remove the forwardslash and
maybe you will find your file there. Hope this helps.

Albert Dewey

Steven Merritt wrote:

> Here's semi-working code.
>
> #! /usr/local/bin/perl -w
> use strict;
>
> my $From_Date = 20000000000000;
> my $To_Date = 20000525135144;
> my $Name = "";
> my $Oldest = "";
> my $Youngest = "";
> my $FlName = "";
> my @fllist = `ls -1 /archive/??????????????-??????????????.log`;
> my @Include = "";
> my @LogLines = "";
>
> foreach $FlName (@fllist){
>   (undef, $Name) = split /\/archive\//, $FlName;
>   $Name =~ s/\.log//;
>   ($Oldest, $Youngest) = split /-/, $Name;
>   if ($Youngest < $From_Date){
>      next;
>      }
>      elsif ($Oldest > $To_Date){
>         next;
>         }
>   push @Include, $FlName;
>   }
> print @Include;
>
> foreach $FlName (reverse @Include){
>   chomp $FlName;
>   open FH, '$FlName' or die "Couldn't open file $FlName $!\n";
>      while (defined (<FH>)){
>        push @LogLines, $_;
>        }
>   }
>
> print @LogLines;
>
> The problem is in the second foreach loop. It dies with this output
>
> Couldn't open file /archive/20000523142707-20000703111734.log
> No such file or directory
>
> But there _is_ such a file.  And I do have permissions on it.
>
> -rwxr-xr-x   1 bob      jerks       505622 Jul  3 13:21
> 20000523142707-20000703111734.log
>
> I've tried open (FH, "$FlName")  and a ton of other
> quoting/parenthisizing schemes.  Nothing works. And yet this snippet
> works just fine(but doesn't do what I need, I need them all in one array
> to pass to a sub)
>
> foreach $FlName (reverse @fllist){
>   (undef, $Range) = split /\/archive\//, $FlName;
>   $Range =~ s/\.log//;
>   ($Oldest, $Youngest) = split /-/, $Range;
>   next if ($Youngest < $From_Date);
>   next if ($Oldest > $To_Date);
>   chomp $FlName;
>   print "$FlName\n";
>   open (FH, "$FlName") or die "Couldn't open file  $!\n";
>   @LogLines = <FH>;
> }
>
> Surely there's something simple I'm missing here?  Surely there's a way
> to do this without making a bunch of temp arrays and concatenating them
> with splice?
>
> Steven
> --
> King of Casual Play
> The One and Only Defender of Cards That Blow
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Mon, 21 Aug 2000 23:03:33 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Variable vanishing?
Message-Id: <8nscfq$jim$1@nnrp1.deja.com>

In article <39A1A7E2.2454CBB4@shentel.net>,
  Albert Dewey <timewarp@shentel.net> wrote:
> Steve -
>
> >>> Couldn't open file /archive/20000523142707-20000703111734.log <<<
>
> The main thing that I notice here is that the specified file location
given
> starts with a forwardslash '/' which means you are looking in a
directory
> that starts at root. I am assuming that you are actually trying to
look in a
> sub directory below where the cgi program lives. Remove the
forwardslash and
> maybe you will find your file there. Hope this helps.

Nope, that's the actual full pathname to the datafile, this isn't a CGI.
The file is in the /archive directory relative to root.

It's really giving me fits, I'm not sure if it's a bug, if so it exists
in both 5.00404 and 5.00503 (all the versions I have available to test
with).

Since the first part(finding the appropriate data files based on search
date range) works fine, any suggestions on alternate methods of getting
all the lines into a line by line array from multiple files(not all the
log files in the dir) would be appreciated.  Any suggestions about using
globs?  I've never used them because their use is deprecated from what I
read(and I don't see how they would be useful).

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 21 Aug 2000 23:16:15 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Variable vanishing?
Message-Id: <8nsd7g$kj4$1@nnrp1.deja.com>

In article <8ns7sq$5tf$1@brokaw.wa.com>,
  "Lauren Smith" <lauren_smith13@hotmail.com> wrote:
>
> Steven Merritt <smerr612@mailandnews.com> wrote in message
> news:8ns6bp$cjf$1@nnrp1.deja.com...
> >
> > I went back and changed the open call to open (FH, "$FlName") and
now I
> > get this error message(no other changes to the script)
> >
> > Couldn't open file  No such file or directory
> >
>
> I hate to ask the obvious, but does the file exist?  You can't open a
file
> for reading if it doesn't exist.
>
> perldoc -f open

Yes, it exists, I showed a line containing it from a ls -al of the
target directory which shows I have read permissions on it as well.
I've even played around with print statements to be sure the variable
being passed to open doesn't have a leading or trailing space or
anything.  From everything I can tell, everything is fine, then I do
this

foreach $FlName (reverse @Include){

#  and bam, $FlName isn't printing(when I do print $FlName; right after
#  the foreach, $FlName  can't open
#  $FlName is _NOT_ the last element of @Include

Here is the full output of the program

fllist.pl
/archive/20000101000000-20000523135144.log
/archive/20000523142707-20000703111734.log
Couldn't open file  No such file or directory

The two filenames are from when I print @Include.  They have trailing
newlines which I chomp off before I try to open().

But, as shown, that is the @Include.  It's last element, the one it
should try to open first, is somehow not propagating to the open() or
the implicit print in the  "or die".  And it doesn't matter if I
reverse() the array or not.

Steven
--
The Bewildered King of Casual Play
The One and Only Defender of Cards That Blow


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 21 Aug 2000 23:31:26 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Variable vanishing?
Message-Id: <8nse4e$8s0s3$4@ID-24002.news.cis.dfn.de>

hi,
Steven Merritt <smerr612@mailandnews.com> wrote:
> In article <39A1A7E2.2454CBB4@shentel.net>,
>   Albert Dewey <timewarp@shentel.net> wrote:
>>
> Since the first part(finding the appropriate data files based on search
> date range) works fine, any suggestions on alternate methods of getting
> all the lines into a line by line array from multiple files(not all the
> log files in the dir) would be appreciated.  Any suggestions about using

I would use readdir and then grep.
my @files = readdir FH;
@files = grep {somefunc()} @files;

and in somefunc() you can specify which files
you want.

HTH
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Mon, 21 Aug 2000 23:47:05 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Variable vanishing?
Message-Id: <39A1BEBF.48BAF411@netstorm.net>

Steven Merritt wrote:
> 
> my @Include = "";


I believe that your problem (once the open "$FlName" error is fixed)
goes back to the above line, which actually creates an array element
with a null string.

Try this instead:

my @Include = ();

-- Jim


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

Date: 21 Aug 2000 23:47:53 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Variable vanishing?
Message-Id: <8nsf39$8s0s3$5@ID-24002.news.cis.dfn.de>

hi,
Steven Merritt <smerr612@mailandnews.com> wrote:
> Here's semi-working code.

> my $Name = "";
> my $Oldest = "";
> my $Youngest = "";
> my $FlName = "";

why are you doing these intializations?
that's useless

> my @Include = "";
> my @LogLines = "";

ok, this is wrong. your assigning something
to these arrays, so they contain something
*before* you step into the foreach loop.
and it's obvious that perl cannot open
a file "".
just say 
my @Include;
and try again.

HTH,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: 22 Aug 2000 00:01:02 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Variable vanishing?
Message-Id: <8nsfru$8s0s3$7@ID-24002.news.cis.dfn.de>

hi,
Steven Merritt <smerr612@mailandnews.com> wrote:
> In article <8ns7sq$5tf$1@brokaw.wa.com>,
>   "Lauren Smith" <lauren_smith13@hotmail.com> wrote:
>> Steven Merritt <smerr612@mailandnews.com> wrote in message
>> news:8ns6bp$cjf$1@nnrp1.deja.com...

> Here is the full output of the program

> fllist.pl
> /archive/20000101000000-20000523135144.log
> /archive/20000523142707-20000703111734.log
> Couldn't open file  No such file or directory

> But, as shown, that is the @Include.  It's last element, the one it
> should try to open first, is somehow not propagating to the open() or
> the implicit print in the  "or die".  And it doesn't matter if I
> reverse() the array or not.

yep, that's what i assumed. see myother posting. perl
tries to open "", I guess, because you assigned it
to @Include by saying
my @Include = "";

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Tue, 22 Aug 2000 08:41:35 +0800
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Variable vanishing?
Message-Id: <39A1CC3F.383D75F2@email.sps.mot.com>

Steven Merritt wrote:
> 
> In article <39a1959c.3c67$148@news.op.net>,
>   mjd@plover.com (Mark-Jason Dominus) wrote:
> > [mailed and posted]
> >
> > In article <8ns3lo$91i$1@nnrp1.deja.com>,
> > Steven Merritt  <smerr612@mailandnews.com> wrote:
> > >  open FH, '$FlName' or die "Couldn't open file $FlName $!\n";
> >
> > This says to open a file whose name is '$FlName'.  That is, the file's
> > name is seven characters long and begins with a dollar sign.
> >
> > You want
> >
> >         open FH, $FlName or die ...
> >
> > >I've tried open (FH, "$FlName")  and a ton of other
> > >quoting/parenthisizing schemes.
> >
> > Maybe you had some other bug at the same time that led you to believe
> > that "$FlName"  'didn't work'.
> 
> I went back and changed the open call to open (FH, "$FlName") and now I
> get this error message(no other changes to the script)
> 
> Couldn't open file  No such file or directory
> 
> So it leaves out the variable in the error message(meaning variable is
> unfilled?).  I've tried doing a print before the open to see if the
> $FlName variable gets filled, and it doesn't. 

run your script in the debugger and 'x $FlName' to find out what is
actually inside it before you open, and backtrack on the variable. Don't
print - it's misleading at most times. 

Also, do a plain open with your target file, and you should be sure if
the 'open' statement is offending or just, to quote MJD, that you had
some other bug.

HTH.

-TK


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

Date: Mon, 21 Aug 2000 23:22:05 GMT
From: ejwhite1@facstaff.wisc.edu (Eric White)
Subject: writing data out to a database wtih CGI.pm (a question about arrays)
Message-Id: <8nsd6k$gha$1@news.doit.wisc.edu>

I'm using CGI.pm to collect some info. Right now I'm just writing the values 
out to a file with the save_parameters function, but I'd like to write the 
data to a database. I think I can do this with the DBI module - and I'll look 
into that more - but I've got sort of a general question: How can I take a     
checkbox_group variable or question from the form and write its values (stored 
in an array in perl) into a database? Do I somehow need to pull out each of 
the array elements into scalar vars before I try writing data out to a 
database?  I'm getting sort of stumped thinking about how to do this. 

Thanks a lot for any suggestions! 


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

Date: 21 Aug 2000 23:56:44 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: writing data out to a database wtih CGI.pm (a question about arrays)
Message-Id: <8nsfjs$8s0s3$6@ID-24002.news.cis.dfn.de>

hi,
Eric White <ejwhite1@facstaff.wisc.edu> wrote:
> into that more - but I've got sort of a general question: How can I take a     
> checkbox_group variable or question from the form and write its values (stored 
> in an array in perl) into a database? Do I somehow need to pull out each of 
> the array elements into scalar vars before I try writing data out to a 
> database?  I'm getting sort of stumped thinking about how to do this. 

well, that depends on how you construct your database.
how do you want it stored?
if you have something like
@colours = param('colours');
and you want to store it
like "red,green,purple" then
use the join() function.
perldoc -f join
otherwise this is more a database question.

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 4088
**************************************


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