[19379] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1574 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 21 00:10:33 2001

Date: Mon, 20 Aug 2001 21:10:13 -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: <998367012-v10-i1574@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 20 Aug 2001     Volume: 10 Number: 1574

Today's topics:
    Re: Perl rookie question!  Setting up perl to work with <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Perl rookie question!  Setting up perl to work with l_pantin@hotmail.com
    Re: Perl rookie question!  Setting up perl to work with <samneric@tigerriverOMIT-THIS.com>
    Re: PerlMagick (Martien Verbruggen)
        SQL group by statement? <andy_yew@iocsasia.com>
        Structuring a program (if statements) <Pcmann1@btinternet.com>
    Re: Structuring a program (if statements) <davidhilseenews@yahoo.com>
    Re: Structuring a program (if statements) l_pantin@hotmail.com
    Re: Structuring a program (if statements) (Tad McClellan)
        System call agm@physics.berkeley.edu
    Re: System call <l_pantin@hotmail.com>
    Re: System call (Martien Verbruggen)
    Re: This is not a question ... call me slow if you like <eli@there-is-no-more-qzto.com>
        Time functions and conversion <sleddog@labradorstraits.net>
    Re: Time functions and conversion (Tad McClellan)
        Warning using copy from File::Copy (Nomade)
        Win32:Ole Excel and Data Analysis Addin <dbmcgee@xfi.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 21 Aug 2001 00:14:50 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Perl rookie question!  Setting up perl to work with IIS or Personal Web Server
Message-Id: <3B818BDA.4030402@post.rwth-aachen.de>

Melvin Morris wrote:

> All I can figure is that there's something wrong with my file
> association, but I don't know what it could be.  If anybody could help
> me and offer suggestions, it would truly kick ass!

Did you, by chance, but the Perl-stuff into an HTML document? If so, 
this would hardly work.

Tassilo
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Tue, 21 Aug 2001 00:00:53 GMT
From: l_pantin@hotmail.com
Subject: Re: Perl rookie question!  Setting up perl to work with IIS or Personal Web Server
Message-Id: <3d6mdrpm.fsf@kane.kane>

Sorry, but it works perfectly fine for me...

Kevin


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

Date: Mon, 20 Aug 2001 23:04:32 -0400
From: Samneric <samneric@tigerriverOMIT-THIS.com>
Subject: Re: Perl rookie question!  Setting up perl to work with IIS or Personal Web Server
Message-Id: <MPG.15eb99cc9dc2abb98968d@news.usit.net>

Melvin Morris wrote:
> Greetings,
> 
> I'm brand new with Perl and CGI, and I'm trying to set it up to work
> with either my IIS server (on my home PC) or Personal web server.

Perl doesn't need configuring for that, but your server and puter do. Read your 
server docs, or ask in the comp.infosystems.www.servers.ms-windows newsgroup. 
There's a lot of good information available there.

> #!/usr/bin/perl

They might tell you that this line doesn't represent YOUR path to perl...


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

Date: Tue, 21 Aug 2001 02:01:04 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: PerlMagick
Message-Id: <slrn9o3g70.1qd.mgjv@verbruggen.comdyn.com.au>

On Mon, 20 Aug 2001 16:47:05 +0200,
	Thomas Schneider <thoschne678@hotmail.com> wrote:

> $x=20, $y=20;
> $Image->Set('pixel[$x,$y,]'=>'red'); # doesn't

$Image->Set("pixel[$x,$y]" => 'red');

> What am I doing wrong?

You had a comma too many, and you used single quotes where you should
have used double.

Check the perldata documentation for a discussion on string literals,
and interpolation of variables in string literals.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Tue, 21 Aug 2001 10:27:49 +0800
From: "Yew" <andy_yew@iocsasia.com>
Subject: SQL group by statement?
Message-Id: <9lsgjb$1tb$1@clematis.singnet.com.sg>

Is there a SQL group by statement and count functions using regex in perl?
Forgive me if this is a newbie question but I'm mucking around looking for
answers to this.

AAH2-6-pw-100     PPKBSBAO     6     2.8 M          PIPE
AAH2-6-pw-100     EAKBSBAO     6     2                 FITTINGS

This is a sample raw data that I have. I would like to do a perl equivalent
of a select statement and then
- group them by the second column
- sum the third column value
- and sort (but this is not as essential)

Problem I'm facing is that this output file from the program dumps the data
not in tab,comma delimited format, but just fills them up accordingly with
whitespaces (space) only. I tried looking at some common cgi scripts but
have come up short.

Any help would be appreciated, even if it were just some pointers. Thanks.

Andy




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

Date: Tue, 21 Aug 2001 00:34:39 +0100
From: "Peter Mann" <Pcmann1@btinternet.com>
Subject: Structuring a program (if statements)
Message-Id: <9ls6or$bpr$1@neptunium.btinternet.com>

Dear All,
Could someone please advise me if there is a better method of structuring
this program. I start by using a combo widget and populate it with the
months of the year.
I then need to determine which one has been selected, and assign it to the
scalar $selectedMonth in the sub 'chooseMonth'.
In C, there is a case statement, but i can't find similar method in my Perl
book!
I have my program working, but just wanted to know if some of you more
experinced programers know of a better and more efficient method than using
several if statements.


@months = qw/All January February March April May June July August September
October November December/;
$monthCombo = $report_p->BrowseEntry(-textvariable =>
\$month, -width=>'10')->place(-x=>40, -y=>200);
$monthCombo->insert('end', @months);



sub chooseMonth{
  my $selectedMonth;

  if ($month eq 'All') {
    $selectedMonth = "All"
  }
  if ($month eq 'January') {
    $selectedMonth = "January"
  }
 ..... etc (im sure u get the idea!)
}


Thanks in advance
  - Pete




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

Date: Mon, 20 Aug 2001 23:49:58 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: Structuring a program (if statements)
Message-Id: <Gmhg7.10271$c81.4029171@news1.rdc1.md.home.com>


"Peter Mann" <Pcmann1@btinternet.com> wrote in message
news:9ls6or$bpr$1@neptunium.btinternet.com...
> Dear All,
> Could someone please advise me if there is a better method of structuring
> this program. I start by using a combo widget and populate it with the
> months of the year.
> I then need to determine which one has been selected, and assign it to the
> scalar $selectedMonth in the sub 'chooseMonth'.
> In C, there is a case statement, but i can't find similar method in my
Perl
> book!
> I have my program working, but just wanted to know if some of you more
> experinced programers know of a better and more efficient method than
using
> several if statements.
>
>
> @months = qw/All January February March April May June July August
September
> October November December/;
> $monthCombo = $report_p->BrowseEntry(-textvariable =>
> \$month, -width=>'10')->place(-x=>40, -y=>200);
> $monthCombo->insert('end', @months);
>
>
>
> sub chooseMonth{
>   my $selectedMonth;
>
>   if ($month eq 'All') {
>     $selectedMonth = "All"
>   }
>   if ($month eq 'January') {
>     $selectedMonth = "January"
>   }
> ..... etc (im sure u get the idea!)
> }
>
>
> Thanks in advance
>   - Pete
>

I'm going to go out on a limb here and say that $selectedMonth = $month is
what you're looking for.

David Hilsee




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

Date: Mon, 20 Aug 2001 23:50:39 GMT
From: l_pantin@hotmail.com
Subject: Re: Structuring a program (if statements)
Message-Id: <7kvyds6o.fsf@kane.kane>

From what you've written, it seems the value is already stored in $month. So
why not just $selectedMonth = $month?

Kevin


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

Date: Mon, 20 Aug 2001 20:12:51 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Structuring a program (if statements)
Message-Id: <slrn9o39s3.smi.tadmc@tadmc26.august.net>

Peter Mann <Pcmann1@btinternet.com> wrote:

>In C, there is a case statement, but i can't find similar method in my Perl
                  ^^^^^^^^^^^^^^
>book!


Books are a third level resource. First are the standard Perl docs,
second is a Usenet archive search.

The first place amongst the first places are the Perl FAQs.

   perldoc -q "case statement"

      "How do I create a switch or case statement?"


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


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

Date: Mon, 20 Aug 2001 19:38:57 -0700
From: agm@physics.berkeley.edu
Subject: System call
Message-Id: <3B81C9C1.4E7A2080@physics.berkeley.edu>

I make a system call of the form:

system "cd /home/john";

or

system "PATH=/usr/bin:/bin:";

and neither one seems to work.

The first gives me an error message of the form:
unable to perform "cd" - file or directory not found.

And the second just does not work.

What am I doing wrong? The only thing in common is the slashes and the
references to the directory tree. Do they need to be marked off in some
way?

Regards, Antonio.



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

Date: Tue, 21 Aug 2001 02:56:21 GMT
From: "Kevin Bartz" <l_pantin@hotmail.com>
Subject: Re: System call
Message-Id: <p5kg7.27418$1p1.1968577@bgtnsc04-news.ops.worldnet.att.net>

Perl has built-in ways of handling those types of system calls. Use chdir
for directory moves and open the %ENV hash for access to environment
variables. All such actions will be local to the script.

bash-2.05# perl -e 'chdir "/home/kevin"; print qx/pwd/'
/home/kevin

bash-2.05# perl -e '$ENV{test}="hello"; print qx/printenv test/'
hello

Kevin

In article <3B81C9C1.4E7A2080@physics.berkeley.edu>, "agm"
<agm@physics.berkeley.edu> wrote:

> system "cd /home/john";


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

Date: Tue, 21 Aug 2001 03:24:03 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: System call
Message-Id: <slrn9o3l2j.1qd.mgjv@verbruggen.comdyn.com.au>

On Mon, 20 Aug 2001 19:38:57 -0700,
	agm@physics.berkeley.edu <agm@physics.berkeley.edu> wrote:
> I make a system call of the form:
> 
> system "cd /home/john";
> 
> or
> 
> system "PATH=/usr/bin:/bin:";
> 
> and neither one seems to work.

This is answered in the Perl FAQ, section 8, under the question:

       I {changed directory, modified my environment} in a perl
       script.  How come the change disappeared when I exited the
       script?  How do I get my changes to be visible?

> The first gives me an error message of the form:
> unable to perform "cd" - file or directory not found.

That's a different issue, and has nothing to do with Perl.

> And the second just does not work.

It does. It just doesn't do what you expect it to do.

What you want is to use the Perl builtin chdir() and the environment
hash %ENV.

Read the perlvar and perlfunc documentation.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 21 Aug 2001 01:08:08 GMT
From: Eli the Bearded <eli@there-is-no-more-qzto.com>
Subject: Re: This is not a question ... call me slow if you like...
Message-Id: <eli$0108202107@qz.little-neck.ny.us>

In alt.ascii-art, Ilmari Karonen  <usenet11552@itz.pp.sci.fi> wrote:
> In article <3B7B7E29.E1423382@earthlink.net>, Benjamin Goldberg wrote:
> >And using just uuencoding works even better, and doesn't require an
> >external module:
[snip]
> Clever.  Let's see if a fancier font can be made to work:
> y/n/\n/,s/\d+/$"x$&/eg,print for qw'n4|9|21|3|n1\2||2|(_-<2_|4_`1|3\3_1\2_|3\3
> -_)2_|n\__/\_,_|___/\__|2\__,_|_|1_|\___/\__|_|1_|\___|_|nn4_1\9|3|14|n4__/1-_
> )2_|1|5\3_`1|2_|1!1/2-_)2_|n3_|1\___|_|2_|2_|1_|\__,_|\__|_i_\\\___|_|1)n45/n'

Which perl? 5.6.0 is giving me "Modification of a read-only value attempted
at - line 1" for that.

I've got this old one, for 5.6.0 or higher, a bit ugly at 5 lines:

@a=([42.110.0.76.78.174.192,42.132.0.170.164.168.160,42.68.0.234.164.236.192,
170.36.0.170.164.168.160.0,68.196.0.170.68.174.160,],,[206.200.0.164.106.236,
,,168.168.0.170.138.138.0,,204.200.0.238.140.204.0,,136.168.0.170.138.138.0,,
142.174.0.170.106.234,],);$/=v36;for$a(@a){for$b(@$a){eval"$/_=sprintf('%vb',
'$b');$/\\=v10";s/\d+/sprintf"%08d",$&/ge;tr;.;;d;tr;10;* ;;print}print q,,};

And years ago I wrote this (in c):

/* if(TERM==ANSI) {cc -Dc=`"\e[32m"` sig.c} else {cc -Dc=\"\" sig.c} */
e(int d){printf("%c",d);}main(){int a=0,b;for(b=141596885;b>8;b>>=4)e(97-(
b>>22)+(b&15));puts(c);for(;a<128;){b="}////+c)cy////*494y////*979y///+e*"
"959*ey///*I5Q*939*I5Qy///*96bI3Qb69y///*!777!y///*Y6kIql6Yy///*A5q+9!,A5"
"9y///+m,YQ-my////-iq~y"[a++];for(;7&b;e("Eli!: MV?JL1m\"P\n"[b-->>3]));}}

Which I see can be converted reasonably well to perl:

sub e{printf"%c",shift}for($b=141596885;$b>8;$b>>=4){&e(97-($b>>22)+($b&15))}$
_="}X/+c)cyX/*494yX/*979yX+e*959*eyX*I5Q*939*I5QyX*96bI3Qb69yX*!777!yX*Y6kIql"
 ."6YyX*A5q+9!,A59yX+m,YQ-myX/-iq~y";s:X:///:g;@b=/./g;$_=qq'Eli!: MV?JL1m"P\n'
;@e=/./sig;for($a=0;$a<128;){$b=ord$b[$a++];for(;$b&7;){&e(ord$e[($b-->>3)])}}

Elijah
------
#!/usr/bin/perl -w
use Shell;
print(figlet(qw(Just Another Perl Hacker)));
__END__


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

Date: Tue, 21 Aug 2001 00:52:48 GMT
From: Doug Robbins <sleddog@labradorstraits.net>
Subject: Time functions and conversion
Message-Id: <1103_998355177@duron>

time returns epoch time; gmtime converts epoch time to an array ($sec,
$min,$hour ...) localized for GMT. How can I do the reverse -- convert 
*to* epoch time for a given date in some format like June 22, 2000 8:00 
am?



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

Date: Mon, 20 Aug 2001 20:27:36 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Time functions and conversion
Message-Id: <slrn9o3ano.sqg.tadmc@tadmc26.august.net>

Doug Robbins <sleddog@labradorstraits.net> wrote:
>time returns epoch time; gmtime converts epoch time to an array ($sec,
>$min,$hour ...) localized for GMT. How can I do the reverse -- convert 
>*to* epoch time for a given date in some format like June 22, 2000 8:00 
>am?

   use Time::Local;   # has timegm(), just the ticket


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


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

Date: 20 Aug 2001 17:14:00 -0700
From: lcamargo@vesper.com.br (Nomade)
Subject: Warning using copy from File::Copy
Message-Id: <39dc7e6e.0108201614.5f572361@posting.google.com>

Hi all

I do a foreach loop in an array with file names, for each one i have
to copy to some other place, but after the 2nd interarion of the loop
i get the following message :

Use of uninitialized value at /usr/lpp/ssp/perl5/lib/File/Copy.pm line
84.


However, all files get copied with no major problems...

But how can i avoid that message ????
I dont want users buggin me, etc....

This is the code line to copy :

copy ($it_file, $dest_dir) || die "Nao foi possivel copiar o arquivo
$it_file : $!" ;

thnx in adv

Nomade


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

Date: Mon, 20 Aug 2001 23:32:26 GMT
From: "Donald B. McGee" <dbmcgee@xfi.com>
Subject: Win32:Ole Excel and Data Analysis Addin
Message-Id: <3B819E09.5B341603@xfi.com>


Has anyone had any success calling the Microsoft Excel Data Analysis
ToolPak Addin via Win32::Ole?

I'm trying to call an Excel macro via the ->Run method.  Excel starts
properly, and the macro gets called and runs -- up to the point that the
macro calls into the Data Analysis Toolpak routines.  At that point,
the macro should create a histogram chart, but the chart doesn't get
created and subsequent attempts to access the non-extant chart object of
course fail  (with VBA error 1004).

The macro runs fine when called directly from within Excel. It only
fails when called from perl.  I suspect the problem is related to
loading and intializing the addins.

Win32::Ole starts, stops, reads and writes Excel properly.  I'm manually
loading the atbvbaen, funcres and procdb xla modules.  The data for the
chart is being provided via a Microsoft Access query, and is returned
properly when called via Win32::Ole.

Any ideas?
--
Donald B. McGee




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

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


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