[15581] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2994 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 9 18:10:54 2000

Date: Tue, 9 May 2000 15:10:39 -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: <957910236-v9-i2994@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 May 2000     Volume: 9 Number: 2994

Today's topics:
    Re: CGI Wrap <tigertom@NOSPAMusa.net>
    Re: CGI.pm <nospam@devnull.com>
    Re: CGI.pm <uri@sysarch.com>
    Re: CGI.pm <lr@hpl.hp.com>
    Re: CGI.pm <nospam@devnull.com>
        Clueless NEWBIE help: Can't find error in code. <tigertom@NOSPAMusa.net>
    Re: converting input to <p></p> pairs via perl <uri@sysarch.com>
    Re: converting input to <p></p> pairs via perl <nospam@devnull.com>
    Re: Converting Macintosh files to UNIX (Abigail)
    Re: Converting Macintosh files to UNIX <lr@hpl.hp.com>
    Re: Converting Macintosh files to UNIX (Bart Lateur)
    Re: Cookie <kavani@volny.cz>
        Crypt::Twofish error <thomas2@dalnet.se>
    Re: Dynamically generate eXcel spreadsheet wjair@my-deja.com
    Re: efficiency with data separation. [was Re: HTTP::Req <nospam@devnull.com>
        Help Needed  - Perl Matching Operator <k2_1999@hotmail.com>
        Help with Perl and Mysql DBI/DBD Programming?????? gary.lefko@usafa.af.mil
    Re: Help with Perl and Mysql DBI/DBD Programming?????? <jeff@vpservices.com>
        host checking <steve@swsystem.yorks.com>
    Re: How to include lines beginning and ending with a st c_neak@my-deja.com
    Re: How to include/exclude lines ? c_neak@my-deja.com
    Re: How to tell if <> operator will work on a given sca <iltzu@sci.invalid>
    Re: How to tell if <> operator will work on a given sca (Ilya Zakharevich)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 09 May 2000 22:06:05 +0100
From: tigertom <tigertom@NOSPAMusa.net>
Subject: Re: CGI Wrap
Message-Id: <39187DBD.85B35BCB@NOSPAMusa.net>

Well, on a web-host I used, instead of calling the script with:

/cgi-bin/scriptname.cgi

you had to call it with:

/cgi-bin/cgiwrap/username/scriptname.cgi


TigerTom


Peter Hill wrote:

> John Alexander Kushiner wrote:
> >
> > Hello all,
> >
> > I recently put a CGI-BIN in and was informed by my ISP that in order for me
> > to run Perl scripts I would need to use something called CGI wrap. The
> > information I found was at a unix help site. However, when I downloaded the
> > necessary files I wasn;t any better off. Can someone who has had experience
> > with CGI wrap give me a heads up about what I am supposed to expect with
> > this? I'm not sure what I am even supposed to do with it! I apprecite
> > anything in advance.
> >
> > John
> You would get a better answer to this question at
> comp.infosystems.www.authoring.cgi
> where the cgi experts live.
> hth
> --
> Peter Hill,
> Modulus Pty. Ltd.,
> http://www.modulus.com.au/



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

Date: 9 May 2000 18:27:07 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: CGI.pm
Message-Id: <8f9l9r$4a4$0@216.155.32.13>

In article <MPG.1381e9a488836c698aa2b@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:

 | In article <8f76qj$2v7$1@orpheus.gellyfish.com> on 8 May 2000 21:07:47 
 | +0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
 | > On Mon, 08 May 2000 18:31:13 GMT Jason Malone wrote:
 | 
 | ...
 | 
 | > > $FORM{var1} == "value1"
 | > > $FORM{var2} == "value2"
 | > > $FORM{var3} == "value3"
 | > 
 | > I havent the faintest idea why you would want to do this but you can 
 | > do:
 | > 
 | >   use CGI qw(:standard);
 | > 
 | >   my %FORM;
 | > 
 | >   $FORM{$_} = param($_) foreach (param());
 | > 
 | > But unless you have some compelling reason to do this you might as 
 | > well
 | > do :
 | > 
 | >    param('var1');
 | > 
 | > whenever you need that value.
 |   ^^^^^^^^
 | 
 | Don't Perl's relatively slow method invocations count for something?
 | 
 | The following might well be the most efficient way of capturing the 
 | parameters en masse into a hash for later, fast retrieval:
 | 
 |     my @params = param;
 |     @FORM{@params} = map param($_) => @params;


guess my newbie head is cropping up again, but why isn't that 
%FORM(@params) if it's a hash?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 09 May 2000 19:05:22 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: CGI.pm
Message-Id: <x74s87v91q.fsf@home.sysarch.com>

>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:

  TW> In article <MPG.1381e9a488836c698aa2b@nntp.hpl.hp.com>, Larry Rosler 
  TW> <lr@hpl.hp.com> wrote:

  TW>  |     @FORM{@params} = map param($_) => @params;


  TW> guess my newbie head is cropping up again, but why isn't that 
  TW> %FORM(@params) if it's a hash?

because it is a slice of a hash and not a hash. so you need the @ to
convey a list context on the expression so it can take a list of keys
and be assigned a list of values. for more, read my hash slice tutorial
at:

http://www.sysarch.com/perl/tutorials/hash_slices.txt

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 9 May 2000 12:10:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: CGI.pm
Message-Id: <MPG.13820285a534ae1198aa33@nntp.hpl.hp.com>

In article <8f9l9r$4a4$0@216.155.32.13> on 9 May 2000 18:27:07 GMT, The 
WebDragon <nospam@devnull.com> says...
> In article <MPG.1381e9a488836c698aa2b@nntp.hpl.hp.com>, Larry Rosler 
> <lr@hpl.hp.com> wrote:

 ...

>  |     my @params = param;
>  |     @FORM{@params} = map param($_) => @params;
> 
> 
> guess my newbie head is cropping up again, but why isn't that 
> %FORM(@params) if it's a hash?

It is a hash slice, which is a list (hence the @ prefix) formed from a 
hash (hence the {} delimiters).

Hash slices are neat, and significantly faster than loops with 
individual element accesses.  Uri Guttman has an excellent tutorial.  
Start from <URL:http://www.sysarch.com/>.

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


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

Date: 9 May 2000 20:06:35 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: CGI.pm
Message-Id: <8f9r4b$ihf$0@216.155.32.13>

In article <MPG.13820285a534ae1198aa33@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:

 | In article <8f9l9r$4a4$0@216.155.32.13> on 9 May 2000 18:27:07 GMT, The 
 | WebDragon <nospam@devnull.com> says...
 | > In article <MPG.1381e9a488836c698aa2b@nntp.hpl.hp.com>, Larry Rosler 
 | > <lr@hpl.hp.com> wrote:
 | 
 | ...
 | 
 | >  |     my @params = param;
 | >  |     @FORM{@params} = map param($_) => @params;
 | > 
 | > 
 | > guess my newbie head is cropping up again, but why isn't that 
 | > %FORM(@params) if it's a hash?
 | 
 | It is a hash slice, which is a list (hence the @ prefix) formed from a 
 | hash (hence the {} delimiters).
 | 
 | Hash slices are neat, and significantly faster than loops with 
 | individual element accesses.  Uri Guttman has an excellent tutorial.  
 | Start from <URL:http://www.sysarch.com/>.

heh, sounds neat. I'll do that.. might help me out with what I'm doing 
over here with a loop (I'm still stuck on the regexp's but if I stay 
that way I'll post here for more assistance.)

Thanks for the help!

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 09 May 2000 21:52:24 +0100
From: tigertom <tigertom@NOSPAMusa.net>
Subject: Clueless NEWBIE help: Can't find error in code.
Message-Id: <39187A88.BC7F84CC@NOSPAMusa.net>

I've posted the problem subroutine at
http://www.tigertom.com/mailout.txt, in case it
doesn't come out right here.

It's a sub-routine to mail all subscribers on a mailing list.  I imagine

I probably shouldn't use Perl and sendmail to do this, but I'd like
to make the thing *work* before I discard it, and/or find out what's
wrong.

This sub-routine executes successfully (it sends out the emails ok), and

then crashes (500 server error).  The only other subroutine executed is
a read-parse one, so I don't think it's another part of the script
that's doing it.  Can anyone
give me some clues?  I don't have my own server, so I can't check the
error logs.

TigerTom
tigertomNOSPAM@usa.net



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

Date: Tue, 09 May 2000 18:56:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: converting input to <p></p> pairs via perl
Message-Id: <x77ld3v9gu.fsf@home.sysarch.com>

>>>>> "TW" == The WebDragon <nospam@devnull.com> writes:


  TW> $reviewText = param('reviewtext');
  TW> $reviewText =~ s!\r\n?!\n!g;
  TW> $reviewText =~ s!\n!<br>\n!g;
  TW> $reviewText =~ s!(<br>\n){2,}!</p>\n\n<p>!g;
  TW> $reviewBody = "<p>$reviewText";

that isn't close at all. the one i partially fixed was closer. this code
seems to be just what you asked for and was only a minor tweak of
gellyfish's idea.

#!/usr/local/bin/perl

$text = <<'EOM';
Enter your comments separated by double-returns like normal paragraphs.\n
\n
If you want lines to break\n
like this, then enter it that way.\n
\n
The parser will automatically produce the correct paragraph and 
linebreak tags so please DO NOT enter them on your own... they'll get 
removed =)\n
\n
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam 
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat 
volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation 
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse 
molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero 
eros et accumsan et iusto odio dignissim qui blandit praesent luptatum 
zzril delenit augue duis dolore te feugait nulla facilisi.\n
EOM

# these 2 lines simulate the form input data. real newlines are not
# there and the \n strings are converted to newlines

$text =~ tr/\n//d;
$text =~ s/\\n/\n/g ;

print $text ;


$review_body = join '', map { s/\n/<BR>\n/g ;
			      "<P>$_</P>\n\n" } split /\n\n/, $text ;

print $review_body ;

OUTPUT:

Enter your comments separated by double-returns like normal paragraphs.

If you want lines to break
like this, then enter it that way.

The parser will automatically produce the correct paragraph and linebreak tags so please DO NOT enter them on your own... they'll get removed =)

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
<P>Enter your comments separated by double-returns like normal paragraphs.</P>

<P>If you want lines to break<BR>
like this, then enter it that way.</P>

<P>The parser will automatically produce the correct paragraph and linebreak tags so please DO NOT enter them on your own... they'll get removed =)</P>

<P>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.<BR>
</P>


looks correct (if not wrapped well :-) to me.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 9 May 2000 19:38:45 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: converting input to <p></p> pairs via perl
Message-Id: <8f9pg5$eqv$0@216.155.32.13>

In article <x77ld3v9gu.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 | >>>>> "TW" == The WebDragon <nospam@devnull.com> writes:
 | 
 | 
 |   TW> $reviewText = param('reviewtext');
 |   TW> $reviewText =~ s!\r\n?!\n!g;
 |   TW> $reviewText =~ s!\n!<br>\n!g;
 |   TW> $reviewText =~ s!(<br>\n){2,}!</p>\n\n<p>!g;
 |   TW> $reviewBody = "<p>$reviewText";
 | 
 | that isn't close at all. the one i partially fixed was closer. this code

dunno.. it works :) (mostly) 

 | seems to be just what you asked for and was only a minor tweak of
 | gellyfish's idea.

I'll have to compare them -- I've saved all the failed and partially 
successful attempts in comments, so I could peruse them later. :) 

edited to work in my script: 

 | $reviewText =~ tr/\n//d;
 | $reviewText =~ s/\\n/\n/g ;
 | $reviewBody = join '', map { s/\n/<BR>\n/g ;
 | 			      "<P>$_</P>\n\n" } split /\n\n/, $reviewText ;

 | looks correct (if not wrapped well :-) to me.

now let's test it ... be right back ;) 

hum.. it all comes through in one massive block of text, not broken up 
at all. :\

as I learn more about regexp's I have to question this : 

tr/\n//d;

doesn't that simply take ALL the newlines and turn them into '' ? =:o

I'll be happy to mail you the cgi script so that you can play with it, 
if you think that would help any.. 

(it's a little large to post here)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 9 May 2000 20:37:46 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <slrn8hgtoq.efl.abigail@ucan.foad.org>

On Tue, 25 Apr 2000 13:34:29 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ 
++ This has the virtue of doing what you want when running on the Mac also, 
++ because there the values of "\n" and "\r" are interchanged.  But you 
++ might do something amusing like this, which would work on either 
++ machine:
++ 
++     tr/\r\n/\n\r/
++ 
++ The s///g approach can't do that without considerable complication.
++ 
++     s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg

       %& = ("\n", "\r", "\r", "\n");
       s/[\r\n]/$&{$&}/g;



Abigail


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

Date: Tue, 9 May 2000 14:12:52 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <MPG.13821f307231515598aa3b@nntp.hpl.hp.com>

In article <slrn8hgtoq.efl.abigail@ucan.foad.org> on 9 May 2000 20:37:46 
GMT, Abigail <abigail@foad.org> says...
> On Tue, 25 Apr 2000 13:34:29 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> ++ 
> ++ This has the virtue of doing what you want when running on the Mac also, 
> ++ because there the values of "\n" and "\r" are interchanged.  But you 
> ++ might do something amusing like this, which would work on either 
> ++ machine:
> ++ 
> ++     tr/\r\n/\n\r/
> ++ 
> ++ The s///g approach can't do that without considerable complication.
> ++ 
> ++     s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg
> 
>        %& = ("\n", "\r", "\r", "\n");
>        s/[\r\n]/$&{$&}/g;

Sure.  And table lookup scales better if there are more than two 
alternatives.  But I don't see any need for it in this simple binary 
choice.

Well, I haven't posted a Benchmark in a long time, so here goes.


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

$a = "xyz\rabc\n" x 10;
%& = ("\n", "\r", "\r", "\n");

timethese(1 << (shift || 0), {
  Expr0 => '(my $x = $a) =~ s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg',
  Expr1 => '(my $x = $a) =~ s/[\r\n]/$& eq "\r" ? "\n" : "\r"/eg',
  Hash0 => '(my $x = $a) =~ s/([\r\n])/$&{$1}/g',
  Hash1 => '(my $x = $a) =~ s/[\r\n]/$&{$&}/g',
  Hash2 => 'my %h = ("\n", "\r", "\r", "\n");
            (my $x = $a) =~ s/([\r\n])/$h{$1}/g',
  Hash3 => 'my %h = ("\n", "\r", "\r", "\n");
            (my $x = $a) =~ s/[\r\n]/$h{$&}/g',
});
__END__


Name "main::a" used only once: possible typo at e:\Test\b3.txt line 5.
Benchmark: timing 16384 iterations of Expr0, Expr1, Hash0, Hash1, Hash2, 
Hash3...
     Expr0:  3 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
4661.17/s (n=16384)
     Expr1:  4 wallclock secs ( 3.22 usr +  0.00 sys =  3.22 CPU) @ 
5089.78/s (n=16384)
     Hash0:  3 wallclock secs ( 3.81 usr +  0.00 sys =  3.81 CPU) @ 
4296.88/s (n=16384)
     Hash1:  2 wallclock secs ( 3.52 usr +  0.00 sys =  3.52 CPU) @ 
4661.17/s (n=16384)
     Hash2:  4 wallclock secs ( 3.94 usr +  0.00 sys =  3.94 CPU) @ 
4161.54/s (n=16384)
     Hash3:  4 wallclock secs ( 3.64 usr +  0.00 sys =  3.64 CPU) @ 
4499.86/s (n=16384)


The performances are slightly in favor of the expression, even when the 
small penalty of setting up the hash is amortized out of the lookup.  
The potential penalty on $& on the rest of the program isn't considered.  
(Is it still there in Perl 5.6.0?)

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


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

Date: Tue, 09 May 2000 21:25:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <391e7ebf.44508144@news.skynet.be>

Abigail wrote:

>Larry Rosler <lr@hpl.hp.com> wrote:
>
>++     tr/\r\n/\n\r/
>++ 
>++ The s///g approach can't do that without considerable complication.
>++ 
>++     s/([\r\n])/$1 eq "\r" ? "\n" : "\r"/eg
>
>       %& = ("\n", "\r", "\r", "\n");
>       s/[\r\n]/$&{$&}/g;

    s/([\r\n])/$1 ^ "\r" ^ "\n"/ge;

You may replace '"\r" ^ "\n"' with '"\07"' if you like, but it's not as
clear.

-- 
	Bart.


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

Date: Tue, 9 May 2000 21:09:08 +0200
From: "Jan Kavan" <kavani@volny.cz>
Subject: Re: Cookie
Message-Id: <8f9nnc$l4e$1@news.vol.cz>


justin baugh <baughj@rpi.edu> wrote in message
news:39183A00.FEF40D61@rpi.edu...
> Chello wrote:
> >
> > Hi all,
> >
> > First Question:
> >
> > I'm looking to write a cookie with that code:
> >
> > #!/usr/bin/perl -w
> >
> > use CGI;
> >
> > $q = new CGI;
> >
> >
$cookie=$q->cookie(-name=>'moonkey_exchange',-value=>$cook_value,-expires=>'
> > +1y');
> >
> > print $q->header(-cookie=>$cookie);
> >
>
> Does IE or Netscape fail with this?  I had a similar problem where IE
> wouldn't grab the cookie to save its life (still have it, actually).
> Here's my code.  This works fine under Netscape but not under IE
> (I'm not exactly sure why.  Does anyone know why this would occur?)
>
>     # generate session ID
>     $session_id = join("", @chars[map{rand @chars} (1 .. 16) ]);
>     my $cookie_value = $session_id . ":" . $author_id;
>
>     my $cookie = cookie (-name    => "session-id",
>            -value   => $cookie_value,
>          -expires => "+1y");
>     print header(-cookie => $cookie);
>
> BTW you don't need to make a new CGI object (iirc).
>
> ~j
>
> --
> ==================================================
> Justin Baugh (baughj@nocannedmeat.rpi.edu)
> PGP: http://www.rpi.edu/~baughj/keys.txt
> "Evil is easy, and has infinite forms." - Pascal

Problem is, as I am told that these are called permanent cookies and they
works
only under Netscape. So if U want to use cookies, U have to write your own
cookie server, which is not so difficult to make.

Sincerelly Jan Kavan
kavanovi@atlas.cz





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

Date: Tue, 09 May 2000 21:12:37 GMT
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: Crypt::Twofish error
Message-Id: <9b%R4.13$kt.7167@dummy.bahnhof.se>

My plan was to use Twofish encryption on the communication between a
client and a server.

Q1: Is anything wrong with the following code?

use Crypt::Twofish;

my  $string = "BLAM";

my  $key = "akei93dA1039Weh2132313";

my  $ciphertext;
my  $decryptedtext;

print "[Uncoded: $string]\n\n";

$ciphertext = Encipher($key,length($key),$string);

print "[Encoded: $ciphertext]\n\n";

$decryptedtext = Decipher($key,length($key),$ciphertext,length($string));

print "[Decoded: $decryptedtext]\n\n";

It works just fine on a Solaris2.6 system.
But on my RedHat6.1 system it gives me a Segmentation fault(out of memory).

Q2: Any known problems with Crypt::Twofish or is my implementation above
wrong??




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

Date: Tue, 09 May 2000 18:57:02 GMT
From: wjair@my-deja.com
Subject: Re: Dynamically generate eXcel spreadsheet
Message-Id: <8f9n1l$om1$1@nnrp1.deja.com>

Well, our web server is Netscape Enterprise Server 3.5.1
on Solaris and we use Sybase.  Can you dynamically create
eXcel on server set with above configuration?

In article <8f20kt$lgm$1@newsflash.concordia.ca>,
  nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar) wrote:
> In article <8euo4l$136$1@nnrp1.deja.com>,  <wjair@my-deja.com> wrote:
> >Hi,
> >
> >Is there a way to dynamically generate eXcel spreadsheet
> >and eXcel's chart on client's browser from the data that
> >got send back from the server?
>
> AFAIK the only way to do that is with the Win32::OLE modules
> talking directly to an Excel app. (There are some things that can
write Excel
> files, or Excel-compatible file, but I don't think charts are doable).
>
> There was a good Perl Journal article on this ... if you pay up you
can
> get access to that article,
> <http://www.itknowledge.com/tpj/issues/vol3_2/tpj0302-0008.html>
>
> The next question is: why do you want to do this client-side?
> Unless you have complete control over what is installed on the
client,
> generate it server-side.
>
> --
> Neil Kandalgaonkar
> neil@brevity.org
>


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


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

Date: 9 May 2000 18:13:53 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: efficiency with data separation. [was Re: HTTP::Request=HASH(0x7bb141c) ?]
Message-Id: <8f9kh1$3d3$0@216.155.32.13>

In article <x7itwour6o.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 | because i felt like highlighting some stuff rather than tackling the
 | whole problem. it is my perogative. :-)
 | 
 |   TW> please, re-read the previous post! :))
 | 
 | i can't right now. i also promised to work on your html paragraph hing
 | tomorrow. maybe i will get back to this one then.
 

ok points taken, and thanks again :) 

*making more notes*

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 09 May 2000 21:34:45 GMT
From: "Kelvin" <k2_1999@hotmail.com>
Subject: Help Needed  - Perl Matching Operator
Message-Id: <Vv%R4.7203$%u6.427214@news1.telusplanet.net>

I'm little confusing of how to use the matching operator in perl!
I'm writing a function to check if the user enter a valid email address,
but I don't sure how to use the m// operator.

sub checkemail {
    $_ = $enteredEmail;
    m/"@"//;
}
is that correct?
Or how can I make sure the $enteredEmail included a "@" in it?

Thanks in Advance!
Kelvin
kelvinsun@hotmail.com




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

Date: Tue, 09 May 2000 19:23:31 GMT
From: gary.lefko@usafa.af.mil
Subject: Help with Perl and Mysql DBI/DBD Programming??????
Message-Id: <8f9oiv$qfp$1@nnrp1.deja.com>

I can connect to our Mysql database through (and others) software
WinMysql (www.winmysql.com) but not through code.  Can anyone see the
problem?

Here is first code snippet:#!/usr/bin/perl
use CGI qw/:standard/;
print header;

use DBI;

$user = "myid";
$pw   = "mypassword";
$sql = "select qty from cc_orders";
print "About to connect...\n";
$DSN  = "DBI:mysql:www.golf-ads.com:mydatabase:3306";
$dbh  = DBI->connect($DSN,$user,$pw) || print "Cannot connect:
$DBI::errstr\n" unless $dbh;
print "Connected...\n";
    $sth = $dbh->prepare($sql);
print "execute start\n";
    $sth->execute;
print "Executed...\n";
$i = 0;
while ( @row = $sth->fetchrow_array() ) {
  print "Test Database $row[$i]\n";
  $i = $i + 1;
  }

$dbh->disconnect;

print "finished...\n";

exit;


The results are:
----------------
About to connect... Cannot connect: Unknown MySQL Server Host (stewart)
(0) Connected...


Here is second snippet which shows drivers (I presume):
-------------------------------------------------------
#!/usr/bin/perl -w

### Load DBI
use DBI;

### Probe DBI for the installed drivers
@drivers = DBI->available_drivers();

### Iterate through the drivers and list the data
### sources for each one
foreach $driver ( @drivers ) {
    print "Driver: $driver\n";
    @dataSources = DBI->data_sources( $driver );
    foreach $dataSource ( @dataSources ) {
        print "\tData Source is $dataSource\n";
    }
    print "\n";
}
exit;


here is second snippet results:
-------------------------------
Driver: NullP
	Data Source is DBI::dr=HASH(0x1512d0)

Driver: Sponge
	Data Source is DBI::dr=HASH(0x15a1d4)

Driver: mSQL



Any help would be appreciated!

Gary


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


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

Date: Tue, 09 May 2000 12:35:03 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help with Perl and Mysql DBI/DBD Programming??????
Message-Id: <39186867.D02F9867@vpservices.com>

gary.lefko@usafa.af.mil wrote:
> 
> I can connect to our Mysql database through (and others) software
> WinMysql (www.winmysql.com) but not through code.  Can anyone see the
> problem?
> 

> #!/usr/bin/perl

Not a problem here, but it's good practice to include -w and use strict.

> $DSN  = "DBI:mysql:www.golf-ads.com:mydatabase:3306";

It looks like you've got driver:host:database:port, and it should be
driver:database:host:port, or to avoid making those kinds of errors
driver:database=$db;host=$host;port=$port.

-- 
Jeff


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

Date: Tue, 9 May 2000 21:44:23 +0100
From: "A-Tuin ®" <steve@swsystem.yorks.com>
Subject: host checking
Message-Id: <391878a8.0@katana.legend.co.uk>

OK I have a file containing a list of host IPs and port numbers in the
format
aaa.bbb.ccc.ddd:pppp

each host:port is on a single line, my problem is that all these hosts are
not online at the same time, can anyone give me a few pointers for using
this file as a master list, checking to see which hosts can be connected to
and putting these into a separate file.

TIA

Steve

Send reply emails to:
Home -> steve@swsystem.yorks.com
Work  -> work@swsystem.yorks.com
http://www.swsystem.yorks.com
ICQ# 40372896
ICQpage me @ http://wwp.icq.com/40372896
quick message to 40372896@pager.icq.com
SMS +44 (0) 7715 565 785
Plain Text message to mobile@swsystem.yorks.com
Get paid to surf @ http://alladvantage.com/go.asp?refid=GPI186







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

Date: Tue, 09 May 2000 19:25:37 GMT
From: c_neak@my-deja.com
Subject: Re: How to include lines beginning and ending with a string
Message-Id: <8f9oms$qp9$1@nnrp1.deja.com>

In article <MPG.1381f11c1c92383e98aa2d@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:

>
> Here is a simple example, which just collects and later prints the
> included lines:
>
> #!/usr/bin/perl -w
> use strict;
>
> my @array;
>
> while (<DATA>) {
>     next unless /SEIINF/ .. /SCEIINF/; # Look only between matches.
>     next if /SEIINF/ || /SCEIINF/; # Ignore the bracketing matches.
>     push @array, $_;
> }
>
> print @array;
> __END__
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>

Thank you very much , Larry !
Perl is not so easy to understand , but I learn more when I read some
answers in this newsgroup :-)

Thanks a lot !


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


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

Date: Tue, 09 May 2000 19:09:24 GMT
From: c_neak@my-deja.com
Subject: Re: How to include/exclude lines ?
Message-Id: <8f9nol$pei$1@nnrp1.deja.com>

In article <u9r9bchs82.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:
> c_neak@my-deja.com writes:
>
> > Subject : How to include lines beginning and ending with a string
> >

> There are no such lines in your data that start with "SEIINF" and ends
> with "SCEIINF".  There is a line that reads "SEIINF" and one that
> reads "SCEIINF" and you presumably want to process only the lines
> between them.
>

You're right :-)

>
> What you have is not a Perl programming problem but a programming
> problem per se - you simply are not thinking clearly about your
> problems.  The fact that your Perl code does not correctly implement
> your misstatement of your problem is nowhere near as serious as the
> fact that your Perl code attempts to solve the misstated problem
> rather than the real one.
>

You remember me a teacher i have before and who said always to the
students : "What you're coding is always a piece of shit for me ..." .
It's a teacher I like very much :-)

> Whatever you choose to do always read the documentation on each thing
> you use for the first time.  You clearly have no clue as to what a
> regular expression is and what the Perl pattern match operator does.
>
> > 	if ($line =~ /SEIINF(RT\D{4})SCEIINF/g){ #problem here !!!
>
> What do you think this does and why?
>
> Perhaps if you try to explain it that will help you.
>

Searching a string beginning with "SEIINF" and ending with "SCEIINF"
and including RT + 4 letters between these 2 strings ?


Thanks a lot for your reply !



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


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

Date: 9 May 2000 18:11:35 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: How to tell if <> operator will work on a given scalar?
Message-Id: <957895162.1170@itz.pp.sci.fi>

In article <8f9gku$qvg$1@charm.magnus.acs.ohio-state.edu>, Ilya Zakharevich wrote:
>[A complimentary Cc of this posting was sent to Ilmari Karonen 
><usenet11084@itz.pp.sci.fi>],
>who wrote in article <957726600.29276@itz.pp.sci.fi>:
>> 
>>   open FILE, "<&=$fd" or die "Can't open file descriptor $fd: $!\n";
>
>  perl -wle "open FILE, qq(<&=2) or die; print <FILE>"
>
>Hmm, it works!

 ..for some values of "works":

$ perl -wle "open FILE, qq(<&=2) or die; print <FILE>" 2>&1 | cat
Died at -e line 1.

For the more puzzled readers out there, the trick is in redirecting
STDERR through the no-op pipe.  Without it, all the three first file
descriptors refer to the same tty.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 9 May 2000 21:01:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to tell if <> operator will work on a given scalar?
Message-Id: <8f9ub4$2ks$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ilmari Karonen 
<usenet11086@itz.pp.sci.fi>],
who wrote in article <957895162.1170@itz.pp.sci.fi>:
> >>   open FILE, "<&=$fd" or die "Can't open file descriptor $fd: $!\n";
> >
> >  perl -wle "open FILE, qq(<&=2) or die; print <FILE>"
> >
> >Hmm, it works!
> 
> ..for some values of "works":
> 
> $ perl -wle "open FILE, qq(<&=2) or die; print <FILE>" 2>&1 | cat
> Died at -e line 1.
> 
> For the more puzzled readers out there, the trick is in redirecting
> STDERR through the no-op pipe.  Without it, all the three first file
> descriptors refer to the same tty.

Yes, but FILE should have been opened for read only.

Ilya



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

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


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