[12663] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 72 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 7 23:07:19 1999

Date: Wed, 7 Jul 1999 20:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 7 Jul 1999     Volume: 9 Number: 72

Today's topics:
    Re: advice on data structures, and more (Anno Siegel)
    Re: AIX socket broken-ness? <ngps@my-deja.com>
    Re: AIX socket broken-ness? (NICHOLAS DRONEN)
        another Out of Memory error <dkranowsGET.RID@OF.THIS.scdt.intel.com>
    Re: Best method to test a sting within an array? (Neko)
    Re: cgi question, can you help me? (Abigail)
        Chopping the beginning of a variable <hyu1@mipos2.intel.com>
    Re: Chopping the beginning of a variable (Martien Verbruggen)
        Fork & Exec proc & get return values? ccort@my-deja.com
    Re: Help -- Weird Increments (MacPerl) <john@your.abc.net.au>
    Re: Help -- Weird Increments (MacPerl) (Anno Siegel)
        Help needed for cookie temp project to pay. <fetch@fetchound.com>
    Re: Help needed for cookie temp project to pay. (Martien Verbruggen)
        How to format date and year string? <anonymous@web.remarq.com>
    Re: How to format date and year string? <joeyandsherry@mindspring.com>
    Re: How to format date and year string? (Martien Verbruggen)
    Re: I need to hide the source (Mark W. Schumann)
        Internetworking Engineers... <jbaird@idirect.com>
        Server <-> Server Secure Transaction without a browser  (Geoff Joy)
        simple date <technology@workmail.com>
    Re: simple date (Martien Verbruggen)
    Re: Summing Array to Hash elements (Larry Rosler)
    Re: Summing Array to Hash elements RABM@prodigy.net
        throw me a bone here!........please <me@sixs.com>
    Re: throw me a bone here!........please (Anno Siegel)
    Re: throw me a bone here!........please (Martien Verbruggen)
    Re: Weird /x regexps <ptimmins@itd.sterling.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 8 Jul 1999 02:01:45 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: advice on data structures, and more
Message-Id: <7m10q9$52d$1@lublin.zrz.tu-berlin.de>

Ross  <litscher@cis.ohio-state.edu> wrote in comp.lang.perl.misc:

[the usual advance apologies]

>Please be gentle. Now here is what i'm trying to do. I need to sort
>entries of a "database"  according to zip code first and then within zip
>code, the institution name. So i'm splitting up each line doing
>something like this

>while(<CLEAN_LIST>)
>{
>    ($first_name, $last_name, $institution, $department, $address_2,
>$address, $city, $state, $zip, $error_code) = split /,/, $_, 10;

Since you're never referencing all those variables, why not just split
into an array? @vars

     my @vars = split /,/, $_, 10;

>    push @{ $all_lines[$line_counter] },  "all of the above variables";

This is pretty chaotic.  Did you run the program with warnings switched on?
I don't think you mean what you wrote.  Just push a reference to the array
of variables onto an array.  No need for a line counter when you're using
push.

     push @all_lines, \@vars;

>    $line_counter++;
>}
>
>by the way, entries of the database look like:
>"Ross","Litscher","Ohio State","","","111 My Rd.",
>"Columbus","OH","43210",""
>"Joe","Shmoe","Malanabapoop","Biomed","","321 His St.",
>"Columbus","OH","43210",""
>
>so when i do the split, it leaves in the quotes. One question is, since
>they all have quotes, if I sort these will the quotes play any part in
>deciding the order? I would think not, but I am not sure, since I am new
>to the perl world.

Alphabetic sorting is the same in the Perl world as in every other
world where this sort of thing is done.  But then, apparently you want
a numerical sort on the zip codes.  The quotes stop you from doing that.

>i have tried sorting like this:
>
>@sorted = sort {
>                     zip($a) <=> zip($b) ||
>                     institution($a) <=> institution($b) ||
>                   }     @all_lines;

How is your program to know what you mean by zip($a) and institution($a)?
Also, what is the second "||" doing there?  Again, -w would have been
enlightening.  Further, since your institution is a string, you should
use cmp for comparison.

>i can't remember if this worked at all or not. i remember getting two
>various results by changing things around. one, which i think this is
>what the code was, was that is got hung up on zip, thinking is was a
>subroutine? 

Yes, that's the syntax for a subroutine call.  It could even be defined
in a way that works.

>            the other problem i ran into while trying to write a correct
>implementation was it threw everything into the zeroith place of the
>array, so instead of accessing by doing $sorted[3][8], to get the same
>item i would do $sorted[0][28]. which isn't what I expected nor wanted.

It did?  Well, I guess it depends on what @all_lines contained at the
time.

>So I am not too sure that I'm going about this the right way at all.
>Could someone offer me a little insight? should i be reading the data
>into a different kind of structure? I know there were a couple more
>questions I had, I can't think of them right now. I hope this message
>allows you to comprehend what I am trying to do.

Divine, is more like it.  Anyway, putting it all together, the following
should work:

#!/usr/bin/perl -w
use strict;

my $inst = 2;   # Third item gets number 2...
my $zip =  8;   # ...counting from zero

my @all_lines;
while(<DATA>)
{
    tr/"//d;                      # get rid of those useless quotes
    my @vars = split /,/, $_, 10; # it's important to use my here
    push @all_lines,  \@vars;
}


my @sorted = sort { $a->[ $zip] <=> $b->[ $zip] ||
                    $a->[ $inst] cmp $b->[ $inst] } @all_lines;

__DATA__
"Ross","Litscher","Ohio State","","","111 My Rd.","Columbus","OH","43210",""
"Joe","Shmoe","Malanabapoop","Biomed","","321 His St.","Columbus","OH","43210",""


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

Date: Thu, 08 Jul 1999 02:04:16 GMT
From: Ng Pheng Siong <ngps@my-deja.com>
Subject: Re: AIX socket broken-ness?
Message-Id: <7m10uq$u9f$1@nnrp1.deja.com>

In article <lILg3.3$xEh.170585600@news.frii.net>,
  mirabai@io.frii.com (NICHOLAS DRONEN) wrote:
> The only good perl is the perl that you've build
> yourself and which passes `make test`.

Agreed. I built perl on AIX and FreeBSD. 'make test' passed.
The Linux one came with RedHat.


> In other words, get the perl source, compile it,
> run `make test`.  If `make test` runs clean and
> the problem persists, upgrade (at least) the following
> filesets -- bos.[um]p, bos.net.tcp.client and bos.rte.libc --
> and reboot.

I'll look into that. (I'm not having much luck navigating
IBM's website.)

Thanks.

- PS


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


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

Date: Thu, 08 Jul 1999 02:48:14 GMT
From: mirabai@io.frii.com (NICHOLAS DRONEN)
Subject: Re: AIX socket broken-ness?
Message-Id: <OjUg3.11$xEh.170582016@news.frii.net>

Ng Pheng Siong (ngps@my-deja.com) wrote:
: In article <lILg3.3$xEh.170585600@news.frii.net>,
:   mirabai@io.frii.com (NICHOLAS DRONEN) wrote:
: > The only good perl is the perl that you've build
: > yourself and which passes `make test`.

: Agreed. I built perl on AIX and FreeBSD. 'make test' passed.
: The Linux one came with RedHat.


: > In other words, get the perl source, compile it,
: > run `make test`.  If `make test` runs clean and
: > the problem persists, upgrade (at least) the following
: > filesets -- bos.[um]p, bos.net.tcp.client and bos.rte.libc --
: > and reboot.

: I'll look into that. (I'm not having much luck navigating
: IBM's website.)

ftp://service.software.ibm.com/aix/fixes/v4/os 


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

Date: Wed, 07 Jul 1999 18:18:36 -0700
From: Daniel Kranowski <dkranowsGET.RID@OF.THIS.scdt.intel.com>
Subject: another Out of Memory error
Message-Id: <3783FC6C.60BE@OF.THIS.scdt.intel.com>

I also have an Out Of Memory error that I can't get rid of.  Maybe you
folks can help?

I found what seems to be the source of the error by commenting out two
sections of code.  Section #1 is a call to a function, foo(), that
performs a lot of multiplications and divisions.  Section #2 enlarges an
array with "push".  The problem happens when the input case is very
large and the loop around these sections of code is going millions of
times.  It seems like I should not run out of memory unless (a) I'm
allocating where I didn't realize or (b) memory is not getting free'd
internally.  I'm running Perl v 5.004 on a unix system.

I realize it might be hard to divine the problem from that short
description, so maybe some general info would help.  How can you detect
memory leaks?  The -DL debugging option isn't supported, and the -Dm
option is very hard to use.  (I noticed on some simple -Dm examples that
the number of mallocs/reallocs doesn't equal the number of frees.) 
Maybe if I could trap memory usage by code line number, that would
really help track down the leak.

Any advice here would be appreciated!
-Daniel
dkranowsNOSPAM@SPAMOFF.scdt.intel.com


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

Date: 8 Jul 1999 01:38:04 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Best method to test a sting within an array?
Message-Id: <7m0vds$gvg$0@216.39.141.200>

On 7 Jul 1999 18:52:22 -0500, abigail@delanet.com (Abigail) wrote:

>pedro (pedro@nospam.co.uk) wrote on MMCXXXVI September MCMXCIII in
><URL:news:37837901.1426987@news.freeuk.net>:
>
>() $m=(grep($match,@array));
>
>You didn't even bother to read the documentation of grep, did you?

I agree.  Read the documentation.  Or do something stupid...

tie $match, Match => sub { /\w/ };
$m = grep $match, @array;

package Match;

sub TIESCALAR {
    my ($class, $sub) = @_;
    $sub = sub { $_ } unless ref $sub eq 'CODE';
    bless $sub, $class;
}
sub FETCH { shift->() }
sub STORE {}
sub CLOSE {}


-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: 7 Jul 1999 22:02:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi question, can you help me?
Message-Id: <slrn7o854i.ued.abigail@alexandra.delanet.com>

Miroslav (miroslav@gamestats.com) wrote on MMCXXXVI September MCMXCIII in
<URL:news:3783E8A8.6AA418F8@gamestats.com>:
() you could
() 
() print "Please wait for results...";
() 
() [ do your stats thing here ] #it'll wait I think until server finishes
() 
() print "Here's your stats...";
() 
() Just a thought, I never used anything like this


And of course, all the buffers between your program and the client
happily flush on demand.

I don't think so.



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 07 Jul 1999 19:22:09 -0700
From: Harry Yu <hyu1@mipos2.intel.com>
Subject: Chopping the beginning of a variable
Message-Id: <37840B50.7A336985@mipos2.intel.com>

Hi,
Does anyone know how to chop the beginning characters of a variable.
The chop command works for the end of the variable.

Ex.   $variable = Whatever

And I want to get rid of the W, h, a.
Anyone know a command or a way to do it?

Thanks
Harry




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

Date: Thu, 08 Jul 1999 02:39:22 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Chopping the beginning of a variable
Message-Id: <ubUg3.87$RX3.6530@nsw.nnrp.telstra.net>

In article <37840B50.7A336985@mipos2.intel.com>,
	Harry Yu <hyu1@mipos2.intel.com> writes:

> Does anyone know how to chop the beginning characters of a variable.

One possibility:

s/^.//;

or even 

s/.//;

This question comes up regularly on this newsgroup, and has been
answered with considerable artistry and creativity. Use a news archive
to find the solutions. Something like dejanews will do.


> Ex.   $variable = Whatever
> 
> And I want to get rid of the W, h, a.

$variable = s/^Wha//;

-- 
Martien Verbruggen                  | 
Interactive Media Division          | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd.       | Universe and Reboot +++
NSW, Australia                      | 


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

Date: Thu, 08 Jul 1999 01:49:10 GMT
From: ccort@my-deja.com
Subject: Fork & Exec proc & get return values?
Message-Id: <7m102i$tvp$1@nnrp1.deja.com>

Hello,

I am writing a simple link checker in Perl.  I have a demon process
that uses fork() and exec() to spawn multiple instances of another
script which checks a link.  Currently, the only thing I can get back
is the 8-bit exit code from the spawned child(ren).  I don't require
any complex IPC.  I just want to be able to get back, say, 3 integers.

Can someone please point me in the right direction?  I've been combing
everything I can find on Threads on the web.  I did not have success
with Thread.pm.  The fork() and exec() work fine except for this issue
with the return values.  I am working on Solaris, although ultimately
this will be on AIX.


Thanks!
Chris
Chris.Cortese@xxxNOSPAMxxxschwab.com


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


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

Date: Wed, 07 Jul 1999 17:12:57 -0800
From: johnny99 <john@your.abc.net.au>
Subject: Re: Help -- Weird Increments (MacPerl)
Message-Id: <931396379.13178@www.remarq.com>

  >    >  This script works just fine on
  >    >  UNIX, by the way, and you end up
  >    >  with a file consisting of just

  >  You broke off there. Was that
  >  because you found the program
  >  behaves under unix just as it
  >  does on the mac?

Er, no -- I had to post this via remarQ and it's behaving
weirdly. That line should have read:

"with a file consisting of just the number 5"

The rest of the post didn't come out properly either, at
least on my browser.

Here it is again, with square brackets where there should be
anglebrackets, i.e. around the filehandle:

open ([NUMBER],"+<data.txt");
	$num = [NUMBER];
	print "I got $num from the data.txt file ";
	$num++;
		print "and I incremented it to $num.\n";
print NUMBER $num;
close [NUMBER];

  >  When you write to the file after
  >  reading to eof, you append to it.
  >  Also, the increment works in
  >  string mode, since you never use
  >  the string you read from the file
  >  in a numeric context.

Could you please check the code above and see if your answer
still applies?

I thought this line:

     $num = [NUMBER];

would take the zero and put it into the variable.

I take your point about appending -- what's the correct
argument for "take the entire file in, then when finished,
overwrite the entire file with the output" in that c



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: 8 Jul 1999 02:28:03 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help -- Weird Increments (MacPerl)
Message-Id: <7m12bj$557$1@lublin.zrz.tu-berlin.de>

johnny99  <john@your.abc.net.au> wrote in comp.lang.perl.misc:
>  >    >  This script works just fine on
>  >    >  UNIX, by the way, and you end up
>  >    >  with a file consisting of just
>
>  >  You broke off there. Was that
>  >  because you found the program
>  >  behaves under unix just as it
>  >  does on the mac?
>
>Er, no -- I had to post this via remarQ and it's behaving
>weirdly. That line should have read:
>
>"with a file consisting of just the number 5"
>
>The rest of the post didn't come out properly either, at
>least on my browser.
>
>Here it is again, with square brackets where there should be
>anglebrackets, i.e. around the filehandle:

You are quite right.  Sometimes angle brackets belong around a
filehandle.  Square brackets never do.  And if Abigail now posts
valid perl with square brackets around a filehandle, I declare that
a dirty trick.  Before I've even seen it.

>open ([NUMBER],"+<data.txt");
>	$num = [NUMBER];
>	print "I got $num from the data.txt file ";
>	$num++;
>		print "and I incremented it to $num.\n";
>print NUMBER $num;
>close [NUMBER];
>
>  >  When you write to the file after
>  >  reading to eof, you append to it.
>  >  Also, the increment works in
>  >  string mode, since you never use
>  >  the string you read from the file
>  >  in a numeric context.
>
>Could you please check the code above and see if your answer
>still applies?

No, it doesn't.  My answer is now: It won't compile.

>I thought this line:
>
>     $num = [NUMBER];
>
>would take the zero and put it into the variable.

$num = <NUMBER> takes whatever is at the current file position
and puts it into the variable.  After that, the file position is
right beyond whatever was read, which is, in this particular case,
at the end of the file.

>I take your point about appending -- what's the correct
>argument for "take the entire file in, then when finished,
>overwrite the entire file with the output" in that c

Not a particular argument.  But seek NUMBER, 0, 0 before the print
will rewind the file to the beginning, which is what you want.

>**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****

They seem to end here too.  Prematurely, at times.

Anno


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

Date: Wed, 07 Jul 1999 18:13:57 -0800
From: Tomh <fetch@fetchound.com>
Subject: Help needed for cookie temp project to pay.
Message-Id: <931400038.13573@www.remarq.com>


Hi,

Have what I think is a simple cookie project.

Check for cookie, if cookie get cookie, otherwise set
cookie.

Further details are avaailable via email and the www.

Thanks for your time.

Tom Hicks
tomh@fetchound.com



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Thu, 08 Jul 1999 02:51:36 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help needed for cookie temp project to pay.
Message-Id: <YmUg3.89$RX3.6530@nsw.nnrp.telstra.net>

In article <931400038.13573@www.remarq.com>,
	Tomh <fetch@fetchound.com> writes:

> Have what I think is a simple cookie project.

Great! I was waiting for a simple project! Especially one with cookies!

> Check for cookie, if cookie get cookie, otherwise set
> cookie.

Hmmmm..

my $rc = checkForCookie();
if ($rc) 
{
	my $cookie = getCookie();
}
else
{
	setCookie();
}

> Further details are avaailable via email and the www.

Further details are available after signing the contract and paying
some money.

> Thanks for your time.

No problem.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | This matter is best disposed of from a
Commercial Dynamics Pty. Ltd.       | great height, over water.
NSW, Australia                      | 


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

Date: Wed, 07 Jul 1999 18:04:53 -0800
From: batman@mailexcite.com <anonymous@web.remarq.com>
Subject: How to format date and year string?
Message-Id: <931399495.13520@www.remarq.com>

I would like to get the current date and make a string in
the form of 1999/07/07
I used localtime() to get the date and year, but could not
find a function to convert the string to the form I want. Is
there any function that could do that? If not, is there an
easy way to do that?  Any help would be appreciated.

Thanks in advance!



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Wed, 7 Jul 1999 22:28:23 -0400
From: <joeyandsherry@mindspring.com>
Subject: Re: How to format date and year string?
Message-Id: <7m12fu$1tj$1@nntp1.atl.mindspring.net>

Here's what I'd use:

$sep="/";
@months =
('January','February','March','April','May','June','July','August','Septembe
r','October','November','December');
@days =
('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
($sec,$min,$hour,$day,$month,$year,$day2) =
(localtime(time))[0,1,2,3,4,5,6];
if ($sec < 10) { $sec = "0$sec"; }
if ($min < 10) { $min = "0$min"; }
if ($hour < 10) { $hour = "0$hour"; }
$month++;

$REAL_DATE="$month$sep$day$sep$year";

and for your case
add:

$year += "1900";
$REAL_DATE="$year$sep$month$sep$day";

Good Luck,


--
Joey Cutchins
President
Trading Post.Com, L.L.C.
-The Race is to the Driven, Not the Swift.
http://internettradingpost.com
ceo@internettradingpost.com






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

Date: Thu, 08 Jul 1999 02:57:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to format date and year string?
Message-Id: <XsUg3.90$RX3.6530@nsw.nnrp.telstra.net>

In article <7m12fu$1tj$1@nntp1.atl.mindspring.net>,
	<joeyandsherry@mindspring.com> writes:
> Here's what I'd use:

[snip]

I normally wouldn't have followed up on this one, since there is
another thread with the same subject ('simple date') right now, and I
just posted a response to that. But since there is a much better way
than the stuff posted in response here, I'll duplicate my effort. Just
for today.

use POSIX;
print strftime("%Y/%m/%d", localtime()), "\n

or

my ($day, $month, $year) = (localtime)[3,4,5];
$year += 1900;
$month += 1;
printf("%d/%02d/%02d\n", $year, $month, $day);

Martien

PS. You have a bug in your code., which will be visible from the year
2000 onwards.

PPS. You should read up on the qw() operator.

PPPS. You should read up on the printf and sprintf functions.

PPPPS. You should read up on localtime(). It doesn't need the call to
time(), since that is the default.
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd.       | but mean your mother.
NSW, Australia                      | 


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

Date: 7 Jul 1999 21:20:50 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: I need to hide the source
Message-Id: <7m0udi$3f1@junior.apk.net>

In article <7m09lg$lvh$1@nnrp1.deja.com>,  <rdosser@my-deja.com> wrote:
>I need to hide a decryption algorithm for confidential data. That's
>probably not in the FAQ.

Probably?

Did you check?



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

Date: Wed, 07 Jul 1999 21:29:44 -0400
From: John Baird <jbaird@idirect.com>
Subject: Internetworking Engineers...
Message-Id: <3783FF08.86503FEB@idirect.com>

Hello,

I have just finished working on a series of PERL scripts which automate
the configuration of non-interface specific parameters (however it could

work for interface specific paramsl) on CISCO devices (switches, and
routers).

There are two scripts that the user would run: 'devices.pl' and
'autoconf.pl'.

The 'devices.pl' script will parse the seed file**  from any one of the
following Network Mngt Systems(NMS): NetView6000, HP OpenView, and
Tivoli TME 10, extract the hostnames by device type (i.e. Catalyst
1900, 2900xl, 3900, 5000, all routers) and OSPF Area as specified by the

user.  Currently in order to take full advantage of the OSPF filtering
the organization would need to be using an internal 'Class A' network
address space and the second octet would represent the OSPF area.  In
most large Internetworks that are utilizing the routing protocol OSPF
this is how it is usually done!

 The 'autoconf.pl' script reads in hostnames from a hostname file(as
created by 'devices.pl'), telnets to the targeted device and executes
what ever commands are located in the command file closes the TCP
connection and reads in the next hostname until it reaches the end of
the hostname file.

As an Internetworking Professional, it goes with-out saying that I am
not a professional programmer however I do enjoy scripting, as such as
professional PERL programmer you may find the scripts peppered with "bad

coding" techniques; however these scripts enable me to reconfiure vty,
aux and enable passwords and various other parmas on 1000 Cisco routers
in approximately 2 hours!!!

Every Internetworking Engineer could benefit from these scripts and I
would like to make them publicly available.

If you think that these sound interesting and would like to look at them

feel free to contact me.

** A seed file is a textual representation of the Internetwork as seen
by NMS, in order to create a seed file a user will issue the following:
/usr/OV/bin/ovtopodump -lr > <filename>

regards,

Jonathan Baird
Telecommunications Analyst
Toronto, Ontario
Canada



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

Date: 07 Jul 1999 20:02:03 PDT
From: geoffj@hatespam.deltanet.com (Geoff Joy)
Subject: Server <-> Server Secure Transaction without a browser between?
Message-Id: <378510fb.367321312@news.concentric.net>

Greetings,

What's the recommended (best?) way to perform a form transaction
between servers?  Here's the scenario:

Two web servers involved.

1.  Server1 has account information stored in a file.
2.  Server2 is web-based credit-card transaction system,
    (e.g., AuthorizeNet, IBill).
3.  Server1 has cron job tasked with aging accounts and posting
    c-c transactions automatically to Server2.
4.  Server2 expects FORM data from a browser client.
5.  Server2 posts back accept/decline info.
6.  Based on result of transaction, renew or delete the account.

Should/must I use sockets to establish connection and post form
data from Server1 or is there a better/simpler method?

I have no control of scripts on Server2.

Geoff


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

Date: Wed, 07 Jul 1999 19:12:35 -0700
From: Raj <technology@workmail.com>
Subject: simple date
Message-Id: <37840913.E3A43376@workmail.com>


--------------52478E311EDA289A3043F02F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,
can we get the date in format "yyyymmdd" in perl ?
at unix command prompt,
date '+%Y%m%d'
results in yyyymmdd format.
but i'm unable to get the same thru system command from within perl.
Any clue please..???? TIA,
RAj

--------------52478E311EDA289A3043F02F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<br>can we get the date in format "<b>yyyymmdd</b>" in perl ?
<br>at unix command prompt,
<br><b>date '+%Y%m%d'</b>
<br>results in yyyymmdd format.
<br>but i'm unable to get the same thru <b>system</b> command from within
perl.
<br>Any clue please..???? TIA,
<br>RAj</html>

--------------52478E311EDA289A3043F02F--



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

Date: Thu, 08 Jul 1999 02:48:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: simple date
Message-Id: <fkUg3.88$RX3.6530@nsw.nnrp.telstra.net>

In article <37840913.E3A43376@workmail.com>,
	Raj <technology@workmail.com> writes:
> 
> --------------52478E311EDA289A3043F02F
> Content-Type: text/plain; charset=us-ascii

Don't do this. UseNet is a plain text medium, not some collection of
multimedia crap.

> can we get the date in format "yyyymmdd" in perl ?

use POSIX;
print strftime("%Y%m%d", localtime()), "\n";

or

my ($day, $month, $year) = (localtime)[3,4,5];
$year += 1900;
$month += 1;
printf("%d%02d%02d\n", $year, $month, $day);

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | You can't have everything, where would
Commercial Dynamics Pty. Ltd.       | you put it?
NSW, Australia                      | 


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

Date: Wed, 7 Jul 1999 18:25:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Summing Array to Hash elements
Message-Id: <MPG.11ed9dc980aea669989c72@nntp.hpl.hp.com>

In article <3783F09D.C5F30D9E@email.com> on Thu, 08 Jul 1999 00:28:12 
GMT, Jordan Hiller <hiller@email.com> says...
> This worked for me, although it may not be very efficient:
> 
> my(%hash);
> my(@array) = qw/hello world hi hello this is a sample world/;
> 
> foreach(@array) {
> 	$hash{$_}++ or $hash{$_} = 1;
> }

Perl is so smart that just this will do (without drawing a warning):

  foreach(@array) {
  	$hash{$_}++;
  }

or even, for the punctuation-challenged:

  $hash{$_}++ for @array;

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


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

Date: 07 Jul 1999 21:24:23 -0400
From: RABM@prodigy.net
Subject: Re: Summing Array to Hash elements
Message-Id: <u4sjg0w8o.fsf@prodigy.net>

>>>>> "wired2000" == wired2000  <wired2000@my-deja.com> writes:

    wired2000> Hi,
    wired2000> I have an array that stores a list of unknown keywords (see below) and
    wired2000> I would like to convert this array to a hash table which stores the
    wired2000> total number of occurances in the array.

    wired2000> Ex:

    wired2000> Sample Data Stored in the array @data
    wired2000> hello
    wired2000> world
    wired2000> hi
    wired2000> hello
    wired2000> this is a
    wired2000> sample
    wired2000> world

    wired2000> I want this to be represented into a hash table as such:
    wired2000> hello     2
    wired2000> world     2
    wired2000> hi        1
    wired2000> this is a 1
    wired2000> sample    1

    wired2000> As well, after the new data structure has been done, I need an easy way
    wired2000> to go through all keys in the hash and report them to the user.

my %word;
while( <DATA> =~ m/(.+)/g) {
    $word{$1}++;
}
print map { "$_\t$word{$_} \n" } keys %word;

__DATA__
hello
world
hi
hello
this is a
sample
world
HTH
Vinny

-- 
Vinny Murphy


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

Date: Wed, 07 Jul 1999 18:37:59 -0700
From: { R a N d i } <me@sixs.com>
Subject: throw me a bone here!........please
Message-Id: <378400F6.B47F85C2@sixs.com>

hi there cant figure out what is wrong

i did the -w command and this is what i got
possible typo:"LOCK_FILE" at bnbform.cgi line 306

 304.     # Do Nothing
305.    }
306.    open(LOCK_FILE, ">$lockfile");
307. }
308.
309. sub drop_the_lock
310. {
311.   close($lockfile);
312.   unlink($lockfile);

possible typo:"i" at bnbform.cgi line 115

113. sub decode_vars
114.  {
115.   $i=0;
116.   read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
117.   @pairs=split(/&/,$temp);
118.   foreach $item(@pairs)
119.    {
120.     ($key,$content)=split(/=/,$item,2);
121.     $content=~tr/+/ /;
122.     $content=~s/%(..)/pack("c",hex($1))/ge;
123.     $content=~s/\t/ /g;
124.     $fields{$key}=$content;
125.     if ($key eq "data_order")
126.       {

Use of uninitialized varible at bnbform.cgi line 116
content-type: text/html

<h1>NO data_order list SPECIFIED!</h1>




can anyone clue a newbie in as to where to start

the log file says bnbform.cgi failed for sf-xxx.sfo.com, reason:
malformed header from script. Bad header=www... Recipient names must be

thank you your help is greatly appreciated




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

Date: 8 Jul 1999 03:01:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: throw me a bone here!........please
Message-Id: <7m14ar$57d$1@lublin.zrz.tu-berlin.de>

{ R a N d i }  <me@sixs.com> wrote in comp.lang.perl.misc:
>hi there cant figure out what is wrong
>
>i did the -w command and this is what i got
>possible typo:"LOCK_FILE" at bnbform.cgi line 306
>
> 304.     # Do Nothing
>305.    }
>306.    open(LOCK_FILE, ">$lockfile");
>307. }
>308.
>309. sub drop_the_lock
>310. {
>311.   close($lockfile);
>312.   unlink($lockfile);

If LOCK_FILE is used for what it appears to be, you don't need
to worry about the typo warning, but that's the only thing with
this kind of interlocking you don't have to worry about.  It is
insecure, and sooner or later a process will lock out others even
after it has ceased to exist. To alleviate the latter, unlink the
file immediately after opening it.  For the former, use sysopen
with O_EXCL, and check the error on sysopen to conclude you
are locked out.  Finally, close($lockfile) will usually not close
the file.  Use close( LOCK_FILE);

>possible typo:"i" at bnbform.cgi line 115
>
>113. sub decode_vars
>114.  {
>115.   $i=0;
>116.   read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
>117.   @pairs=split(/&/,$temp);
>118.   foreach $item(@pairs)
>119.    {
>120.     ($key,$content)=split(/=/,$item,2);
>121.     $content=~tr/+/ /;
>122.     $content=~s/%(..)/pack("c",hex($1))/ge;
>123.     $content=~s/\t/ /g;
>124.     $fields{$key}=$content;
>125.     if ($key eq "data_order")
>126.       {
>
>Use of uninitialized varible at bnbform.cgi line 116
>content-type: text/html
>
><h1>NO data_order list SPECIFIED!</h1>

This is a cgi script, right?  And you called it from the command
line, right?  Well, in that case you will need to provide suitable
data on STDIN for the program to work, plus (at least) setting
the environment variable CONTENT_LENGTH to the number of bytes
you provide.  Otherwise it's anybody's guess what's going wrong.

>can anyone clue a newbie in as to where to start
>
>the log file says bnbform.cgi failed for sf-xxx.sfo.com, reason:
>malformed header from script. Bad header=www... Recipient names must be

Ask on an html oriented newsgroup about that.

Anno


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

Date: Thu, 08 Jul 1999 03:04:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: throw me a bone here!........please
Message-Id: <czUg3.97$RX3.6530@nsw.nnrp.telstra.net>

In article <378400F6.B47F85C2@sixs.com>,
	{ R a N d i } <me@sixs.com> writes:
> hi there cant figure out what is wrong
> 
> i did the -w command and this is what i got
> possible typo:"LOCK_FILE" at bnbform.cgi line 306

No, it is not.

# perldoc perldiag
/possible typo
     Name "%s::%s" used only once: possible typo

That is the only occurrence of it. So you have not given us the full
error message.

> 305.    }
> 306.    open(LOCK_FILE, ">$lockfile");
> 307. }
> 308.
> 309. sub drop_the_lock
> 310. {
> 311.   close($lockfile);
> 312.   unlink($lockfile);

This bit of code suggests to me that you are doing something terribly
dangerous. Are you using some file to do some sort of process locking?
Do you have a flock call anywhere in your program? Why don't you check
the return value of open? or of any of the other system calls?

> can anyone clue a newbie in as to where to start

Get rid of this code, and use something less dangerous. Is this
something from Matt's script archive? It looks a bit like it.

If you must use it, enable -w, use strict, then change the code until
perl stops complaining. Add error checks to all of your system calls.
Read Randal Schwartz's column on programming for the Web to find out
how to really lock files. (He posts here regularly, get the URL from
his signature).

And _read_ the articles this group.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: Thu, 08 Jul 1999 02:18:37 GMT
From: Patrick Timmins <ptimmins@itd.sterling.com>
Subject: Re: Weird /x regexps
Message-Id: <7m11pl$uia$1@nnrp1.deja.com>

In article <3783E6AC.3FC8620B@email.com>,
  Jordan Hiller <hiller@email.com> wrote:

> Well, I found the problem, but it sure is strange. Apparently Perl
> didn't like me using brackets in my comments. But why would that be
> a problem? They're COMMENTS, to be IGNORED, aren't they?

Can you post the actual code with comments? I inserted [],(), and {}
scattered through out your code, and it compiled fine for me (Perl
5.005_02). And visually, the two regexes (regi?) are identical:

m/^([A-Z]{3,5})([+-]?\d{1,2}\:?\d{0,2})([a-z]{0,5})\s+(.*)$/i

m/^([A-Z]{3,5})               # comment
([+-]?\d{1,2}\:?\d{0,2})      # comment
([a-z]{0,5})  # comment
\s+   # comment
(.*)$/ix;     #comment

$monger{Omaha}[0]
Patrick Timmins
ptimmins@itd.sterling.com


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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 V9 Issue 72
************************************


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