[17417] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4837 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 7 21:05:43 2000

Date: Tue, 7 Nov 2000 18:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973649121-v9-i4837@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 7 Nov 2000     Volume: 9 Number: 4837

Today's topics:
        "NT has stopped the process..." - IIS3/SP6 [was: Beginn <elephant@squirrelgroup.com>
    Re: $password = crypt($pass, ar); (Mark-Jason Dominus)
    Re: $password = crypt($pass, ar); <ren.maddox@tivoli.com>
    Re: $password = crypt($pass, ar); <me@privacy.net>
    Re: Anonymous Data (probably very easy) <wyzelli@yahoo.com>
    Re: Anonymous Data (probably very easy) <wyzelli@yahoo.com>
    Re: Anonymous Data (probably very easy) (Richard J. Rauenzahn)
    Re: CGI: How to save upload file by perl? <Petri_member@newsguy.com>
    Re: CGI: How to save upload file by perl? <radar@jetstream.net>
    Re: Cookies <elephant@squirrelgroup.com>
    Re: Copy of directory tree (Mark-Jason Dominus)
        fetch data from database bing-du@tamu.edu
    Re: fetch data from database (Garry Williams)
        file upload, determining file type, size, format <ritche@san.rr.com>
    Re: file upload, determining file type, size, format (Martien Verbruggen)
        Generating UUIDs tomp@dirigo.com
    Re: Google module help <elephant@squirrelgroup.com>
    Re: HELP Winows NT Mail::Sender <dave_at_hm@hotmail.com>
    Re: HELP (Mark-Jason Dominus)
    Re: HELP nodo70@my-deja.com
    Re: HELP <wyzelli@yahoo.com>
    Re: Hex -> Text (Jon Ericson)
    Re: How to return @Array1 and @Array2? <ren.maddox@tivoli.com>
        how to use variables in perl -e mode <jzhao2@Bayou.UH.EDU>
    Re: how to use variables in perl -e mode (Garry Williams)
    Re: how to use variables in perl -e mode <tim@ipac.caltech.edu>
        javascript in perl CGI scripts. <home@aidans0.demon.co.uk>
        MakeMaker Problems (Kate T. Porter)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 8 Nov 2000 11:09:26 +1100
From: jason <elephant@squirrelgroup.com>
Subject: "NT has stopped the process..." - IIS3/SP6 [was: Beginner need a clue on install]
Message-Id: <MPG.147344bea3a56adc989884@localhost>

John wrote ..
>I installed the latest version of perl on NT 4, SP 6 iis 3, but when I try to 
>run a script it does nothig for a while and then tell me the that NT has 
>stoped the process because it wasn't getting any answer
>
>I got no idea if this problem is related to iis or perl so I do not know wher 
>to start.

IIS3 is a very old version to have running with SP6 - are you sure that 
they're compatible ? (and that's a rhetorical question because it's 
completely off-topic for this group)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 08 Nov 2000 00:04:57 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: $password = crypt($pass, ar);
Message-Id: <3a0898a8.70eb$2b3@news.op.net>

In article <Tb%N5.2332$Nw6.6976@news.iol.ie>, EM <me@privacy.net> wrote:
>this looks good but where do i put the encrypted string i want to decrypt?

If you can't see how to use it, what makes you think that it looks good?

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 07 Nov 2000 15:51:38 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: $password = crypt($pass, ar);
Message-Id: <m3lmuvpi1h.fsf@dhcp11-177.support.tivoli.com>

"EM" <me@privacy.net> writes:

> Could u suggest a way for this to work with letters?
> I dont know how to increment a word
> like make aaaaa go to aaaab etc...

Actually, Perl's magical auto-increment will change "aaaaa" to
"aaaab", but that still doesn't cover everything.  It will not, for
instance switch from lower to upper case.  You'll really have to build
the strings up from their ASCII codes to get everything, which is what
MJD's solution does -- see his post.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Wed, 08 Nov 2000 00:25:22 GMT
From: "EM" <me@privacy.net>
Subject: Re: $password = crypt($pass, ar);
Message-Id: <S31O5.2354$Nw6.7091@news.iol.ie>

never mind i got it to work
thanks

"Mark-Jason Dominus" <mjd@plover.com> wrote in message
news:3a0898a8.70eb$2b3@news.op.net...
> In article <Tb%N5.2332$Nw6.6976@news.iol.ie>, EM <me@privacy.net> wrote:
> >this looks good but where do i put the encrypted string i want to
decrypt?
>
> If you can't see how to use it, what makes you think that it looks good?
>
> --
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub
p{
>
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|or
d
> ($p{$_})&6];$p{$_}=/
^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep
rand(2)if/\S/;print




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

Date: Wed, 8 Nov 2000 09:20:32 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Anonymous Data (probably very easy)
Message-Id: <Eu0O5.5$y5.1937@vic.nntp.telstra.net>

<dottiebrooks@my-deja.com> wrote in message
news:8u9tmc$6lf$1@nnrp1.deja.com...
> Hi,

Hello

>
> use List::Permutor;
> use strict;
>
> my @result;
>
> getemall('A', 'B', 'C', 'D');
> my $perm = new List::Permutor @result;
> while (my @set = $perm->next) {
>     print "One order is @set.\n";
> }
>
> sub getemall {
>
>     for my $i (1 .. 1<<@_) {
>         push @result, [ map { ($i & 1<<$_)?$_[$_]:() } 0..$#_];
>     }
>     return @result;
> }
>

Since I don't have List::Permutator I can't really test this but it
looks as though you are not doing anything with the return from the sub.

I would make the following changes:

use List::Permutor;
use strict;

my @result = getemall('A', 'B', 'C', 'D'); # declare @result and put the
results from the getemall sub into it

my $perm = new List::Permutor @result;
while (my @set = $perm->next) {
    print "One order is @set.\n";
}

sub getemall {

    for my $i (1 .. 1<<@_) {
        push my @perms, [ map { ($i & 1<<$_)?$_[$_]:() } 0..$#_]; #
declare a lexically scoped array for use within the sub
    }
    return @perms;
}

Hope this helps and doesn't lead you on any wild goose chases.

Wyzelli
--
@x='07411711511603209711011111610410111403208010111410803210409709910710
1114'=~/(...)/g;
print chr for @x;





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

Date: Wed, 8 Nov 2000 09:34:26 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Anonymous Data (probably very easy)
Message-Id: <GH0O5.6$y5.1648@vic.nntp.telstra.net>

"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:Eu0O5.5$y5.1937@vic.nntp.telstra.net...

Actually the return from the sub is just redundant, since you appear to
be working on the @result array directly.

Just take my comments as coding style improvements, and I have no idea
why it isn't working for you since I can't test it.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_!=1)? 's':'';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';





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

Date: 8 Nov 2000 00:57:22 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Anonymous Data (probably very easy)
Message-Id: <973645041.993018@hpvablab.cup.hp.com>

dottiebrooks@my-deja.com writes:
>Hi,
>  I'm trying to calculate all permutations of all combinations of some
>data.  I have to say that the combination portion of the code is
>courtesy of a Bart Lateur of this group, but any errors are entirely my
>own.  Essentially the combination portion is returning @result and I
>want to feed this into the permutation calculation.  At present I
>appear to be feeding in the reference, not the value.  There is
>probably a symbol or something equally easy to do this, but I cannot
>locate it.  Can anyone help?

You need to either collapse the array of array of elements to an array
of strings (i.e., ('A', 'B', 'C') => "ABC") before handing it off to the
permutor, or you need to dereference the arrays while printing them out.

The latter seems more useful...

#!/opt/perl5/bin/perl5 -w

use List::Permutor;
use strict;

my @results = getemall('A', 'B', 'C', 'D');

my $perm = new List::Permutor @results;

while (my @set = $perm->next) {
    print "One order is ";
    foreach(@set) {  
       print "(@$_) ";
    }
    print "\n";
}

sub getemall {
    my @tmp;
    for my $i (1 .. 1<<@_) {
        push @tmp, [ map { ($i & 1<<$_)?$_[$_]:() } 0..$#_];
    }
    return @tmp;
}

-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 7 Nov 2000 14:30:30 -0800
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <8u9vq601t0n@edrn.newsguy.com>

In article <3A076648.2B5C1117@jetstream.net>, "Dragonia says...
> Thanks for the code. I've managed to get things working for
> the most part, but have one problem:
> filenames with spaces will create an error and not upload.

There is an easy solution to that:

>> if ($fn =~ /^([-\@\w.]+)$/) { # From perlsec.

Add a space into the character class, like this:

if ($fn =~ /^([-\@\w. ]+)$/) {


That's all you need.
Maybe there's a security reason for it not being a part of the match from the
beginning.
If you are worried, check out 'perldoc perlsec'.


Petri Oksanen



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

Date: Tue, 07 Nov 2000 17:02:14 -0800
From: "Dragonia Radar Freedom, C.S." <radar@jetstream.net>
Subject: Re: CGI: How to save upload file by perl?
Message-Id: <3A08A616.2BD4C180@jetstream.net>

That worked like a hot damn!  Many thanks.

--
Michel.
Petri Oksanen wrote:

> In article <3A076648.2B5C1117@jetstream.net>, "Dragonia says...
> > Thanks for the code. I've managed to get things working for
> > the most part, but have one problem:
> > filenames with spaces will create an error and not upload.
>
> There is an easy solution to that:
>
> >> if ($fn =~ /^([-\@\w.]+)$/) { # From perlsec.
>
> Add a space into the character class, like this:
>
> if ($fn =~ /^([-\@\w. ]+)$/) {
>
> That's all you need.
> Maybe there's a security reason for it not being a part of the match from the
> beginning.
> If you are worried, check out 'perldoc perlsec'.
>
> Petri Oksanen





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

Date: Wed, 8 Nov 2000 10:57:54 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Cookies
Message-Id: <MPG.14734212f00b16b989882@localhost>

dauwe@my-deja.com wrote ..
>Hello!
>I would like to download some pages from the internet using a perl
>script. Unfortunately the server  requires a web browser that supports
>and accepts cookies. Since I don't want to use a browser but a perl
>script, how can I enable cookies with perl??
>
>Here is the script I've used:
>use LWP::Simple;
>$url =
>'http://ojps.aip.org/journal_cgi/dbt?KEY=APPLAB&Volume=77&Issue=19';
>$localfile = "apl,77,19,2000.html";
>mirror($url, $localfile);
>
>The file I get is just a warning, that I've been redirected.

you can't do what you want with LWP::Simple .. you need to use 
LWP::UserAgent which has support for cookies .. take a look at the 
documentation

  perldoc LWP::UserAgent

for more information about the perldoc utility type the following at the 
command line

  perldoc perldoc

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 08 Nov 2000 00:39:39 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Copy of directory tree
Message-Id: <3a08a0ca.7268$130@news.op.net>
Keywords: bimetallism, curt, isle, ministry


In article <8u9ftb$pll$1@nnrp1.deja.com>, Andre  <casades@uol.com.br> wrote:
>I want to make a copy of a directory tree (including files). The first
>solution to do this is call system(cp -r) for Linux and system(xcopy /R)
>for Windows but I like to make a perl script that run in both OS.
>Does anyone know a good and clean way to do this?

        http://language.perl.com/ppt/src/cp/

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Tue, 07 Nov 2000 23:12:20 GMT
From: bing-du@tamu.edu
Subject: fetch data from database
Message-Id: <8ua28e$anv$1@nnrp1.deja.com>

version 5.005_03 built for irix-64. DBI. DBD::Oracle.

Seems there are several ways to fetch data from database.

fetch()
fetchrow_array()
fetchrow_arrayref()
fetchrow_hashref()

Which one is fastest?

'fetch()' is used in the following sub-routine.  To meature the
execution time, I inserted benchmark for each step.  The output shows
that the loop 'while ($sth->fetch())' takes most of the time. Retrieving
21 students' info takes about 60 seconds to finish!

Any ideas?


===========================
sub ora_class_students {
my ($courseno) = @_;
my ($studentid,$major,$classification,$tamuofficialname,$uid);

my %students = ();

$t0 = new Benchmark;
my $sth = $dbh->prepare(
           "SELECT stu_course.student_id,
                   stu_email.email,
                   student_view.name,
                   student_view.major,
                   student_view.class
             FROM stu_course,
                  student_view,
                  stu_email
             where student_view.sid=stu_course.student_id
                 and stu_course.student_id=stu_email.student_id
                 and STU_COURSE.courseno = ?"
                       );

$t1 = new Benchmark;
$td = timediff($t1,$t0);
print "<br><b>preparing the SELECT statement</b> took
",timestr($td),"<br>";

   $sth->bind_param(1, $courseno, SQL_VARCHAR);

   if (!$sth)
   {
     print "Can't prepare statement: $DBI::errstr";
     exit(1);
   }

$t0 = new Benchmark;

    $sth->execute;

$t1 = new Benchmark;
$td = timediff($t1,$t0);
print "<br><b>executing the SELECT statement</b> took ",
timestr($td),"<br>";

    # Associcate Perl variables with each output column


$sth->bind_columns(undef,\$studentid,\$uid,\$tamuofficialname,\$major,\$
classification);

$t0 = new Benchmark;

    while ($sth->fetch()) {
       $students{$studentid}=
[$uid,$tamuofficialname,$major,$classification];
    }

$t1 = new Benchmark;
$td = timediff($t1,$t0);
print "<br><b>fetching result</b> took ", timestr($td),"<br>";

    # check for problems which may have terminated the fetch early

    if ($DBI::err)
    {
      warn $DBI::errstr;
    }

$sth->finish;
    return(%students);
}
=====================


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


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

Date: Wed, 08 Nov 2000 00:04:42 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: fetch data from database
Message-Id: <uM0O5.926$FG.51608@eagle.america.net>

On Tue, 07 Nov 2000 23:12:20 GMT, bing-du@tamu.edu <bing-du@tamu.edu> wrote:
>version 5.005_03 built for irix-64. DBI. DBD::Oracle.
>
>Seems there are several ways to fetch data from database.
>
>fetch()
>fetchrow_array()
>fetchrow_arrayref()
>fetchrow_hashref()
>
>Which one is fastest?

This is from the DBI manual page: 

     `fetchrow_arrayref'
           $ary_ref = $sth->fetchrow_arrayref;
           $ary_ref = $sth->fetch;    # alias

         Fetches the next row of data and returns a reference to
         an array holding the field values.  Null fields are
-->      returned as `undef' values in the array.  This is the
-->      fastest way to fetch data, particularly if used with
-->      `$sth-'>`bind_columns'.

-- 
Garry Williams


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

Date: Wed, 08 Nov 2000 00:23:45 GMT
From: "Ritche Macalaguim" <ritche@san.rr.com>
Subject: file upload, determining file type, size, format
Message-Id: <l21O5.5779$bl.2395797@typhoon.san.rr.com>

Is there a way to determine a file's properties in Perl?

For example, what is the file's type? Text? Image? JPG? GIF? EXE? How about
file size? 2k? 3Mb? Or image size? 120x10 px?

Is there binary information in a file's header that reveals this
information?

Just wondering if anyone has figured this out or if it is in some module out
there.

Any help is greatly appreciated!

Thanks!
Ritche ritche@san.rr.com





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

Date: Wed, 08 Nov 2000 01:42:43 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: file upload, determining file type, size, format
Message-Id: <slrn90hbsm.7ck.mgjv@verbruggen.comdyn.com.au>

On Wed, 08 Nov 2000 00:23:45 GMT,
	Ritche Macalaguim <ritche@san.rr.com> wrote:
> Is there a way to determine a file's properties in Perl?

http://language.perl.com/ppt/src/file/index.html

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd.   | password?
NSW, Australia                  | 


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

Date: Tue, 07 Nov 2000 23:21:58 GMT
From: tomp@dirigo.com
Subject: Generating UUIDs
Message-Id: <8ua2qg$b75$1@nnrp1.deja.com>

Does anyone have any perl code to generate UUID?  Looking for code to
run on an HP-UX 11.x box.

Have tried the DCE module; however, I cannot get it to install on the
system.

Any help appreciated....



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


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

Date: Wed, 8 Nov 2000 11:02:55 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Google module help
Message-Id: <MPG.147343369797ef9a989883@localhost>

jp wrote ..
>I'm wondering if anyone who has used the Google.pm module has worked out a
>way to retrieve more than 100 results from a search? I have tried to set
>max_to_retrieve to be > 100 but this seems to have no effect.
>I know I could just run the query url, but the module provides a lot of
>useful parsing that I need.

I think you'll find that Google itself has the limitation of 100 results 
per query .. the module can only be as good as the engine itself

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 07 Nov 2000 15:58:22 -0800
From: Dave E <dave_at_hm@hotmail.com>
Subject: Re: HELP Winows NT Mail::Sender
Message-Id: <3A08971E.544A447E@hotmail.com>

well, if you're willing to try advice from a non-expert,

I tried to install Mail::Sender via ppm.pl and picked up an error message.  As
well, use Send::Mail came up with an error (sounds like what you got too).

So, I suspect the answer is that Mail::Sender is not compatible with the Win32
version of Perl.  Or, that something else has to be installed first.

If you want a work-around, I have sent mail by shelling out to blat.exe.  A
feeware mailer you can pick up.  If you can't get Mail::Sender working, you
could use this.

    David...

P.S.  If you do get Mail::Sender going, send me an email :)  it's cleaner that
blat.


Paulgee wrote:

> Hi all
>        I am trying to get script.pl to send mail from a NT server it has
> activestate installed but perl cannot find the dir where sender.pm is
> installed, is the answer to push another search location onto the @INC array
> and if so can anyone tell me the default directory or a clue where sender.pm
> is usualy installed.
>
> I wanted to check that I am not missing something before I contact my ISP.
>
> thanks
>
> paul
>
> p.s
> I am using the following from cpan.
>         use Mail::Sender;
>
>         $sender = new Mail::Sender {smtp => 'mail.yourdomain.com', from =>
> 'your@address.com'};
>         $sender->MailFile({to => 'some@address.com', subject => 'Here is the
> file',
>                        msg => "I'm sending you the list you wanted.",
>                            file => 'filename.txt'});



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

Date: Wed, 08 Nov 2000 00:16:42 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: HELP
Message-Id: <3a089b62.7166$2f@news.op.net>
Keywords: Mae, clone, preen, stormy


In article <8u9p41$2bc$1@nnrp1.deja.com>,  <nodo70@my-deja.com> wrote:
>Anyone can help me to write a simple code that run every 5 minutes?  

        #!perl

        while ("Cogito, ergo sum") {
          # check the system
          # ...
          sleep(300);   # Wait 5 minutes
        }

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 08 Nov 2000 00:56:35 GMT
From: nodo70@my-deja.com
Subject: Re: HELP
Message-Id: <8ua8c1$fm5$1@nnrp1.deja.com>

Thanks Mark,
But then again once I run the script the MS Dos window pop up and live
there until I terminate the script which I don't want to.  Is there any
way that I can run under back ground?  Any suggestion?

Thanks,
nodo

In article <3a089b62.7166$2f@news.op.net>,
  mjd@plover.com (Mark-Jason Dominus) wrote:
>
> In article <8u9p41$2bc$1@nnrp1.deja.com>,  <nodo70@my-deja.com> wrote:
> >Anyone can help me to write a simple code that run every 5 minutes?
>
>         #!perl
>
>         while ("Cogito, ergo sum") {
>           # check the system
>           # ...
>           sleep(300);   # Wait 5 minutes
>         }
>
> --
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona
tsuJ";sub p{
> @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P
[$f|ord
> ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^
[P.]/&&
> close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/
\S/;print
>


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


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

Date: Wed, 8 Nov 2000 10:47:22 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: HELP
Message-Id: <4M1O5.8$y5.2085@vic.nntp.telstra.net>

<nodo70@my-deja.com> wrote in message
news:8ua8c1$fm5$1@nnrp1.deja.com...
> Thanks Mark,
> But then again once I run the script the MS Dos window pop up and live
> there until I terminate the script which I don't want to.  Is there
any
> way that I can run under back ground?  Any suggestion?
>
> Thanks,
> nodo
>

Check the Activestate FAQ about running as a service.  You will need the
resource kit installed.

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: 7 Nov 2000 23:59:00 GMT
From: Jonathan.L.Ericson@jpl.nasa.gov (Jon Ericson)
Subject: Re: Hex -> Text
Message-Id: <8FE5AB510JonathanLEricsonjpln@137.78.50.25>

On 04 Nov 2000, same@make-it-online.com wrote:

>Can someone show me how to convert Hex file to Text file?

Is this a perl question?

Have you read the perlfunc entries for hex, oct, ord, and chr?

Have you searched CPAN?

Jon


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

Date: 07 Nov 2000 16:06:55 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: How to return @Array1 and @Array2?
Message-Id: <m3hf5jphc0.fsf@dhcp11-177.support.tivoli.com>

mjd@plover.com (Mark-Jason Dominus) writes:

> In article <8u9o54$1hn$1@nnrp1.deja.com>,  <fallenang3l@my-deja.com> wrote:
> >(@Array1,@Array2)=&sub_returning_Arrays();
> 
> I wonder if it's too ill to suggest this:
> 
>         sub sub_returning_Arrays {
>           ...
>           return (scalar @a1, @a1, @a2);
>         }
> 
>         my ($n, @Array1) = sub_returning_Arrays();
>         my @Array2 = splice @Array1, $n;
> 
> But I suppose it doesn't scale well to multiple arrays.

Unless you get even more demented:

sub mysub {
  my @a1 = (1, 2, 3);
  my @a2 = qw(red blue green yellow);
  my @a3 = (2, 4, 6, 8);
  return map {(scalar @$_, @$_)} \(@a1, @a2, @a3);
}
my @a = mysub();
my @arrays;
push @arrays, [ splice @a, 0, shift @a ] while @a;
print "@$_\n" for @arrays;
__END__                       

Of course, since I had to resort to references to get it to really
scale, I can't imagine why you would not just use references
directly.  Though you don't actually *have* to use the references here
if you don't want it to support an arbitrary number of flattened
arrays...

Boy do I feel silly... :)

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 7 Nov 2000 18:14:53 -0600
From: Jin Zhao <jzhao2@Bayou.UH.EDU>
Subject: how to use variables in perl -e mode
Message-Id: <Pine.OSF.4.21.0011071809290.9341-100000@Bayou.UH.EDU>


I am trying to use variables in perl -e mode, but always get errors of
"undefined variables". For example,  

	perl -e "while(<>) {$a .= $_; }" 

always fails to be executed. Even I add define statement for $a before
while loop. 

Does anybody has good idea ? Email responses are appreciated. 

Thanks,

Jin



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

Date: Wed, 08 Nov 2000 00:25:21 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: how to use variables in perl -e mode
Message-Id: <R31O5.927$FG.51608@eagle.america.net>

On Tue, 7 Nov 2000 18:14:53 -0600, Jin Zhao <jzhao2@Bayou.UH.EDU> wrote:
>
>I am trying to use variables in perl -e mode, but always get errors of
>"undefined variables". For example,  
>
>	perl -e "while(<>) {$a .= $_; }" 
>
>always fails to be executed. Even I add define statement for $a before
>while loop. 
>
>Does anybody has good idea ? Email responses are appreciated. 

Although you don't say *how* it fails, it's probably a result of a
shell "eating" stuff inside the quotation marks.  Try protecting the
variables by enclosing the value for the -e option in single quote
marks or escaping the dollar signs.  

-- 
Garry Williams


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

Date: Tue, 07 Nov 2000 17:32:39 -0800
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: how to use variables in perl -e mode
Message-Id: <3A08AD37.42B5DF39@ipac.caltech.edu>

Jin Zhao wrote:
> 
> I am trying to use variables in perl -e mode, but always get errors of
> "undefined variables". For example,
> 
>         perl -e "while(<>) {$a .= $_; }"
> 
> always fails to be executed. Even I add define statement for $a before
> while loop.

The problem is your shell, not perl. Replace the double quotes with single
quotes. I.e.

% perl -e 'while(<>) {$a .= $_; }'

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Tue, 7 Nov 2000 23:18:11 -0000
From: "steve" <home@aidans0.demon.co.uk>
Subject: javascript in perl CGI scripts.
Message-Id: <973639050.24885.0.nnrp-09.c1ed46c5@news.demon.co.uk>

Hi i am trying to run CGI scripts on micro$oft Windows ME with JavaScript
embedded. I am sure that I've made a trivial mistake in copying the code
from my Linux installation but no matter what I try, Micro$oft IE always
gives the error on line 5 char 15.

Where is the line 5 refered to in the error from IE?

PS On Linux my code works fine. On Windoze I'm using IndigoPerl.

Here's the whole file

#!perl -w
BEGIN {
     use CGI::Carp qw(carpout);
      open(LOG, ">>C:\\perl\logs\mycgi-log.log") or
       die("Unable to open mycgi-log: $!\n");
     carpout(LOG);
}

use strict;
use CGI qw/:standard :netscape/;
use CGI::Carp qw(cluck fatalsToBrowser);
my($JSC)=<<END;

function CSURLPopupShow(formName, popupName) {
    var form  = CSFindElement(formName,0);
    var popup = form.elements[popupName];
    location.replace(popup.options[popup.selectedIndex].value);
    popup.selectedIndex = 0;
}
function IsIE() { return CSAg.indexOf('MSIE') > 0;}
function CSIEStyl(s) { return document.all.tags('div')[s].style; }
CSAg = window.navigator.userAgent;
CSBVers = parseInt(CSAg.charAt(CSAg.indexOf('/')+1),10);
function CSFindElement(n,ly) {
if (CSBVers < 4) return document[n];
    var curDoc = ly ? ly.document : document; var elem = curDoc[n];
    if (!elem) {
 for (var i=0;i<curDoc.layers.length;i++) {
      elem = CSFindElement(n,curDoc.layers[i]);
  if (elem) return elem;
 }
    }
    return elem;
}
END

;

my $q = new CGI;
my
($book_image,$book_id,$book_price,$book_isbn,$book_text,$book_author,$book_t
itle,$book_type);

my ($site_dir) = "http://localhost/truecrime";
my ($img_dir) ="http://localhost/truecrime/images";
my ($data_dir) ="c:\\perl\\htdocs\\truecrime";

#my ($site_dir) = "http://truecrime";
#my ($img_dir) ="http://truecrime/images";
#my ($data_dir) ="/home/truecrime";

my ($script_dir) = "/jscript";

add_book_to_cart($q) if $q->param('add');
$book_id = $q->param('book_id');
set_book_details();
my($labels,$values) = make_book_list();

print $q->header(-expires=>"-1d");
print $q->start_html({-bgcolor=>"#ffffff",
-script=>[ {-language=>"JavaScript1.2",-src=>"$JSC"} ]},
#    -script=>[ {-language=>"JavaScript1.2",
#   -src=>"$script_dir/standard.js"}],
#   {-language=>"JavaScript",
#     -src=>"$script_dir/rollover.js"}],
#     -onLoad=>"CSScriptInit();"},
   "Buy Crime Books");

print $q->div({align=>'center'},
 table({-border=>0, -cellpadding=>2,-cellspacing=>0, -width=>500},
 Tr(td({-colspan=>2},img({-width=>326,-src=>"$img_dir/book_logo.gif"}))),

 Tr(start_form({-name=>"change_book"}),
  td("Choose a book :"),
  td(popup_menu({-name=>"chooser",-labels=>$labels, -values=>$values,
 -onChange=>"alert('okay');CSURLPopupShow('change_book','chooser');"})),
 end_form()),

 Tr(td({-height=>20},$book_title),
  td({-align=>"center", -rowspan=>7},
   img({-width=>300, -src=>$book_image}))),
 Tr({-height=>20},td("$book_isbn")),
 Tr({-height=>20},td("$book_author")),
 Tr({-height=>20},td("$book_type")),
 Tr({-height=>20},td(" $book_price")),
 Tr({-height=>20},td(
  start_form(-name=>'addform'),
  submit({-name=>'add', -value=>'Add'}),
  hidden({-name=>'book_id'}),
  hidden({-name=>'cart_id'}),
  end_form())),
 Tr(td($book_text))
 ));

print $q->div({align=>'center'},
 table({-border=>0, -cellpadding=>2,-cellspacing=>0, -width=>500},
 Tr(td(a({-href=>"$site_dir/index.html",
    -onmouseover=>"return CSIShow('home',1)",
    -onmouseout=>"return CSIShow('home',0)"},
   img({-src=>"$img_dir/home_link1.gif", -border=>0}))),
  td(a({-href=>"$site_dir/mags.html",
    -onmouseover=>"return CSIShow('mags',1)",
    -onmouseout=>"return CSIShow('mags',0)"},
   img({-src=>"$img_dir/mag_link1.gif", -border=>0}))),
  td(a({-href=>"$site_dir/books.html",
    -onmouseover=>"return CSIShow('books',1)",
    -onmouseout=>"return CSIShow('books',0)"},
   img({-src=>"$img_dir/book_link1.gif", -border=>0}))),
  td(a({-href=>"$site_dir/about.html",
    -onmouseover=>"return CSIShow('about',1)",
    -onmouseout=>"return CSIShow('about',0)"},
   img({-src=>"$img_dir/about_link1.gif", -border=>0}))))));

print $q->dump;
print $q->end_html;

sub set_book_details {
 # open the file containing the details of the book
 read_book_file();
 $book_image = "$site_dir/books/images/$book_id.jpg";
}

sub read_book_file {
 my ($filename) = "$data_dir/books/details/$book_id.txt";
 my ($details,@contents);

 open (READ, $filename) or croak ("Couldn't open file $filename");
 (@contents) = <READ>;
 close (READ);
 ($details,$book_text)=splice @contents;

 ($book_isbn,$book_author,$book_type,$book_price,$book_title)
  = split ':', $details;
 return;
}

# read the book list and make a hash for labels from the name and id.
sub make_book_list {
 my (%list,@arry,$name,$id,$label);
 my ($n) = 0;
 my ($url) = "$site_dir/cgi-bin/show_book.pl";
 open (READ,"$data_dir/books/index.txt")
  or croak("open_read error opening catalog");
 while(<READ>) {
  chomp;
  ($id,$name)=split ":",$_;
  $label = "$url?book_id=$id";
  $list{$label} = $name unless $id == $book_id;
  $arry[$n++] = $label unless $id == $book_id;
 }
 return \%list,\@arry;
}

sub add_book_to_cart {
 $q->param(-name=>'cart_id',-value=>'1');
}





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

Date: 8 Nov 2000 00:31:12 GMT
From: katetal@ugcs.caltech.edu (Kate T. Porter)
Subject: MakeMaker Problems
Message-Id: <8ua6sg$h9g@gap.cco.caltech.edu>

I ran into the following problem when trying to get make distribution for a project.

The project has the following structure:
PROJ/modules/CO/SUB/MOD/MOD.pm
there are two different SUB subdirectories and modules within one use the other.  So the module called, say, Company::Foo::Bar uses
Company::Util::Useful.

The problem is that if you generate MANIFESTs and Makefile.PL's via h2xs, and the main Makefile.PL and MANIFEST include directions for the entire package, make test fails.  make creates blib/lib/... tree right above each module.  So that Company::Foo:Bar can successfully use Company::Foo:Blah, but not Company::Util::Useful because it's not in the blib off of Company/Foo/ directory.

So how do you make a distribution for a project that has multiple subdirs using each other?

Thanks,
Kate


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

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


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