[22740] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4961 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 9 06:05:51 2003

Date: Fri, 9 May 2003 03:05:07 -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           Fri, 9 May 2003     Volume: 10 Number: 4961

Today's topics:
    Re: Bloody Java Proselytisers!!! <denshimeiru-sapmctacher@durchnull.ath.cx>
    Re: Bloody Java Proselytisers!!! <fxn@hashref.com>
    Re: Bloody Java Proselytisers!!! <dodger@dodger.org>
    Re: Bloody Java Proselytisers!!! <REMOVEsdnCAPS@comcast.net>
    Re: Bloody Java Proselytisers!!! <REMOVEsdnCAPS@comcast.net>
    Re: Can't Create Text Files, Config problem (Mike)
    Re: Design Opinions - Dealing with Constants <ubl@schaffhausen.de>
    Re: Hash memory consumption (Anno Siegel)
    Re: Help: Need nifty idea for efficiently linking objec (entropy123)
    Re: How do you create a biniary file in Perl. <josef.moellers@fujitsu-siemens.com>
        How does Path of Windows converts to path in Linux whil (Vivek Dixit)
        How to find the size of a directory??? (Vinod. K)
    Re: How to find the size of a directory??? <jurgenex@hotmail.com>
    Re: How to find the size of a directory??? <ubl@schaffhausen.de>
        ignore first line of input file <kderaedt@hotmail.com>
    Re: ignore first line of input file <josef.moellers@fujitsu-siemens.com>
    Re: Logic(al nightmare!) (Tad McClellan)
    Re: Logic(al nightmare!) <sammie@greatergreen.com>
    Re: Logic(al nightmare!) <sammie@greatergreen.com>
    Re: Logic(al nightmare!) <sammie@greatergreen.com>
    Re: Logic(al nightmare!) <REMOVEsdnCAPS@comcast.net>
    Re: Perl LWP and the https protocol <mbudash@sonic.net>
    Re: Perl LWP and the https protocol (Helgi Briem)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 9 May 2003 04:43:47 GMT
From: Rudolf Polzer <denshimeiru-sapmctacher@durchnull.ath.cx>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <slrnbbmchf.nc8.denshimeiru-sapmctacher@message-id.durchnull.ath.cx>

Scripsit ille aut illa »Dodger« <dodger@dodger.org>:
> Why is it that every time I start on a project in Perl some dumbass has to 
> pipe up with why he thinks I should do it in Java instead?

Because he also wants to be able to use the code, I think... and because
he thinks Java is the only language which exists.

I can understand anyone disliking Perl. But until now I haven't found out
what's so good about Java. It's like a stripped-down C++ together with
a relatively big class library providing support for GUIs for example. So
why should one use Java instead of C++ if he doesn't need Java's big class
library? Or: if he can make use of C++'s templates to make his code more
generic?

There is no such thing as a best language. There aren't even better and
worse languages. There are just DIFFERENT languages. There are cases in
which one language seems to be better than another one (Java provides
platform-independent character encoding and GUI handling, Perl allows
doing much without writing much BUT IS SLOWER, while C++ is good at
applications using much I/O (same goes for C)).

> I'm working on a Perl module that reads in and parses CuriousLabs' Poser 
> documents and allows manipulation and creation of same.
> 
> It's a Perl module.
> 
> A PERL Module.
> 
> Yet when I posted about it on Renderosity.com (the Poser community's home, 
> pretty much) someone inevitably replied to my forum post with why Java 
> would, in his humble (cough) opinion, be a better approach.
> 
> YEAH. Java is always a better way to write PERL MODULES.

Write it as a C library instead and write interfaces from Perl to it
and from Java to it. Possible. But not too easy. It's probably more than
difficult to create the parse tree so that it can be accessed both from
Java and from Perl (I see a lot of #ifdefs) - but it's possible.

Once you have the library and the XS code for Perl, tell this "someone"
that you designed your library to be language-independent and that he
should write a JNI interface to it. If he really thinks the module is so
important to him, he'll do that.

> I love Perl. I love Perl programming. I love writing Perl code and figuring 
> out how to do things somene else said was hard or impossible.

That's the reason why I now mainly use Ruby. Instead of Perl, which I
mainly used before. Ruby is much cleaner, especially its syntax. But let's
see what Perl 6 will change there... maybe it will even be possible to
write a comment stripper, code reindenter and syntax highlighter which
will work in ALL cases... without knowing the used modules, of course.
Currently it's "only perl can parse Perl".


-- 
Wenn dir mal klar ist,
dass bei 3 Bit zwei Zahlen mehr sind als bei 2 Bit,
dann hast du mal was kapiert.
                                                [Hans Joss in de.sci.mathematik]


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

Date: Fri, 9 May 2003 06:20:10 +0000 (UTC)
From: Xavier Noria <fxn@hashref.com>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <b9fhaq$sve$1@news.ya.com>

In article <slrnbbmchf.nc8.denshimeiru-sapmctacher@message-id.durchnull.ath.cx>, Rudolf Polzer wrote:

: There is no such thing as a best language. There aren't even better and
: worse languages. There are just DIFFERENT languages. There are cases in
: which one language seems to be better than another one (Java provides
: platform-independent character encoding and GUI handling, Perl allows
: doing much without writing much BUT IS SLOWER

Slower? Than Java? I don't think that's true in general, for a convenient
definition of general. I think perl is damn fast at most things. 

To give some actual data, see for instance these charts

    http://advogato.org/person/fxn/diary.html?start=142
    
They correspond to an informal comparative I did a few months ago using the
Markov chain generator from The Practice of Programming.

-- fxn


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

Date: Fri, 09 May 2003 03:50:12 -0500
From: Dodger <dodger@dodger.org>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <Xns93761304D2F5dodgerdodgerorg@216.166.71.239>

Rudolf Polzer <denshimeiru-sapmctacher@durchnull.ath.cx> wrote in
news:slrnbbmchf.nc8.denshimeiru-sapmctacher@message-id.durchnull.ath.cx: 

> Scripsit ille aut illa »Dodger« <dodger@dodger.org>:

> Because he also wants to be able to use the code, I think... and
> because he thinks Java is the only language which exists.
> 
> I can understand anyone disliking Perl. But until now I haven't found
> out what's so good about Java. It's like a stripped-down C++ together
> with a relatively big class library providing support for GUIs for
> example. So why should one use Java instead of C++ if he doesn't need
> Java's big class library? Or: if he can make use of C++'s templates to
> make his code more generic?

Well, the parts I thought were funny were that he seemed to be taking the 
approach that Java was far superior because it's Object-oriented (okay, 
okay, Perl is technically not OO but it pretends well enough like it is to 
make the detail irrelevant in coding practice, if not in overhead), because 
Java is (his words) good at parsing strings, because Java has lots of 
classes available, and because Java is fastest to develop in.

It's like he took all the standard arguments in favour of Perl and reversed 
the wording or something.

Oh, yeah -- and he said that Perl's 'method of dealing with strings is 
weird.' Took me a bit to figure out what he was talking about there 
(especially since Java doesn't natively deal with strings at all, just 
bytearrays). I'm pretty convinced he had decided Perl was a bad thing 
because he didn't understand regexes.

> There is no such thing as a best language. There aren't even better and
> worse languages. There are just DIFFERENT languages. There are cases in
> which one language seems to be better than another one (Java provides
> platform-independent character encoding and GUI handling, Perl allows
> doing much without writing much BUT IS SLOWER, while C++ is good at
> applications using much I/O (same goes for C)).

Perl is slower with some things. Perl is pretty slow with hashes and 
structures, admittedly, compared to C and Java and even Python. On the 
other hand, Perl is really fast with some things, too.

Moreover, a program, module, or whatnot has less to do with the language 
used to build it than it has to do with a combination of the language and 
the programmer. I speak Perl. Pretty fluently, too. I can program a module 
in Perl to do this. C? Maybe not so much. Java? I'll take an iced latte 
with amaretto, please.

Also, there are best languages for specific applications -- or, rather, 
there are definite NOT-GOOD languages for some things. If anyone insists on 
disagreeing, I invite them to write a closure in Java. B^)

> Write it as a C library instead and write interfaces from Perl to it
> and from Java to it. Possible. But not too easy. It's probably more
> than difficult to create the parse tree so that it can be accessed both
> from Java and from Perl (I see a lot of #ifdefs) - but it's possible.
> 
> Once you have the library and the XS code for Perl, tell this "someone"
> that you designed your library to be language-independent and that he
> should write a JNI interface to it. If he really thinks the module is
> so important to him, he'll do that.

I had considered this option even before the absurdities started, but I 
don't have enough faith in my C/C++. I'm mostly a reader when it comes to 
C.

But, you know, the people have spoken. I should write it in Java and 
include it with Java::Inline or something, right? *Cough cough*

>> I love Perl. I love Perl programming. I love writing Perl code and
>> figuring out how to do things somene else said was hard or impossible.
> 
> That's the reason why I now mainly use Ruby. Instead of Perl, which I
> mainly used before. Ruby is much cleaner, especially its syntax. But
> let's see what Perl 6 will change there... maybe it will even be
> possible to write a comment stripper, code reindenter and syntax
> highlighter which will work in ALL cases... without knowing the used
> modules, of course. Currently it's "only perl can parse Perl".

I haven't tried ruby. To be completely honest, all I know about it is that 
the name is under the R section of the gvim syntax menu. B^(

I do know, though, that Perl has such a huge support community that I'd be 
very afraid to give that (including this) up. I'm not saying there can't be 
a Rubymongers group or anything, just that I've never heard of one.

-- 
Dodger


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

Date: Fri, 09 May 2003 04:47:58 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <Xns93763B0CC3024sdn.comcast@216.166.71.239>

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

Dodger <dodger@dodger.org> wrote in
news:Xns9375C791494DDdodgerdodgerorg@216.166.71.239: 

> Okay, social issue here...
> 
> Why is it that every time I start on a project in Perl some
dumbass
> has to pipe up with why he thinks I should do it in Java instead?

Perhaps he thinks that your project should run slowly and take longer
to develop?  :-)

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+u3lYY96i4h5M0egRAs5YAKDeSn+7fRYf+zEFdebFXtG0M0LIVgCdEoBf
98NZPCa4mR/K0To6XbBZ9lI=
=Zdqv
-----END PGP SIGNATURE-----


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

Date: Fri, 09 May 2003 04:51:40 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Bloody Java Proselytisers!!!
Message-Id: <Xns93763BADE2789sdn.comcast@216.166.71.239>

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

Xavier Noria <fxn@hashref.com> wrote in
news:b9fhaq$sve$1@news.ya.com:

> In article
>
<slrnbbmchf.nc8.denshimeiru-sapmctacher@message-id.durchnull.ath.cx>,
> Rudolf Polzer wrote: 
> 
>: There is no such thing as a best language. There aren't even
better
>: and worse languages. There are just DIFFERENT languages. There
are
>: cases in which one language seems to be better than another one
(Java
>: provides platform-independent character encoding and GUI
handling,
>: Perl allows doing much without writing much BUT IS SLOWER
> 
> Slower? Than Java? I don't think that's true in general, for a
> convenient definition of general. I think perl is damn fast at
most
> things. 

In general, Perl is usually relatively slow at most tasks.  But then,
I grew up programming in C, so YMMV.

However, I do think it remarkable that Java manages to out-slow Perl
for most tasks.  Or so I've heard.

Every now and then I start to learn Java, and I always have the same
reaction after a short while: "Why would I go to all this trouble??! 
It would be so much easier in Perl!"  It always seems like you have
to do an awful lot of typing in Java to get anything done.

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+u3o7Y96i4h5M0egRAvv5AKD1bBAC23E4ZRnwvES+3Urv0yj7iQCg27Si
gZXFMO8jWIG0oWDBbW8+YjY=
=1yyl
-----END PGP SIGNATURE-----


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

Date: 8 May 2003 23:23:18 -0700
From: csdude@hotmail.com (Mike)
Subject: Re: Can't Create Text Files, Config problem
Message-Id: <46cdc619.0305082223.43291ef@posting.google.com>

> Do a "ps -ef" on your linux box and you should find that the "owner"
> of the httpd processes is "nobody".  That's the account that needs the
> permissions your script requires.  And (not to harp) but the
> permissions you're close to letting anyone who can access your web
> server have.


Hey, thanks for all of the advice. With your help, we did get it
straightened out, it only took 9 weeks! :-)  The network admin said
that he set the permissions to world rwx, and now everything seems to
be working fine.

Just because future problem-havers might read this thread, I want to
point out that, since this is an introductory internet programming
class, we were simply creating text files in the cgi-bin for learning
purposes. Security isn't really an issue on that end, it was
technically a private server. But I tried creating files in other
directories, too, and before we changed the permissions, that didn't
work either.

Thanks again for the help!

Mike


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

Date: Fri, 09 May 2003 08:34:15 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Design Opinions - Dealing with Constants
Message-Id: <b9fla4$gmd$1@news.dtag.de>

Eric Schwartz wrote:
> Malte Ubl <ubl@schaffhausen.de> writes:
> 
>>this might be perlish:
>>
>>use Vars::From "config.pl";
>>
>>use Vars::From would then evaluate config.pl in a unique namespace and
>>import all symbols to the current one.
> 
> 
> Now that's nifty!  I'll have to look that one up.

Oh, I just made it up. Could write it though. But I guess there should 
be something similar on CPAN.

malte



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

Date: 9 May 2003 09:50:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hash memory consumption
Message-Id: <b9ftm1$mev$1@mamenchi.zrz.TU-Berlin.DE>

Mike Hunter  <mhunter@uclink.berkeley.edu> wrote in comp.lang.perl.misc:

[...]

> Off topic:  Is there a good way to get += for a vector using map or some
> other perl magic?

You mean adding corresponding components?  If you want the modifying
action of "+=", map() isn't the right choice because it generates a
new list while you want to modify an existing one.

Processing two (or more) lists in parallel is something Perl is not
particularly good at.  The most straightforward solution uses indices:

    my @x = qw( 1 2 3);
    my @y = qw( 5 4 3);

    $x[ $_] += $y[ $_] for 0 .. $#x;

If you want to be "perlish" and use list operations, you'll need a
copy of the @y array you can destroy:

    my @aux = @y;
    $_ += shift @aux for @x;

Anno


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

Date: 8 May 2003 21:19:50 -0700
From: email_entropy123@yahoo.com (entropy123)
Subject: Re: Help: Need nifty idea for efficiently linking objects together and making comparisons,,,
Message-Id: <90cdce37.0305082019.74eca202@posting.google.com>

> 
> I haven't tested this, but it should work.
> 
> Regards,
> 
> Garry

Garry,

At the very least a promising start, I was stuck in lab all day but
I'll give the code a shot tomorrow. Thanks!

entropy


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

Date: Fri, 09 May 2003 08:33:46 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: How do you create a biniary file in Perl.
Message-Id: <3EBB4BCA.62C7502@fujitsu-siemens.com>

Bart Lateur wrote:
> =

> Michael Carman wrote:
> =

> >Hmm. I would expect \r to be reliable, yet perlport claims that it's a=

> >LF on Mac. Is there anyone with a Mac able to confirm or refute this?
> =

> Yup.
> =

> The thing is: the character (combination) for line ends, is chr(13), on=
,
> the Mac. Matthias Neeracher, who originally ported perl to MAcPerl,
> decided to represent this with "\n", thus "\n" eq chr(13).
> =

> Would it make sense to make "\r" equal to chr(13) as well? Not really..=
=2E
> So in the end, the physical meaning of "\r" and "\n" got reversed, but
> not its logical value: "\n" is logical line end, "\r" is "the other
> one".

That's exactly what the camel book says.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: 9 May 2003 00:27:53 -0700
From: dixit.vivek@indiatimes.com (Vivek Dixit)
Subject: How does Path of Windows converts to path in Linux while attaching a file
Message-Id: <cadf3789.0305082327.11882ae8@posting.google.com>

I have got TWiki server running on a linux m/c. I m attaching my file
in windows client machine for the twiki server.

I m using html web page to send information about the filepath from my
browser to the Linux server. Perl scripts are responsible for all the
rendering. How does my Path which is like

c:\dir\dir2\filename

gets converted to the Linux path
and secondly, Is there anything like

$query->tmpFilename ( $filepath );

where $query is the CGI query object.

filepath is c:\dir\dir2\filename

Anybody conversant with TWiki can appreciate this thing.


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

Date: 8 May 2003 22:43:11 -0700
From: pkvinu@indiatimes.com (Vinod. K)
Subject: How to find the size of a directory???
Message-Id: <bde4ceed.0305082143.39dd5ea6@posting.google.com>

Hello All,

I am stuck up with a problem. As i said above in the subject, I want
to know is there any module/operators to find out the size of a
directory????

Please help me, I just started learning perl recently.

Your earliest reply will be well appreciated.

Thanks,
- Vinod.


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

Date: Fri, 09 May 2003 06:09:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to find the size of a directory???
Message-Id: <wCHua.1313$0K4.876@nwrddc03.gnilink.net>

Vinod. K wrote:

> I am stuck up with a problem. As i said above in the subject, I want
> to know is there any module/operators to find out the size of a
> directory????

Not quite clear what you really want.

Taking your question literally ("size of the directory") then just
    print -s 'directoryname';
Details see 'perldoc -f -X'.
However typically this will be just a few KB because the filenames and inode
number don't take up much space.

Or do you mean the size of all files in that directory?
Then have a look at opendir() and readdir() to get the names of all files in
the directory and then just sum up their sizes using -s.

Or do you mean the size of all files in this directory and recursively all
sub directories? Then have a look at File::Find. In the wanted() function
just add the size of each file (from -s) in a global variable.

jue





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

Date: Fri, 09 May 2003 10:11:36 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: How to find the size of a directory???
Message-Id: <b9fr0l$lqt$1@news.dtag.de>

Jürgen Exner wrote:
> Or do you mean the size of all files in this directory and recursively all
> sub directories? Then have a look at File::Find. In the wanted() function
> just add the size of each file (from -s) in a global variable.

Or better yet, a lexical variable with its scope outsite the wanted closure.



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

Date: Fri, 9 May 2003 10:52:00 +0200
From: "kderaedt" <kderaedt@hotmail.com>
Subject: ignore first line of input file
Message-Id: <3ebb6c31$0$26726$ba620e4c@reader1.news.skynet.be>

Hi,

    This is probably a dummy question.  What is the easiest way to ignore
the first line of a input file.
Used code:
# Global configuration parameters
my $INPUTFILE = "wsp.out";
my $OUTPUTFILE = "wsp.new";
my $MSISDN_START = 2;

# File handeling
open (IN, "< $INPUTFILE") or die "Couldn't open $INPUTFILE for reading:
$!\n";
open (OUT, "> $OUTPUTFILE") or die "Couldn't open $OUTPUTFILE for writing:
$!\n";

while(<IN>) {

}

The first line contains data that I not need.

Thanks

Karel




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

Date: Fri, 09 May 2003 11:03:40 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: ignore first line of input file
Message-Id: <3EBB6EEC.F6F0D891@fujitsu-siemens.com>

kderaedt wrote:
> =

> Hi,
> =

>     This is probably a dummy question.  What is the easiest way to igno=
re
> the first line of a input file.
> Used code:
> # Global configuration parameters
> my $INPUTFILE =3D "wsp.out";
> my $OUTPUTFILE =3D "wsp.new";
> my $MSISDN_START =3D 2;
> =

> # File handeling
> open (IN, "< $INPUTFILE") or die "Couldn't open $INPUTFILE for reading:=

> $!\n";
> open (OUT, "> $OUTPUTFILE") or die "Couldn't open $OUTPUTFILE for writi=
ng:
> $!\n";
> =

> while(<IN>) {
> =

> }
> =

> The first line contains data that I not need.

Just read it:

<IN>;

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Fri, 9 May 2003 00:07:38 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Logic(al nightmare!)
Message-Id: <slrnbbmdsq.1rf.tadmc@magna.augustmail.com>

Brad Walton <sammie@greatergreen.com> wrote:

> I have a logic issue, and I am fairly new to perl, so the use of FOR,
> FOREACH, 


There is no FOR nor FOREACH in Perl.

"for" and "foreach" are synonyms in Perl, either can be used
in place of the other.

Which I find altogether too confusing, so I (nearly) always use
"foreach" for the "walk across a list" one, and "for" for the
three-part C-like one.


> WHILE are still in my learning stages. 


>  tie @DB, 'Tie::File', $dormantstatdb or "cannot open $dormantstatdb: $!
                                        ^^^^
                                        ^^^^

Is this your real code?


>  for (@DB) {


I'd instead write:

   foreach (@DB) {

which will put each _element_ of @DB into $_ in turn.


>   my ($type,$name,@rest) = split /\t/, $DB[$n];
                                         ^^^^^^^

No need to maintain your own counter, the value you want is
already in $_

   my ($type,$name,@rest) = split /\t/, $_;


You seldom need to do explicit indexing in Perl.

If you catch yourself doing your own indexing, pause and think
about if you really _have_ to or not. 


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 09 May 2003 05:43:43 GMT
From: "Brad Walton" <sammie@greatergreen.com>
Subject: Re: Logic(al nightmare!)
Message-Id: <jeHua.541841$Zo.115854@sccrnsc03>

Yeah, I know the variable for the DB is looong, but it will make sense to me
later. Anyway, I have been working at this all evening, and came up with a
new approach:

sub file_stats_left {
 tie @DB, 'Tie::File', $dormantstatdb or "cannot open $dormantstatdb: $!
\n";
 for (@DB) {
  my ($type,$name,@rest) = split /\t/, $_;
  foreach $discpl (@discpl) {
   if ($discpl eq $name) {
    foreach $oldsession (@oldsession) {
     if ($oldsession =~ /$name/) {
      $_ = $oldsession;
     }
    $discpl{$name} = true;
    }
   }
  }
  foreach $discpl (@discpl) {
   if ($discpl eq $name) {
    if(!$discpl{$name}) {
     foreach $oldsession (@oldsession) {
      if ($oldsession =~ /$name/) {
       push @DB, $oldsession;
      }
     }

    }
   }
  }
 }
 untie @DB;
}

The first half (replacing info) is working, now I am trying to find out why
it doesnt add new info (if $name doesn't already exist in the DB). I'll keep
at it, but if you see anything wrong there let me know.

Thanks for your help!
Brad




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

Date: Fri, 09 May 2003 05:45:41 GMT
From: "Brad Walton" <sammie@greatergreen.com>
Subject: Re: Logic(al nightmare!)
Message-Id: <9gHua.779705$3D1.428273@sccrnsc01>

I see one problem already. This is wrong:

>    if ($discpl eq $name) {

Will fix...

Brad




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

Date: Fri, 09 May 2003 06:42:20 GMT
From: "Brad Walton" <sammie@greatergreen.com>
Subject: Re: Logic(al nightmare!)
Message-Id: <g5Iua.785116$L1.220949@sccrnsc02>

I solved the problem. Was tough for me, and just in case anyone else comes
across this issue I will post how I solved it.

The premise: You have 3 arrays (one in a file) and need to either replace
information, or write new information, to the file (depending on whether it
exists already). @discpl represents the changes 'keys' to the other arrays.
This method requires Tie::File module:

sub file_stats_left {
 tie @DB, 'Tie::File', $dormantstatdb or "cannot open $dormantstatdb: $!
\n";
 for (@DB) {
  ($type,$name,@rest) = split /\t/, $_;
  foreach $discpl (@discpl) {
   if ($discpl eq $name) {
    foreach $oldsession (@oldsession) {
     if ($oldsession =~ /$name/) {
      $_ = $oldsession;
     }
    }
   $added{$discpl} = 1;
   }
  }
 }

 foreach $discpl (@discpl) {
  if (!$added{$discpl}) {
   foreach $oldsession (@oldsession) {
    if ($oldsession =~ /$discpl/) {
     push @DB, $oldsession;
    }
   }
  }
 }

 untie @DB;
}

Hope that helps someone,
Brad


"Brad Walton" <sammie@greatergreen.com> wrote in message
news:9gHua.779705$3D1.428273@sccrnsc01...
> I see one problem already. This is wrong:
>
> >    if ($discpl eq $name) {
>
> Will fix...
>
> Brad
>
>




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

Date: Fri, 09 May 2003 04:55:05 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Logic(al nightmare!)
Message-Id: <Xns93763C421DF76sdn.comcast@216.166.71.239>

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

"Brad Walton" <sammie@greatergreen.com> wrote in
news:jeHua.541841$Zo.115854@sccrnsc03: 

> Yeah, I know the variable for the DB is looong, but it will make
sense
> to me later. Anyway, I have been working at this all evening, and
came
> up with a new approach:
> 
> sub file_stats_left {
>  tie @DB, 'Tie::File', $dormantstatdb or "cannot open
$dormantstatdb:
>  $! 

Tad was not referring to the long variable name.  Long variable names
are often a good thing.  Tad was referring to the fact that the
right-side of your "or" expression is ... just a string.  Perhaps you
meant to "die" there?  Perhaps instead of copying/pasting your real
code, you re-typed it?

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+u3sFY96i4h5M0egRAiOAAJ41xnzadK0XRqmhmB5IMDRQj9FeMQCg6YVB
p4Il2MRRGOMdR+VFNZl4kJk=
=cT3Y
-----END PGP SIGNATURE-----


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

Date: Fri, 09 May 2003 06:46:30 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Perl LWP and the https protocol
Message-Id: <mbudash-8D1CE8.23463108052003@typhoon.sonic.net>

In article <rkCua.62303$ey1.5562304@newsread1.prod.itd.earthlink.net>,
 "BSK" <mooncm.lbkejwiAhEgSfSe@dAcEbSaS> wrote:

> "Mothra" <mothra@nowhereatall.com> wrote in message
> news:3eba9e1c$1@usenet.ugs.com...
> >
> > "BSK" <mooncm.lbkejwiAhEgSfSe@dAcEbSaS> wrote in message
> > news:0Twua.61843$ey1.5526131@newsread1.prod.itd.earthlink.net...
> > > Hello All,
> > >
> > > Does anyone know if there are secure https versions of the LWP GET and
> > POST
> > > functions available anywhere?
> > >
> > > Much thanks for your help.
> > >
> > >
> > > BSK
> > You need to take a look at the lwpcook document. Basically,
> > you need the crypt-SSleay module to get the functionality you
> > are looking for.
> >
> 
> Do you have a pointer to the lwpcook document?  Sounds interesting.
> 

PMFJI, it comes with the libwww-perl distro. here's another place:

   http://www.perldoc.com/perl5.6/lib/lwpcook.html

you'll also need to see the README.SSL that comes with the distro. 
here's a copy of it:

---------------------------------------------------------------------
SSL SUPPORT
-----------

The libwww-perl package has support for using SSL/TLSv1 with its HTTP
client and server classes. This support makes it possible to access
https schemed URLs with LWP. Because of the problematic status of
encryption software in general and certain encryption algorithms in
particular, in several countries, libwww-perl package doesn't include
SSL functionality out-of-the-box.

Encryption support is obtained through the use of Crypt::SSLeay or
IO::Socket::SSL, which can both be found from CPAN. While libwww-perl
has "plug-and-play" support for both of these modules (as of v5.45),
the recommended module to use is Crypt::SSLeay. In addition to
bringing SSL support to the LWP package, IO::Socket::SSL can be used
as an object oriented interface to SSL encrypted network sockets.

There is yet another SSL interface for perl called Net::SSLeay. It has
a more complete SSL interface and can be used for web client
programming among other things but doesn't directly support LWP.

The underlying SSL support in all of these modules is based on OpenSSL
<http://www.openssl.org/> (formerly SSLeay). For WWW-server side SSL
support (e.g. CGI/FCGI scripts) in Apache see <http://www.modssl.org/>.
---------------------------------------------------------------------

notice that you need openssl as well... this is all easily doable. i 
even managed to install it all as an unpriviledged (non-root) user in 
user directories on one site - worked fine.

hth-

-- 
Michael Budash


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

Date: Fri, 09 May 2003 09:56:46 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Perl LWP and the https protocol
Message-Id: <3ebb79ff.2487580491@news.cis.dfn.de>

On Fri, 09 May 2003 00:08:55 GMT, "BSK"
<mooncm.lbkejwiAhEgSfSe@dAcEbSaS> wrote:

First, don't top-post.  It seriously annoys the regulars
and severely reduces your chances of receiving 
useful answers to your questions.

If you don't know what top-posting is, read:
http://jargon.watson-net.com/jargon.asp?w=top%2Dpost

For details on how to post to comp.lang.perl.misc
read the Posting Guidelines posted here twice a
week, also available at:

http://mail.augustmail.com/~tadmc/clpmisc.shtml

For more information about netiquette in general, see the
"Netiquette Guidelines" at:

http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

>Do you have a pointer to the lwpcook document?  Sounds interesting.

It's on the hard disk of every computer with a recent
installation of Perl.

Read it by opening a command line box and typing

perldoc lwpcook

 ....just as you would read the myriad of other useful
documents that come with your Perl distribution.

Try the following for details:

perldoc perl 
perldoc perldoc
perldoc perltoc

Other useful perldoc commands are:

perldoc -f FUNCTION_NAME
perldoc -q FAQ_KEYWORD
-- 
Regards, Helgi Briem
helgi DOT briem AT decode DOT is


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 4961
***************************************


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