[15462] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2872 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 26 18:14:00 2000

Date: Wed, 26 Apr 2000 15:10:24 -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: <956787024-v9-i2872@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 26 Apr 2000     Volume: 9 Number: 2872

Today's topics:
        Is there any free web space which support socket? <lemon@no.iremon.com>
        Looking for a Perl Programmer with Experience in Win32  <sjutmp@msn.com>
    Re: Metacharacters in character classes (Was: [REGEXP]  <lr@hpl.hp.com>
    Re: Metacharacters in character classes (Was: [REGEXP]  <charles.henry@engineer2k.com>
    Re: min/max <aqumsieh@hyperchip.com>
    Re: overloading & 'constant' subroutines (Ilya Zakharevich)
    Re: overloading & 'constant' subroutines <rootbeer@redcat.com>
        Passing a here doc to more <Jeffery_Cann@nospam.sandp.com>
    Re: Perl and SQL <makarand_kulkarni@My-Deja.com>
        Perl Help file <dstiff@delanotech.com>
    Re: Perl Help file <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: Posting MIME articles from scripts <linberg@literacy.upenn.edu>
    Re: print HTML jlamport@calarts.edu
    Re: print HTML (Bart Lateur)
    Re: print HTML <red_orc@my-deja.com>
    Re: Psion 5, was Re: perl man-pages on palmpilot <gellyfish@gellyfish.com>
    Re: Security: why no '.' in path? jlamport@calarts.edu
    Re: Security: why no '.' in path? <rootbeer@redcat.com>
    Re: Security: why no '.' in path? <flavell@mail.cern.ch>
    Re: Security: why no '.' in path? <lr@hpl.hp.com>
    Re: Security: why no '.' in path? <flavell@mail.cern.ch>
        Setting cookies with CGI.pm <adams1015@worldnet.att.net>
    Re: SNMP module examples? (Hans J Jakobsen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Apr 2000 04:36:45 +0900
From: "Lemon" <lemon@no.iremon.com>
Subject: Is there any free web space which support socket?
Message-Id: <8e7gge$a9c$1@news01.iij4u.or.jp>

Is there any free web space which support socket?

I want to use like this.

#!/usr/local/bin/perl
use Socket;


For example,tripod does not seems to support socket.






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

Date: Wed, 26 Apr 2000 15:21:06 -0400
From: "Steven Ulbrich" <sjutmp@msn.com>
Subject: Looking for a Perl Programmer with Experience in Win32 (NT)
Message-Id: <sgefuil3qtj87@news.supernews.com>

My company is looking for an experienced Perl programmer.

We are developing a online booking system.  The responses are real time and
require fast responses.

The information received by the computer reservation system is a text
system, that currently is being saved to a file.  We need to parse the files
and apply to a MS SQL 7.0 database.

I am will to supply information to interested parties.

Thank you

Steven Ulbrich




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

Date: Wed, 26 Apr 2000 14:10:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Metacharacters in character classes (Was: [REGEXP] Extremely important please read!)
Message-Id: <MPG.1370fb39d754f7d098a992@nntp.hpl.hp.com>

In article <8e7iqk$g7a$1@news2.isdnet.net> on Wed, 26 Apr 2000 22:10:09 
+0200, Charles Henry <charles.henry@engineer2k.com> says...
> > The 'dot' in this regex:
> >
> > /[.]/
> >
> > is not the same as the one in this regex:
> >
> > /./
> 
> Darn that's pretty obfuscating :(
> It would've been so much simpler/readable to keep the same meaning for 'dot'
> inside a regexp.

Meaning what?  The set of all characters except "\n" (otherwise 
expressed as '[^\n]') unless the /s modifier is set, in which case it 
could be expressed as '[\x00-\xFF]' or simpler as just '.'.

What about the other regex metacharacters?  What would '+' mean, for 
example, other than the literal plus sign?

You can see the silliness of injecting complex semantics into contexts 
that don't require them -- such as within a character class, which is 
the specification of a set of characters, not a sequence of characters.

If you feel uncomfortable with punctuation characters inside a character 
class, there is no harm in escaping them using '\'.  Just don't expect 
others not to notice.  And don't expect to win any Golf tournaments.

:-)

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


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

Date: Wed, 26 Apr 2000 23:30:13 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: Re: Metacharacters in character classes (Was: [REGEXP] Extremely important please read!)
Message-Id: <8e7ngm$kmd$1@news2.isdnet.net>

> Meaning what?  The set of all characters except "\n" (otherwise
> expressed as '[^\n]') unless the /s modifier is set, in which case it
> could be expressed as '[\x00-\xFF]' or simpler as just '.'.
>
> What about the other regex metacharacters?  What would '+' mean, for
> example, other than the literal plus sign?
>
> You can see the silliness of injecting complex semantics into contexts
> that don't require them -- such as within a character class, which is
> the specification of a set of characters, not a sequence of characters.
>
> If you feel uncomfortable with punctuation characters inside a character
> class, there is no harm in escaping them using '\'.  Just don't expect
> others not to notice.  And don't expect to win any Golf tournaments.
>
> :-)

Hahaha you got that right Larry!
Your explanations were very fruitful and reading them I learnt some really
basic things that were not too clear in my mind. I think you are one of the
wisest contributors of cplm, really. I often read your posts and everytime I
amaze myself of how knowledgeable you are! I am definitely one of your
admirers Larry

--
Charles Henry




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

Date: Wed, 26 Apr 2000 21:27:57 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: min/max
Message-Id: <7ag0s88sdg.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


Larry Rosler <lr@hpl.hp.com> writes:

> In article <7a3dob9gsv.fsf@Merlin.i-did-not-set--mail-host-address--so-
> shoot-me> on Tue, 25 Apr 2000 00:15:45 GMT, Ala Qumsieh 
> <aqumsieh@hyperchip.com> says...
> > 
> > Here's a cool variant:
> > 
> > 	$min = [$a => $b] -> [$b <= $a];
> 
> For some definitions of 'cool'.  Performance certainly isn't one of 
> those definitions.

Usually, performance and coolness are inversely proportional. I
referred to this snippet as cool due to its symmetry. Note the
symmetrical use of the fat comma and less-than-or-equal operator.

Of course, since this constructs an anonymous array, does a
comparison, and then does an array lookup, I wouldn't expect it to
even come close to a simple if statement (ugh) in terms of speed.

--Ala


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

Date: 26 Apr 2000 18:19:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: overloading & 'constant' subroutines
Message-Id: <8e7c04$dm2$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Phoenix 
<rootbeer@redcat.com>],
who wrote in article <Pine.GSO.4.10.10004252317510.25963-100000@user2.teleport.com>:
> Still, I'm not sure why your original code didn't work;

  x * x

is, obviously to any Perler ;-),  x(*x).

How would one fix this?  The only thing which comes to mind is

  use strict 'globs';

which would require globs to be written as *{'x'}?

Ilya


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

Date: Wed, 26 Apr 2000 11:28:10 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: overloading & 'constant' subroutines
Message-Id: <Pine.GSO.4.10.10004261125520.25963-100000@user2.teleport.com>

On 26 Apr 2000, Ilya Zakharevich wrote:

>   x * x
> 
> is, obviously to any Perler ;-),  x(*x).

Got me there!

> How would one fix this?  The only thing which comes to mind is
> 
>   use strict 'globs';
> 
> which would require globs to be written as *{'x'}?

Well, it might require that, if only it were implemented. (So, are you
saying this will be implemented in 5.6.1?)

But that wouldn't solve the problem of x * x being misunderstood; it would
simply make it a compile-time error. (Right?)

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



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

Date: Wed, 26 Apr 2000 15:46:59 -0600
From: Jeffery Cann <Jeffery_Cann@nospam.sandp.com>
Subject: Passing a here doc to more
Message-Id: <390763D3.7130D3C0@nospam.sandp.com>

Greetings.

I am converting a shell script to PERL.  The shell script uses a here
document, passed through the 'more' utility to display the help file.
It is done this way so that the help text is displayed one screen at a
time.

more <<EOT
    Usage:
    ...
EOT

I know that PERL supports here documents.  What I don't know is how to
pass a here document from my PERL script to the 'more' utility or how to
alter the display of the here document within the PERL script so that
one screen displays at a time.  I favor the pass to 'more' approach
because it's simpler.

Suggestions are appreciated.
Thanks

Jeff



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

Date: Wed, 26 Apr 2000 12:40:24 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Perl and SQL
Message-Id: <39074628.E22AFD51@My-Deja.com>

>  Are there
> any modules which should be use'd or require'd to help in tracking
> down why the SQL calls fail?

Print out the var DBI::errstr whenever things fail in your program

eg:
$dbh->do("insert into $table (test) values ($tmp)") or die $DBI::errstr;

In addition

set trace ON using statements like

unlink 'dbitrace.log ' if -e  'dbitrace.log';
DBI->trace (1 ,'dbitrace.log');

at the top of your programs.

Trace messages will be put in the file dbitrace.log
Use the appropriate level of trace so that you do not
end with huge dbitrace.log file sizes.

More information is available in
perldoc  DBI
---




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

Date: Wed, 26 Apr 2000 15:02:52 -0400
From: "David Stiff" <dstiff@delanotech.com>
Subject: Perl Help file
Message-Id: <B3HN4.1166$pb6.1478@client>

Has a Windows style HLP file been created for Perl? One with Contents |
Index | Search tabs?

Thanks.




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

Date: Wed, 26 Apr 2000 13:46:30 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Perl Help file
Message-Id: <390755A6.54E147EB@jpl.nasa.gov>

David Stiff wrote:
> Has a Windows style HLP file been created for Perl? One with Contents |
> Index | Search tabs?

The last time you asked this question, Reini Urban answered it:
http://www.deja.com/getdoc.xp?AN=613901939. 

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: 26 Apr 2000 14:43:30 -0400
From: Steve Linberg <linberg@literacy.upenn.edu>
Subject: Re: Posting MIME articles from scripts
Message-Id: <m3aeigog8d.fsf@projdirc.literacy.upenn.edu>

jcuesta@tid.es (CUESTA CUESTA) writes:

>    I want to post an article with MIME format (containing the article in text
> mode and in HTML format from a perl script. I've tryed with News::NNTPClient
> and Net::NNTP but the don't seem to allow this.

I hope that's true.  MIME isn't for usenet.  At least, it didn't used to
be.  Text only, please.

-- 
Steve Linberg, Chief Goblin
Silicon Goblin Technologies
http://silicongoblin.com
Be kind.  Remember, everyone you meet is fighting a hard battle.


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

Date: Wed, 26 Apr 2000 18:40:26 GMT
From: jlamport@calarts.edu
Subject: Re: print HTML
Message-Id: <8e7d6n$ksh$1@nnrp1.deja.com>

In article <8e7ag6$hg2$1@nnrp1.deja.com>,
>
> Perl Cookbook;1. Strings: 1.0 Introduction

I haven't read it, but I sure hope the following so-called code didn't
actually come from the "Perl Cookbook".  Let's try that again, for the
sake of the newbies who might be utterly baffled by the extended syntax
error that you just posted...

>
> print HTML "<<STOP";

I think you mean:

print HTML <<"STOP";


> <html><head>\n
> <title>My Page</title>\n
> </head>\n
> <body>"Hello World"</body>\n
> </html>\n
> STOP

Is there any reason why you've included all those extra "\n"'s in there?
The << operator is already quoting the newlines just as you typed them.
Do you really need *two* newlines after each line of HTML?

>
> Of course, you really don't need the double-quotes around Hello World,
> unless you want to see them on the HTMP page.

What's HTMP?

-jason


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


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

Date: Wed, 26 Apr 2000 19:36:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: print HTML
Message-Id: <39074299.732534@news.skynet.be>

Todd Anderson wrote:

>I have used the code below to write/create an html page. Any one know how
>to do it with a "here document" so I don't have to escape(\").

Simple enough.

	print HTML <<"##EOT##";
<html><head>
<title>My Page</title>
</head>
<body>"Hello World"</body>
</html>
##EOT##


-- 
	Bart.


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

Date: Wed, 26 Apr 2000 20:44:49 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: print HTML
Message-Id: <8e7kfr$tar$1@nnrp1.deja.com>

In article <8e7d6n$ksh$1@nnrp1.deja.com>,
  jlamport@calarts.edu wrote:
> In article <8e7ag6$hg2$1@nnrp1.deja.com>,
> >
> > Perl Cookbook;1. Strings: 1.0 Introduction
>
> I haven't read it, but I sure hope the following so-called code didn't
> actually come from the "Perl Cookbook".

never said it did.  obvious, in fact that it came from the OP.  The
reference was in case the OP wanted to read more.


> Let's try that again, for the
> sake of the newbies who might be utterly baffled by the extended
syntax
> error that you just posted...
>
> >
> > print HTML "<<STOP";
>
> I think you mean:
>
> print HTML <<"STOP";

thanks for catching that typo.  sorry i missed catching it. dang.
that's what i get for re-typing instead of cut and paste.

>
> > <html><head>\n
> > <title>My Page</title>\n
> > </head>\n
> > <body>"Hello World"</body>\n
> > </html>\n
> > STOP
>
> Is there any reason why you've included all those extra "\n"'s in
there?

they were in the original post, and removal was not essential to the
example.


> The << operator is already quoting the newlines just as you typed
them.
> Do you really need *two* newlines after each line of HTML?
>
> >
> > Of course, you really don't need the double-quotes around Hello
World,
> > unless you want to see them on the HTMP page.
>
> What's HTMP?
>

another typo.  sorry.

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


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


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

Date: 26 Apr 2000 19:58:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Psion 5, was Re: perl man-pages on palmpilot
Message-Id: <8e7e8r$chq$1@orpheus.gellyfish.com>

On Sat, 8 Apr 2000 16:55:06 +0200 Alan J. Flavell wrote:
> On Sat, 8 Apr 2000 rupert@no.spam.leeds.ac.uk wrote:
> 
>> > Not meaning to get into any kind of contest over this, but reading
>> > that posting prompts me to remark that the Psion 5's web browser does
>> > a reasonable job of offline browsing the HTML-ised perl docs.  They
>> > sure take up space on its little memory/filesystem, though.
>> 
>> The subject says PalmPilot.
> 
> So it did.  I suppose I should have modified it.  Sorry.
> 
>> Do we guess that you are running
>> Apache on your Pilot in order to serve up perl docs to your
>> Psion?
> 
> Nothing more exciting than reviewing the Perl documentation while
> travelling.  I don't have the singleness of purpose to actually
> develop apps over the in-flight catering, sorry; 

Another well late post which I cant resist.

I am on the 18:23 from Cannon Street to Hastings right now.  I have all
the Perl documentation and Perl too ;-}  But you dont get charge for
excess hand luggage on the train I guess.

/J\
-- 
Uh huh. Uh huh. Okay. Um, can you repeat the part of the stuff where
you said all about the...things? Uh... the things?
-- 
fortune oscar homer


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

Date: Wed, 26 Apr 2000 18:17:47 GMT
From: jlamport@calarts.edu
Subject: Re: Security: why no '.' in path?
Message-Id: <8e7brq$jdj$1@nnrp1.deja.com>

In article <Pine.GSO.4.10.10004251243280.25963-100000@user2.teleport.com>
,
  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Tue, 25 Apr 2000 jlamport@calarts.edu wrote:
>
> > Okay, I've been reading the CGI security FAQs, and there's one
> > recommendation that I'm not sure I understand:
>
> Hmm. Sounds as if you have a question about CGI programming, rather than
> about Perl. Perhaps you should be checking with a newsgroup about CGI
> programming, such as comp.infosystems.www.authoring.cgi, but I'll see what
> I can do here.
>
> > why is it bad to have the current directory in the search path?
>
> Mostly, this applies when running under a different user-id than the
> original user, including most webserver configurations. (And it's not
> really about the "current directory", but about the insecurity of using
> any relative paths to find programs.)
>
> Say your program will run the 'hostname' command. I could make my own
> 'hostname' command, and put it in a directory of my own choosing, where it
> could be found along the path. Now, your program runs my program which
> could give a false hostname. Or it could read or write something that my
> user-id shouldn't be allowed to do. Or it could do even worse damage,
> depending upon the situation.

Just to make sure I'm clear: you mean, someone with a shell account on
the machine could do this, and then run my script from the *shell*, thus
setting '.' to the directory from which they ran my script, rather than
what my script would expect if it was being run from an http request as
it's supposed to...  so it's *not* really a CGI issue at all: it's an
issue with scripts executable by other users on the same system (of which
CGI scripts just happen to be a common example).  I don't see how someone
could exploit this security hole *just* going through the http server, or
am I missing something?

>
> > And does this only apply to the path, or to @INC as well?
>
> Both, since I could make my own 'strict.pm', say. Of course, '.' would
> normally be at the far end of either list of searchable places, so that
> simple attempt would probably fail.
>
> > I mean, the directory in which the current script is running is
> > *obviously* one that I'm not going to let random people write to.
>
> That's not obvious to me! But you do know that the CGI spec doesn't
> specify which directory will be the current working directory when a CGI
> program is run, right? So a CGI program which uses relative paths before
> chdir'ing to an absolute location is in a state of sin.

Ah, I was not aware of this.  On all the systems I've coded on, the
current directory is always the directory where the script resides, and I
had assumed that this was standard.  I confess: I have occasionally
relied on this assumption and used relative paths... I shall repent and
sin no more!  :)

-jason


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


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

Date: Wed, 26 Apr 2000 11:48:18 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Security: why no '.' in path?
Message-Id: <Pine.GSO.4.10.10004261144130.25963-100000@user2.teleport.com>

On Wed, 26 Apr 2000 jlamport@calarts.edu wrote:

> I don't see how someone could exploit this security hole *just* going
> through the http server, or am I missing something?

Right; this shouldn't normally be a worry in that way. But local users can
still (perhaps) do something as the webserver user (or as another user, if
your program runs set-id). Cheers!

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



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

Date: Wed, 26 Apr 2000 21:15:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Security: why no '.' in path?
Message-Id: <Pine.GHP.4.21.0004262106520.10315-100000@hpplus01.cern.ch>

On Wed, 26 Apr 2000 jlamport@calarts.edu wrote:

>> But you do know that the CGI spec doesn't
> > specify which directory will be the current working directory when a CGI
> > program is run, right? 

> Ah, I was not aware of this.  On all the systems I've coded on, the
> current directory is always the directory where the script resides, and I
> had assumed that this was standard. 

Bingo!  So now you know at least one of the things that the taint
check was protecting you against.  Check the original CGI spec: it
really didn't say anything about current directory setting.

However, the Internet Draft at
http://www.golux.com/~coar/cgi/draft-coar-cgi-v11-03-clean.html

 8.2 Recommendations for Servers 

 Where applicable, servers SHOULD set the current working directory to
 the directory in which the script is located before invoking it.

So nobody could say your idea wasn't at least plausible; but it would
seem a mistake to rely on it.

Of course, -T checking isn't only aimed at CGI scripts, though it
can certainly be a life-saver there ;-)



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

Date: Wed, 26 Apr 2000 13:38:54 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Security: why no '.' in path?
Message-Id: <MPG.1370f3bbc17fb83d98a990@nntp.hpl.hp.com>

In article <Pine.GHP.4.21.0004262106520.10315-100000@hpplus01.cern.ch> 
on Wed, 26 Apr 2000 21:15:27 +0200, Alan J. Flavell 
<flavell@mail.cern.ch> says...

 ...

> However, the Internet Draft at
> http://www.golux.com/~coar/cgi/draft-coar-cgi-v11-03-clean.html
> 
>  8.2 Recommendations for Servers 
> 
>  Where applicable, servers SHOULD set the current working directory to
>  the directory in which the script is located before invoking it.
> 
> So nobody could say your idea wasn't at least plausible; but it would
> seem a mistake to rely on it.

So that recommendation is useless, and absurd from the Standards point 
of view.  Why state what SHOULD be done 'where applicable'?  No one can 
rely on it, so who cares?

   s/.*SHOULD/A server SHALL/

and you have something useful.

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


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

Date: Wed, 26 Apr 2000 23:07:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Security: why no '.' in path?
Message-Id: <Pine.GHP.4.21.0004262253430.10315-100000@hpplus01.cern.ch>

On Wed, 26 Apr 2000, Larry Rosler wrote:

> > http://www.golux.com/~coar/cgi/draft-coar-cgi-v11-03-clean.html

> >  Where applicable, servers SHOULD set the current working directory to
> >  the directory in which the script is located before invoking it.

> So that recommendation is useless, and absurd from the Standards point 
> of view. 

Now you put it that way, I find I would have to agree with you. Since
no-one would rely on it from the original spec, and no-one can rely on
it from this proposal, it seems of decidedly questionable utility, in
a situation that could (as we have been discussing here) have security
implications.

If you look at the coloured version, this text is in green i.e it
appears that it was introduced between draft 00 and 01.  There does
not seem to be anything in the "open issues" area related to it.

> Why state what SHOULD be done 'where applicable'?  No one can 
> rely on it, so who cares?

Agreed.  Perhaps we should drop a note about this discussion to Ken
Coar?  I have to admit I had quoted the text without really thinking-
over its consequences, and your point is certainly well taken.

all the best



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

Date: Wed, 26 Apr 2000 18:34:10 GMT
From: "Veronica Adams" <adams1015@worldnet.att.net>
Subject: Setting cookies with CGI.pm
Message-Id: <CEGN4.35868$WF.1735933@bgtnsc04-news.ops.worldnet.att.net>

I am still having problems setting cookies with cgi.pm. I've read the
documentation several times as well as information from books and I cannot
find a solution. Please help me. By boss is breathing down my neck for this
script!

here is the code in question:
#!/usr/bin/perl -w
use CGI qw(:all);
use CGI::Carp qw(carpout fatalsToBrowser);
use diagnostics;
use vars;

my $cmd = param('cmd');
my $id = cookie('cart_id');
if ($cmd == 1) {
      # add the item to the cart.
     $company{prod_num} = param('prod_num');
     if (defined $id){
         # fires code if the id in the cookie exists.
     }
else{
           $id = assign_id();
           $id_cookie = cookie(-NAME=>"cart_id",
                             -VALUE=>$id,
                             -EXPIRES=>"+1h",
                             -DOMAIN=>"www.SITENAME.com",
                             -PATH=>"/cgi-bin/warrior/"
                             );
          my $cart_file = "$carts/$id" . ".crt";
          print header(-COOKIE=>$id_cookie);
}
sub assign_id {
      # returns a random cart id
      my ($rand_number) = int(rand 9999) + 10000;
      return $rand_number;
}

Now when I call this from the browser, it does not write the script to
temporary internet files like its supposed to do.

When I call it from the perl debugger I everything seems ok but when I check
the value of $id_cookie after the cookie() call I get this:

DB<3> x $id_cookie
0  cart_id=14817; domain=www.SITENAME.com; path=/cgi-bin/warrior/;
expires=We
d, 26-Apr-2000 19:22:47 GMT
   'domain' => 'www.SITENAME.com'
   'expires' => 'Wed, 26-Apr-2000 19:22:47 GMT'
   'name' => 'cart_id'
   'path' => '/cgi-bin/warrior/'
   'value' => ARRAY(0x843ba10)
      0  14817
  DB<4> n

whats upp with 'value'=>??

here is the output of the header()  call:

Set-Cookie: cart_id=14817; domain=www.SITENAME; path=/cgi-bin/warrior/; e
xpires=Wed, 26-Apr-2000 19:22:47 GMT
Date: Wed, 26 Apr 2000 18:24:37 GMT
Content-Type: text/html

Looks ok to me- but the cookie never gets written. And yes I have cookies
enabled in my browser. :)

Any help would be appreciated. I've been struggling with this for about a
week now.
Thanks




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

Date: 26 Apr 2000 18:38:04 -0000
From: hjj@news1.tele.dk (Hans J Jakobsen)
Subject: Re: SNMP module examples?
Message-Id: <8e7d2c$4n5$1@news1.tele.dk>

Mike Ayers <do.not.mail.me@null.net> writes:



>Hans J Jakobsen wrote:

>> I have with succes used the pingmib.pl script as starting point.
>> (but now my problem is that I want to it all in parrallel)

>	SNMP in parallel?  Do you realize that master agents inevitably
>serialize most requests?  The best thing to do is to use multivarbind
>requests and let the master agent handle it as efficiently as it can.

The problem is that the number of devices is large. When the network is
behaving well there is no problem in doing the investigation sequential.
Each snmp get/set takes a fraction of a second. But when there are trouble
it might take more than a second and there might be retries.
Thats why I would like to do many devices in parallel.

/hjj
-- 
Hans Jørgen Jakobsen


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

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


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