Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread Elaine -HFB- Ashton

drieux [[EMAIL PROTECTED]] quoth:
*>
*>On Monday, June 3, 2002, at 07:53 , Jason Frisvold wrote:
*>
*>> Am I in the dark here?  I thought the latest stable was 5.6.1?
*>>What's with 5.7.x??  I know 5.8.x is brandy new...  And 6.x is
*>>apparently going to be the "new" god to follow...
*>
*>hence why I have not worried about going to 5.7.X yet - since
*>the WayWonkaGeeks have not fully evolved to 5.8.1+

5.7.x is the development version as will 5.9.x for 5.10. Unless you're a
porter or just dinking around you shouldn't install 5.7.x on a box for
regular use.

*>but why, on the other hand, when the WayWonakGeeks moved to
*>5.7 I thought about 5.6 - and when Apple and linux red hat
*>pushed out 5.6 as their default version - I just opted
*>to move on down the road

They did this because 5.6.x is the production/stable release. No
commercial vendor and no opensource OS group has released a 5.7.x with
their product due to the fact that it is the development version. 

*>  Let's Fart Funny Files in /tmp
*>  and see what the SysAdminStaff does when
*>  they finally notice that they should have
*>  built these boxes with a 4x swap to memory

Old convention was 2x system memory, but this has waned to 1x these days
with better memory management. No box should have to swap that much unless
it is poorly configured or you have an asstard of a user who needs their
knuckles broken and dropped into a restricted shell that no longer
includes perl.

*>All of which is part and parcel of the debate about whether or
*>not one wishes to take one's risks with the new versions of perl,
*>or with the new implementations of algorithms one wishes to implement
*>in Perl Code
*>
*>Remember kiddies that the Advanced Programming in Perl book came
*>out in 1997 - and they have been trying to make perl a production
*>grade software environment. And we were all running which rev
*>of perl back then?

I still use 5.005_03 in production. If it ain't broke and you don't have a
compelling need or whiny user pestering you there's no reason to run out
and upgrade on the first day of the release of a major new version.

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Print to a NT 4.0 Printer?

2002-06-03 Thread David Oberlitner

Given: A list of MS Word .doc files

Objective: Convert the initial list to a list of PostScript .ps files.

I know how to do it manually through the Windows GUI using a PostScript 
printer driver and printing to file. I would like to learn how to automate 
the task using a Perl script.

Any suggestions will be appreciated.

Thanks,

David.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: manipulating arrays/scalars

2002-06-03 Thread John W. Krahn

Steven Massey wrote:
> 
> Hi any help appreciated...

Hello,

> I am reading a file consisting of lines with upto 2 sets if data seperated
> by :   ie
> 
> 13:fred
> 12:nancy
> lional:
> 
> each line is split into @a1 and @a2, here is my problem  - if line does not
> have @a2 as in example line 3 above, I want it to take the value from line
> 2
> ie - 12
> here is my code that trys to do
> 
> =
> foreach $D (@FILES)
> 
> open(MYFILE2, "$TMP/$D") || die "Cannot open $D: $!\n";
> chomp (@source=);
> 
> @a1=(); @a2=();
> $srclen=@source;
> for ($a=0;$a<$srclen;$a++)
> 
> ($a1[$a], $a2[$a])=split(/:/, $source[$a]);
> if (grep (!/^[0-9]/, $a1[$a]))
> 
>     help what needs to go here ? #
> }
> }
> close(MYFILE2);
> }


Here is one way to do it:


local @ARGV = map "$TMP/$_", @FILES;

my $number;
while ( <> ) {
chomp;
if ( /^(\d+):(.+)$/ ) {
print "Name: $2\nNumber: $1\n";
$number = $1;
}
elsif ( /([^:]+)/ and defined $number ) {
print "Name: $1\nNumber: $number\n";
}
elsif ( eof ) {
$number = undef;
}
else {
print "Error: no data found!\n";
}
}

__END__


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: switch/case foo - a quandery

2002-06-03 Thread Peter Scott

At 11:19 AM 6/3/02 -0700, drieux wrote:
>[ name withheld to protect the innocent.]
>[..]
>> From reading your response, below, I take it that you don't think very 
>> highly of the SWITCH command?  Can you elaborate just a little for me as 
>> to why?  You see, I've dabbled in other languages (most notably VB and 
>> BASH shell scripting) and I've gotten quite used to having a CASE or 
>> SWITCH type statement at my disposal, and, to be honest, I was surprised 
>> that I didn't have it in Perl.  I guess having "grown up" using it, I 
>> didn't know why I shouldn't...
>[..]
>
>I think almost everyone who comes to perl has that 'crisis of faith'
>moment when they review
>
> perldoc -q switch
>
>and wonder - ok, so why no switch/case statement, because, well I
>have always done it that way

For those who haven't seen it,

 http://search.cpan.org/search?dist=Switch

is officially blessed as a Good Way To Do It.  And it approaches the 
mind-bending implementation planned for Perl 6.

--
Peter Scott
Pacific Systems Design TechnologiesBoston Perl Classes in July:
http://www.perldebugged.com/   http://stemsystems.com/class/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: manipulating arrays/scalars

2002-06-03 Thread Shishir K. Singh

How about writing it like this ??
Assuming 
a) The numeric value is in 1st col and the text in 2nd col (after :)
b) Wherever numeric value is not present, the text is in the first column.  
c) The numeric value needs to be picked up from the last successful read of the 
numeric value if not already defined
   in the input. 
##

open(MYFILE2, " < $TMP/$D") || die "Cannot open $D: $!\n";

my @elem = ();
my $storage = " "; # default value is space just in case your first record itself is 
not okay!!

while () {
chomp;
@elem = split /:/;
if ($elem[1]) {
  push (@a1, $elem[0]);
  push (@a2, $elem[1]);
  $storage = $elem[0];

} else {
  push (@a1, $storage);
  push (@a2, $elem[0]);
}

}
close(MYFILE2);

 print $_, "\n" for @a1;
 print $_, "\n" for @a2;

__END__
##
it prints 

13
12
12
fred
nancy
lional


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 5:25 PM
To: [EMAIL PROTECTED]
Subject: manipulating arrays/scalars


Hi any help appreciated...
I am reading a file consisting of lines with upto 2 sets if data seperated
by :   ie

13:fred
12:nancy
lional:

each line is split into @a1 and @a2, here is my problem  - if line does not
have @a2 as in example line 3 above, I want it to take the value from line
2
ie - 12
here is my code that trys to do

=
foreach $D (@FILES)

open(MYFILE2, "$TMP/$D") || die "Cannot open $D: $!\n";
chomp (@source=);

@a1=(); @a2=();
$srclen=@source;
for ($a=0;$a<$srclen;$a++)

($a1[$a], $a2[$a])=split(/:/, $source[$a]);
if (grep (!/^[0-9]/, $a1[$a]))

    help what needs to go here ? #
}
}
close(MYFILE2);
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: getting a url with perl, the url_get library?

2002-06-03 Thread Beau E. Cox

Hi -
Check out LWP::UserAgent and HTML::TokeParser.
The following script gets my SETI@home stats. Flesh it
out with you token parsing, better error handling, etc.

Aloha => Beau.

use strict;
use warnings;
use LWP::UserAgent;
use HTML::TokeParser;

my $url =
"http://setiathome.ssl.berkeley.edu/cgi-bin/cgi?email=beau\@aloha.com&cmd=us
er_stats_new";

my $agent = new LWP::UserAgent ();
$agent->proxy (['http'] => 'http://10.10.10.1:8080');
my $request = new HTTP::Request ('GET' => $url);
my $response = $agent->request ($request);

die "Error: " . $response->status_line () . "\n"
unless $response->is_success ();

my $document = $response->content ();
my $page = new HTML::TokeParser (\$document);
while (my $token = $page->get_token ()) {
my $type = shift (@{$token});
$_ = shift (@{$token});
if ($type eq "T") {
print $_;
}
}

-Original Message-
From: david [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 10:22 AM
To: [EMAIL PROTECTED]
Subject: getting a url with perl, the url_get library?


There used to be a url_get library, is there something else now? i couldn't
find anything on CPAN, this is a http protocol issue right? I just want to
have a user enter a url on a form page, then crawl that url for the
specified
text string. Thank you

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: getting a url with perl, the url_get library?

2002-06-03 Thread Kevin Meltzer

Look at the LWP::* modules (LWP::UserAgent, or LWP::Simple, in
particular). It comes with the libnet distro on the CPAN.

Cheers,
Kevin

On Mon, Jun 03, 2002 at 04:22:17PM -0400, david ([EMAIL PROTECTED]) said 
something similar to:
> There used to be a url_get library, is there something else now? i couldn't 
> find anything on CPAN, this is a http protocol issue right? I just want to 
> have a user enter a url on a form page, then crawl that url for the specified 
> text string. Thank you
> 

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
I hate it when my foot falls asleep during the day because that
means it's going to be up all night.
-- Steven Wright

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl DBI vs SQLPLUS

2002-06-03 Thread Joseph Bajin

[EMAIL PROTECTED] wrote:

>>-Original Message-
>>From: Joseph Bajin [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, June 03, 2002 2:34 PM
>>To: [EMAIL PROTECTED]
>>Subject: Perl DBI vs SQLPLUS 
>>
>>
>>Got a question for you guys out there.
>>
>>I currently have a list of records that I need to search for in a 
>>mult-db that we have. I was wondering if perl would be faster 
>>to process 
>>or stick with my .ksh script that uses sqlplus. Here's how 
>>the current 
>>setup is
>>
>>cat input file and read for record #
>>
>>sqlplus into db1 and do a select statement to find what db that the 
>>account is located in. (This db just contains basic info on where the 
>>account is actually stored)
>>
>>exit sql plus
>>
>>open another sqlplus session to db that was found in previous select 
>>statement.
>>
>>select out data needed and write to a file.
>>
>>exit sqlplus
>>
>>Do the loop again.
>>
>>
>>I needed to process about 8000 records today. It would get about 30% 
>>through and the process would just stop. Don't know if it's a buffer 
>>issue (that was a suggestion) or if perl because it will directly 
>>connect to the DB would be better.
>>
>>Got any ideas.
>>
>
>Can't say why it's hanging, but using DBI should be faster than 
>what you're doing, because you can keep a database connection 
>open (at least on db1). How many total databases are there?
>
Total of 8 databases. The first database is used only to reference where 
the rest of the data is located.  ie (record is located on Db4, and so on. )

Thanks Joe



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




manipulating arrays/scalars

2002-06-03 Thread Steven_Massey

Hi any help appreciated...
I am reading a file consisting of lines with upto 2 sets if data seperated
by :   ie

13:fred
12:nancy
lional:

each line is split into @a1 and @a2, here is my problem  - if line does not
have @a2 as in example line 3 above, I want it to take the value from line
2
ie - 12
here is my code that trys to do

=
foreach $D (@FILES)

open(MYFILE2, "$TMP/$D") || die "Cannot open $D: $!\n";
chomp (@source=);

@a1=(); @a2=();
$srclen=@source;
for ($a=0;$a<$srclen;$a++)

($a1[$a], $a2[$a])=split(/:/, $source[$a]);
if (grep (!/^[0-9]/, $a1[$a]))

    help what needs to go here ? #
}
}
close(MYFILE2);
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




getting a url with perl, the url_get library?

2002-06-03 Thread david

There used to be a url_get library, is there something else now? i couldn't 
find anything on CPAN, this is a http protocol issue right? I just want to 
have a user enter a url on a form page, then crawl that url for the specified 
text string. Thank you

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: dbi connection problem with @INC

2002-06-03 Thread tom poe

On Monday 03 June 2002 12:54, Michael Fowler wrote:

> Copying the files over manually is usually a bad idea.  Even if you do
> manage to get all of the files (which you probably didn't, I will explain
> later), the binary portions are probably not going to be compatible from
> one version of perl to the next.  perl can be compiled to be
> binary-compatible, but if so it should probably have also been compiled to
> look in the 5.6.0 directories.

Hi:  Yep.  Exactly.  What was fun, was, finally connecting the dots enough to 
reinstall DBI and DBD::Pg from the beginning, and hoping it would install 
into 5.6.1.  Did.  Life is good.  Question.  Would I have been able to 
explicitly direct install to occur in the perl5.6.1 during the install phase? 
 Is it a matter of editing the Makefile.PL?
Thanks,
Tom

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




removing duplicate files in a directory

2002-06-03 Thread Miller, Jeremy T.

I have a reporting program that outputs ASCII reports into a folder.  If a
certain report is run more that once, the old report is not written over,
but rather, a number appended to the end of the name.

For example, I may have a report:  HTTPLogWed

If someone runs this report a second time, the new report name will be
"HTTPLogWed1".  If someone runs the report a third time, the name will be
"HTTPLogWed2".  Their file size will always be the same (e.g., 32 kb) for
the duplicate files.

What I would like to do is have a perl script look in a folder, look for
filenames that have the same name, with the exception of the last character
AND if the file's size is the same, delete the duplicate files.

So, a folder having these files:

HTTPLogWed  32 kb
HTTPLogWed1  32 kb
HTTPLogWed2  32 kb
HTTPLogWed  42 kb

The script would delete files 2 and 3, but would leave file 4 because the
file size is different than file 1.

Can Perl do this?  If so, does anyone have any advice/code/hints?

Thanks in advance

Jeremy T. Miller
Software Engineer - DynCorp
Centers for Disease Control
Atlanta, GA  30333
(404) 639-1883



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: dbi connection problem with @INC

2002-06-03 Thread Michael Fowler

On Sat, Jun 01, 2002 at 05:58:58PM -0700, tom poe wrote:
> I copied the dirs/files to the upgrade 5.6.1, but no change, so I go, OK, 
> I'll make sure Pg.pm is copied over, then I'll get rid of the old one, and 
> this is just weird.  Anyone have a thought about This?

Copying the files over manually is usually a bad idea.  Even if you do
manage to get all of the files (which you probably didn't, I will explain
later), the binary portions are probably not going to be compatible from one
version of perl to the next.  perl can be compiled to be binary-compatible,
but if so it should probably have also been compiled to look in the 5.6.0
directories.

Regardless, have you tried installing DBD::Pg from scratch?  That would be
the safest and most reliable method.


[other shell commands snipped]
> root@aether:/usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD > locate DBD/Pg.pm
> /usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD/Pg.pm
> root@aether:/usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD > exit
> exit
> tompoe@aether:/usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD > locate Pg.pm
> /usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD/Pg.pm
> /usr/lib/perl5/site_perl/5.6.0/i586-linux/Pg.pm
> tompoe@aether:/usr/lib/perl5/site_perl/5.6.0/i586-linux/DBD >

I'm not sure exactly what you were trying to show with your shell commands. 
Perhaps that DBD::Pg does exist.  Some commentary would've been useful.

Regardless, the .pm is only one portion of the DBD::Pg install.  There is
also a binary portion, probably installed in
/usr/lib/perl5/site_perl/5.6.0/i586-linux/auto/DBD/Pg.  You could try
copying those files over as well, but, as I mentioned above, it'd be safer
and more reliable to simply reinstall.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl DBI vs SQLPLUS

2002-06-03 Thread Bob Showalter

> -Original Message-
> From: Joseph Bajin [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 2:34 PM
> To: [EMAIL PROTECTED]
> Subject: Perl DBI vs SQLPLUS 
> 
> 
> Got a question for you guys out there.
> 
> I currently have a list of records that I need to search for in a 
> mult-db that we have. I was wondering if perl would be faster 
> to process 
> or stick with my .ksh script that uses sqlplus. Here's how 
> the current 
> setup is
> 
> cat input file and read for record #
> 
> sqlplus into db1 and do a select statement to find what db that the 
> account is located in. (This db just contains basic info on where the 
> account is actually stored)
> 
> exit sql plus
> 
> open another sqlplus session to db that was found in previous select 
> statement.
> 
> select out data needed and write to a file.
> 
> exit sqlplus
> 
> Do the loop again.
> 
> 
> I needed to process about 8000 records today. It would get about 30% 
> through and the process would just stop. Don't know if it's a buffer 
> issue (that was a suggestion) or if perl because it will directly 
> connect to the DB would be better.
> 
> Got any ideas.

Can't say why it's hanging, but using DBI should be faster than 
what you're doing, because you can keep a database connection 
open (at least on db1). How many total databases are there?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: but what about 5.5.3 was Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 10:08 , David T-G wrote:
[..]
> % I think a lot of us were pushing production perl code out the
> % door with 5.5.3 - because we needed the features that were there
>
> Whoops!  Sorry; the change to this numbering system was with 5.6; 5.005
> was production, too.  Read the 5.6.1 readmes :-)

whew I was afeard I was getting prematurely 
uh, geeze, oh FreMonge, I'll remember soon what it
was that I might be getting prematurely something or other

I left a note around here documenting which things
I was suppose to be remembering were the things

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl DBI vs SQLPLUS

2002-06-03 Thread Joseph Bajin

Got a question for you guys out there.

I currently have a list of records that I need to search for in a 
mult-db that we have. I was wondering if perl would be faster to process 
or stick with my .ksh script that uses sqlplus. Here's how the current 
setup is

cat input file and read for record #

sqlplus into db1 and do a select statement to find what db that the 
account is located in. (This db just contains basic info on where the 
account is actually stored)

exit sql plus

open another sqlplus session to db that was found in previous select 
statement.

select out data needed and write to a file.

exit sqlplus

Do the loop again.


I needed to process about 8000 records today. It would get about 30% 
through and the process would just stop. Don't know if it's a buffer 
issue (that was a suggestion) or if perl because it will directly 
connect to the DB would be better.

Got any ideas.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




switch/case foo - a quandery

2002-06-03 Thread drieux


[ name withheld to protect the innocent.]
[..]
> From reading your response, below, I take it that you don't think very 
> highly of the SWITCH command?  Can you elaborate just a little for me as 
> to why?  You see, I've dabbled in other languages (most notably VB and 
> BASH shell scripting) and I've gotten quite used to having a CASE or 
> SWITCH type statement at my disposal, and, to be honest, I was surprised 
> that I didn't have it in Perl.  I guess having "grown up" using it, I 
> didn't know why I shouldn't... 
[..]

I think almost everyone who comes to perl has that 'crisis of faith'
moment when they review

perldoc -q switch

and wonder - ok, so why no switch/case statement, because, well I
have always done it that way

let me expose two ways of solving a common problem -

cf - http://www.wetware.com/drieux/pbl/bloopers/hash_v_switch.txt

given that I wrote both, and have done both, I rather doubt that
anyone can blame me for, well, having issues with me.

Let us begin with assuming that we adopted the 'switch/case' class
of assumption for 'code maintenance' related issues - such as not
wanting to write all of those if/elsif/else cases all the way down.

Likewise let us assume that one has not done the brainDeath trick
of splattering switch/cases through the code, in lieu of 'racking
and stacking' all of the thing related to 'one key' in the same place.

I put that forward because it took us a while to finally understand
the amount of work the coders 'had to do' to change 'verbs' in the
language - because rather than the simpler

switch($verb) {

doMe : resolveDoMe(@arglist) .

.
default: HurlFurBall("there is no default for this");
}

They had MULTIPLE places in their code where they would have to
edit the text to insert a New Verb Rather than the really
cheasy solution of updating their make file to include

resolveDoNextVerb.c

and hacking

switchBox.c

to look elsewhere for the function that deal with the DoNextVerb foo

{ we presume that you have already read:
  http://www.wetware.com/drieux/pbl/misc/HashSwitch.txt
where you will note the complex software maintenance problem here
of WRITE the Sub - add it to the list of actions, get on with your life. }

{ and for the OO pietist - yes, without argument, I agree absolutely one
can totally make a bollocked mess of the multiple class inheritance 
problems
that creep in and make classes brittle much faster and with more penache
than old dog proceduralists can ever dream about. }

At which point we are really down to the simpler set of problems
about dealing with the 'native data types' of a given computer
language, and how to work and play well with them

if you look at
http://www.wetware.com/drieux/CS/Proj/dump2disk/dumpToDisk.html
you will find a 'stoopid awk and shell problem' - in which I do a
similar type of switch/case in /bin/sh - that passes the RegEx to
gawk - to grovel through $FSTAB - so yes, we have all done stuff
that 'had to get done' - and the worst of the lot are the bits
of Code Skank we used because

a2p

generated it for us, and we didn't stop to look at how STONED that
really looked in perl.

the details of the argument by analogy:

http://www.wetware.com/drieux/pbl/bloopers/slovenA2P.txt

So technically no - I really can not defend my argument, perse,
assuming of course that you are implementing 'switch/case' constructs
in an appropriate manner using solid software development methods

{ especially if you have the time in your life to curl up with the
perl internals for those intimate candle lit dinners with the current
stable release of the software code itself, a little fondling and groping
of the core components and data type primatives. and of course
your management happens to have staffed up to have enough coders on
hand, as well as budgeted in the time to do an appropriate data analysis
of the customer's need, that generates stable and extensible data models
that simplify the process
like as if that's gonna happen any time soon...}

If on the other hand you grabbed for a switch/case statement because
that is the way that we have always done things - you may wish to
step back and think about whether 'doing it the same way we have always 
done it'
will be any more effective in the long run for you - as it was the
fifth time the rangers helo'd in on a suspect site in Mogadishu


ciao
drieux

---

I'd think outside of the box, if Management
ever had the cash to buy me a box to begin with


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Day Month Issues

2002-06-03 Thread Bob Showalter

> -Original Message-
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 1:55 PM
> To: Perl
> Subject: Day Month Issues
> 
> 
> I am getting the following error when I execute my script. It is not
> erroring out nor is it not working as I think it should.  I 
> am just curious
> why this is happening.  Any Ideas?
> 
> Thanks
> Lance
> 
> CODE:
> 
>  
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
> 
> ERROR:
> 
> Name "main::mday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::sec" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::isdst" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl
> bin\outlook.pl line 15.
> Name "main::year" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::mon" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::wday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::yday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.

They're warnings, not errors. The warning is that you've
used a variable like $mday, but not used it anywhere else
in your script, and Perl thinks you may be making a typo.

(It's good that you have -w turned on, but you also need
"use strict;")

Ways to get rid of the error:

1. Use "my" to declare the variables.

  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

2. Use undef in place of the variables you aren't using:

  (undef,$min,$hour,undef,undef,undef,undef,undef,undef)=localtime(time);

  or just (you can remove trailing unused elements):

  (undef,$min,$hour)=localtime(time);

3. or even better, use an array slice:

  ($min, $hour) = (localtime)[1,2];

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Day Month Issues

2002-06-03 Thread Shishir K. Singh

try putting "my" before the declaration

my  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

 


-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 1:55 PM
To: Perl
Subject: Day Month Issues


I am getting the following error when I execute my script. It is not
erroring out nor is it not working as I think it should.  I am just curious
why this is happening.  Any Ideas?

Thanks
Lance

CODE:

 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

ERROR:

Name "main::mday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::sec" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::isdst" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl
bin\outlook.pl line 15.
Name "main::year" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::mon" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::wday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::yday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Day Month Issues

2002-06-03 Thread Hanson, Robert

You are running with warnings turned on, and Perl is just warning you that
you *might* have made a mistake by creating a variable then not using it.

In this case it isn't a mistake, but it will still warn you about it.

Snippet from perldoc perlrun

-w   prints warnings about variable names
 that are mentioned only once...


You can get around it by either turn off warnings, or not creating those
variables.  This should be ok...

my @date = localtime(time);
my $min = $date[1];
my $hour = $date[2];

etc, only creating variables that you are actually going to use.

Rob

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 1:55 PM
To: Perl
Subject: Day Month Issues


I am getting the following error when I execute my script. It is not
erroring out nor is it not working as I think it should.  I am just curious
why this is happening.  Any Ideas?

Thanks
Lance

CODE:

 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

ERROR:

Name "main::mday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::sec" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::isdst" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl
bin\outlook.pl line 15.
Name "main::year" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::mon" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::wday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::yday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Day Month Issues

2002-06-03 Thread Nikola Janceski

you have -w or use warnings; You should only use a slice of the info you
want.
from the warnings I see you want min and hour.
use:
($min,$hour)= ( localtime(time) )[1,2]; # no warnings



> -Original Message-
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 1:55 PM
> To: Perl
> Subject: Day Month Issues
> 
> 
> I am getting the following error when I execute my script. It is not
> erroring out nor is it not working as I think it should.  I 
> am just curious
> why this is happening.  Any Ideas?
> 
> Thanks
> Lance
> 
> CODE:
> 
>  
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
> 
> ERROR:
> 
> Name "main::mday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::sec" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::isdst" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl
> bin\outlook.pl line 15.
> Name "main::year" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::mon" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::wday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::yday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Day Month Issues

2002-06-03 Thread Lance Prais

I am getting the following error when I execute my script. It is not
erroring out nor is it not working as I think it should.  I am just curious
why this is happening.  Any Ideas?

Thanks
Lance

CODE:

 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

ERROR:

Name "main::mday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::sec" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::isdst" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl
bin\outlook.pl line 15.
Name "main::year" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::mon" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\b
n\outlook.pl line 15.
Name "main::wday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.
Name "main::yday" used only once: possible typo at
E:\sea621\siebsrvr\BIN\Perl\
in\outlook.pl line 15.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Tail call optimization

2002-06-03 Thread Tagore Smith

Jenda Krynicky wrote:


> I believe they meant "goto &NAME".



> This way perl doesn't create a new record in the call stack every
> time you "call" the _fib().
> As you can see if you comment out the return in fib_() and remove
> the comment from "croak ..." and "use Carp;". (die() with stack
> print).
>
> See
> perldoc -f goto

Thanks :). That's great. I don't use goto much, except for a couple of very
specific situations, so I hadn't  read the docs for goto. It seems I missed
a very interesting beast in goto &NAME. In fact , I sent a friend of mine
some code recently that would have been improved in one place by its use.

But I still have a question :). As I understand it when tail-call
optimization is done automatically there are two advantages. One is that the
stack doesn't grow out of control, so that you don't have to worry about
blowing it up if you recurse very deeply. The other is that the overhead of
successive calls is eliminated. In theory (but, I think, often not in
practice) the optimized routine should be as efficient as the equivalent
iterative routine. Using goto &name has the first advantage, but does it
have the second? That is, does goto &NAME have the same overhead as a normal
call?

Does anyone write this kind of recursive function regularly? I mean, is it
idiomatic in the more rarefied Perl circles? Or is it better (from a style
point of view) to use iterative constructs even in places where recursion is
more natural, but tail-call optimization would be required?

Thanks
Tagore Smith


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Conditional Operator && STDIN

2002-06-03 Thread bob ackerman


On Monday, June 3, 2002, at 10:45  AM, bob ackerman wrote:

>
> On Monday, June 3, 2002, at 10:37  AM, Jeff 'japhy' Pinyan wrote:
>
>> On Jun 3, bob ackerman said:
>>
   @ARGV = "< $filename" if $opt_f;
>>>
>>> why '<' ? isn't '$filename' enough for get '<>' to open and read from 
>>> that
>>> file?
>>
>> I feel safer when I explicitly state the mode.  Unless you want the user
>> to put 'foo |' as the filename (that is, the output of a pipe), then you
>> should use the file mode in your program explicitly.
>
> i didn't realize that the 'while(<>')' would respect modes. i thought it 
> was only for input.
> good to know.

i meant 'while(<>)'
so how do i find documentation on '<>' or 'magic'? anyway?

>
>> --
>> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  
>> http://www.pobox.com/~japhy/
>> RPI Acacia brother #734   http://www.perlmonks.org/   
>> http://www.cpan.org/
>> ** Look for "Regular Expressions in Perl" published by Manning, in 2002 
>> *
>> *
>>  what does y/// stand for?   why, yansliterate of 
>> course.
>> [  I'm looking for programming work.  If you like my work, let me know. 
>>  ]
>>
>
>
> -- To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Conditional Operator && STDIN

2002-06-03 Thread Nikola Janceski

I am sure Jeff has a bunch of files lying around named:
>haha
|-what?

and good old

`rm -rf *`

I put that last one in my home directory just to scare the beejesus off the
sysadmin guys.
If you want to make it just use:

touch '`rm -rf *`'


> -Original Message-
> From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 1:38 PM
> To: bob ackerman
> Cc: [EMAIL PROTECTED]
> Subject: Re: Conditional Operator && STDIN
> 
> 
> On Jun 3, bob ackerman said:
> 
> >>   @ARGV = "< $filename" if $opt_f;
> >
> >why '<' ? isn't '$filename' enough for get '<>' to open and 
> read from that 
> >file?
> 
> I feel safer when I explicitly state the mode.  Unless you 
> want the user
> to put 'foo |' as the filename (that is, the output of a 
> pipe), then you
> should use the file mode in your program explicitly.
> 
> -- 
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  
> http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   
http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Conditional Operator && STDIN

2002-06-03 Thread bob ackerman


On Monday, June 3, 2002, at 10:37  AM, Jeff 'japhy' Pinyan wrote:

> On Jun 3, bob ackerman said:
>
>>>   @ARGV = "< $filename" if $opt_f;
>>
>> why '<' ? isn't '$filename' enough for get '<>' to open and read from 
>> that
>> file?
>
> I feel safer when I explicitly state the mode.  Unless you want the user
> to put 'foo |' as the filename (that is, the output of a pipe), then you
> should use the file mode in your program explicitly.

i didn't realize that the 'while(<>')' would respect modes. i thought it 
was only for input.
good to know.

> --
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
> ** Look for "Regular Expressions in Perl" published by Manning, in 2002 *
> *
>  what does y/// stand for?   why, yansliterate of course.
> [  I'm looking for programming work.  If you like my work, let me know.  
> ]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Conditional Operator && STDIN

2002-06-03 Thread Jeff 'japhy' Pinyan

On Jun 3, bob ackerman said:

>>   @ARGV = "< $filename" if $opt_f;
>
>why '<' ? isn't '$filename' enough for get '<>' to open and read from that 
>file?

I feel safer when I explicitly state the mode.  Unless you want the user
to put 'foo |' as the filename (that is, the output of a pipe), then you
should use the file mode in your program explicitly.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Weekly posting statistics - 22/2002

2002-06-03 Thread Felix Geerinckx

Weekly posting statistics for perl.beginners - week 22 of 2002.

>From Monday 2002-05-27 to Sunday 2002-06-02 there were 
478 articles posted (25031 lines) by 117 authors, giving an average 
4.09 articles per author, and an average article length of 52 lpa.
The average number of articles per day was 68.

There were 97 (20%) original articles, and 381 (80%) replies
(articles that started with 'RE:' in their subject line).

45 (38%) authors posted only one article.

The authors top-10 by number of articles is as follows:

 All/Ori Lines  lpa  Author

  49/52496   50  [EMAIL PROTECTED] (Drieux)
  27/2 691   25  [EMAIL PROTECTED] (Felix Geerinckx)
  22/11634   74  [EMAIL PROTECTED] (Shishir K. Singh)
  20/1 987   49  [EMAIL PROTECTED] (Sudarsan Raghavan)
  20/0 883   44  [EMAIL PROTECTED] (Janek Schleicher)
  19/01411   74  [EMAIL PROTECTED] (David...
  18/01333   74  [EMAIL PROTECTED] (Jonathan e. paton)
  13/31156   88  [EMAIL PROTECTED] (Bryan R Harris)
  13/9 912   70  [EMAIL PROTECTED] (Lance Prais)
  13/0 805   61  [EMAIL PROTECTED] (Nikola Janceski)


-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: but what about 5.5.3 was Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread David T-G

drieux --

...and then drieux said...
% 
% On Monday, June 3, 2002, at 08:43 , David T-G wrote:
% [..]
% >If you want to stay "up to speed", all you have to have are 
% >N..highest
% >and you're there, and you don't have to worry about an interface changing
% >or something breaking from one day to the next as you would with good old
% >(well, new :-) N..whatever.
% [..]
% 
% my complements on reminding us all that odd things are just ODD...

*grin*


% 
% I think a lot of us were pushing production perl code out the
% door with 5.5.3 - because we needed the features that were there

Whoops!  Sorry; the change to this numbering system was with 5.6; 5.005
was production, too.  Read the 5.6.1 readmes :-)


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg25315/pgp0.pgp
Description: PGP signature


Re: Conditional Operator && STDIN

2002-06-03 Thread bob ackerman


On Monday, June 3, 2002, at 09:27  AM, Jeff 'japhy' Pinyan wrote:

> On Jun 3, Balint, Jess said:
>
>> Hello all. I am working on my script, and I would like to be able to use
>> STDIN as a filehandle input unless a filename is specified. I have used 
>> the
>> getopt for the filename, let's say $opt_f.
>
> I would use the magic of @ARGV and <>, and do this:
>
>   @ARGV = "< $filename" if $opt_f;
>   while (<>) {
> # do something with $_
>   }

why '<' ? isn't '$filename' enough for get '<>' to open and read from that 
file?

> <> reads from the filenames listed in @ARGV, and if @ARGV is empty (which
> I'm assuming it would be) then <> reads from STDIN.
>
> Another approach:
>
>   if ($opt_f) {
> open INPUT, "< $filename" or die "can't read $filename: $!";
>   }
>   else {
> *INPUT = *STDIN;  # like what you were trying
>   }
>
> --
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
> ** Look for "Regular Expressions in Perl" published by Manning, in 2002 *
> *
>  what does y/// stand for?   why, yansliterate of course.
> [  I'm looking for programming work.  If you like my work, let me know.  
> ]
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: but what about 5.5.3 was Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread Nikola Janceski

All this means is that we are that much closer to Perl 6, or is it?
Either way, I get that warm feeling deep inside when I think about the
wonders of Perl 6.

Nikola Janceski

If I had only known. I would have become a locksmith.
-- Albert Einstein (1879-1955) 



> -Original Message-
> From: drieux [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 12:24 PM
> To: begin begin
> Subject: but what about 5.5.3 was Re: Perl 5.8.0rc1 
> changelogs. What are
> you most excited about?
> 
> 
> 
> On Monday, June 3, 2002, at 08:43 , David T-G wrote:
> [..]
> > If you want to stay "up to speed", all you have to have are 
> > N..highest
> > and you're there, and you don't have to worry about an 
> interface changing
> > or something breaking from one day to the next as you would 
> with good old
> > (well, new :-) N..whatever.
> [..]
> 
> my complements on reminding us all that odd things are just ODD...
> 
> I think a lot of us were pushing production perl code out the
> door with 5.5.3 - because we needed the features that were there
> 
> BUT! I think I am pleased NOT to have known that we were putting
> the production release at risk by using the 'developer snapshot'
> version of the perl...
> 
> Which probably explains why I feel safer with 5.6.1 at this point...
> 
> ciao
> drieux
> 
> ---
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Conditional Operator && STDIN

2002-06-03 Thread Jeff 'japhy' Pinyan

On Jun 3, Balint, Jess said:

>Hello all. I am working on my script, and I would like to be able to use
>STDIN as a filehandle input unless a filename is specified. I have used the
>getopt for the filename, let's say $opt_f.

I would use the magic of @ARGV and <>, and do this:

  @ARGV = "< $filename" if $opt_f;
  while (<>) {
# do something with $_
  }

<> reads from the filenames listed in @ARGV, and if @ARGV is empty (which
I'm assuming it would be) then <> reads from STDIN.

Another approach:

  if ($opt_f) {
open INPUT, "< $filename" or die "can't read $filename: $!";
  }
  else {
*INPUT = *STDIN;  # like what you were trying
  }

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




but what about 5.5.3 was Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 08:43 , David T-G wrote:
[..]
> If you want to stay "up to speed", all you have to have are 
> N..highest
> and you're there, and you don't have to worry about an interface changing
> or something breaking from one day to the next as you would with good old
> (well, new :-) N..whatever.
[..]

my complements on reminding us all that odd things are just ODD...

I think a lot of us were pushing production perl code out the
door with 5.5.3 - because we needed the features that were there

BUT! I think I am pleased NOT to have known that we were putting
the production release at risk by using the 'developer snapshot'
version of the perl...

Which probably explains why I feel safer with 5.6.1 at this point...

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Conditional Operator && STDIN

2002-06-03 Thread Balint, Jess

Hello all. I am working on my script, and I would like to be able to use
STDIN as a filehandle input unless a filename is specified. I have used the
getopt for the filename, let's say $opt_f.

I thought I would do something like this:

( $opt_f ) ? open( INFILE, "$opt_f" ) or die( "Can't open...) : INFILE =
STDIN;

while(){ ... }

I know that's really stupid, but that's all that I could think of. What's
the correct way to do this?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread David T-G

Jason, et al --

...and then drieux said...
% 
% On Monday, June 3, 2002, at 07:53 , Jason Frisvold wrote:
% 
% > Am I in the dark here?  I thought the latest stable was 5.6.1?
% >What's with 5.7.x??  I know 5.8.x is brandy new...  And 6.x is
% >apparently going to be the "new" god to follow...

The short answer to your question is that the perl folks have adopted the
linux kernel method of version numbering, where you have 

  major.minor.patch

to describe a particular "snapshot".  The major version is pretty
obvious, and the patch bit is pretty obvious, too.  The trick is the
middle bit: when minor is even, it's a stable release for the world; when
minor is odd, it's a development release that isn't necessarily unstable
but is definitely where the playing is going on.

If you want to stay "up to speed", all you have to have are N..highest
and you're there, and you don't have to worry about an interface changing 
or something breaking from one day to the next as you would with good old
(well, new :-) N..whatever.


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg25309/pgp0.pgp
Description: PGP signature


Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 07:53 , Jason Frisvold wrote:

>   Am I in the dark here?  I thought the latest stable was 5.6.1?
> What's with 5.7.x??  I know 5.8.x is brandy new...  And 6.x is
> apparently going to be the "new" god to follow...

hence why I have not worried about going to 5.7.X yet - since
the WayWonkaGeeks have not fully evolved to 5.8.1+

but why, on the other hand, when the WayWonakGeeks moved to
5.7 I thought about 5.6 - and when Apple and linux red hat
pushed out 5.6 as their default version - I just opted
to move on down the road

What you want to read for are the

X is deprecated in  and will be removed by 

as those are the things that you have to resolve are you
really that committed to doing in the first place.

The fun here of course is the question of whether having
a canonical 'in perl' "switch" really is 'the right thing' -
just as one will have to work out whether or not being able
to work around the IO::Handle solution to gin up $tmpFileHandles
that you wish to breed is progress or merely

Let's Fart Funny Files in /tmp
and see what the SysAdminStaff does when
they finally notice that they should have
built these boxes with a 4x swap to memory
ratio - and hence should also have learned about swapadd
command so that they would have an alternative swap device
ready to protect against silly coders farting temp files on
the default swap device for the system - so as to protect
them from running into the 'out of swap space' crisis moments
which most of them do not natively write code to protect
themselves from doing to themselves...

All of which is part and parcel of the debate about whether or
not one wishes to take one's risks with the new versions of perl,
or with the new implementations of algorithms one wishes to implement
in Perl Code

Remember kiddies that the Advanced Programming in Perl book came
out in 1997 - and they have been trying to make perl a production
grade software environment. And we were all running which rev
of perl back then?

ciao
drieux

---

"But hey, I can implement that in /bin/sh since all I have
to do is use mknod to create a named set of FIFO in the file system"


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




remove the stop words

2002-06-03 Thread Ying Liu


Hi,

Is there a good method to do this? I need to remove the stop words from the comment 
field of every record. There are about 20,000 records. The comments look like this: 

Yersinia pestis strain Nepal (aka CDC 516 or 369 isolated from human) 16S-23S in 
tergenic region amplified with 16UNIX and 23UNII primers. Sequencing primers were UNI1 
and UNI2   5/25/99^^

I should remove 'and' 'in' 'with' 'The', etc. I have set up the stop words array. Is 
there a efficient way to do this?

Thanks,

Ying Liu

 



-
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup


Re: Checking the status of sendmail

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 07:17 , Chuck Tomasi wrote:
[..]
> I've got a program that regularly sends mail to people, however once in a
> while I get a report from someone stating that they missed a piece of
> mail.

you may wish to check if there is a user::Headspace upgrade
you can install in these folks sometimes they do bad things...

[..]
>
> # &ErrorMsg includes an exit()
> open(F_MAIL, "|/usr/sbin/sendmail -t") || &ErrorMsg("Cannot open mail");
> print F_MAIL "To: $user->{'Name'} <$user->{'Email'}>\n";
> print F_MAIL "From: $admin->{'Name'} <$admin->{'Email'}\n";
> print F_MAIL "Subject: Message Updated\n";
> print F_MAIL "\n";
> print F_MAIL $msg->{'Text'};
> print F_MAIL "\n";
> close(F_MAIL);
[..]

you may wish to check out:

http://search.cpan.org/search?dist=MailTools

as a way to break out of the traditional 'popen()' approach
of calling out 'sendmail' directly Since this way would
move you into getting a bit closer to the Net::SMTP side of
the game - where you can make sure that you and the smtp server
are in agreement about how things should be done

If you are HyperAngstLaden - you could retreat to Net::CMD
and do more of the leg work yourself - and know with a
higher degree of certainty that you and the smtp server
are actually all warm and fuzzy about yourside of the game.

the problem then comes back to -

if the bad user does bad things with their MUA
then
you have little recourse
unless(bcc'd all mail to self);

Since having the data queued in mailboxes for users to pick up
doesn't protect you from the user who highlighted and purged
multiple email from their MUA - including the one that they
are now saying they never got

at which point you have to deal with a big ugly email mailbox
of defensive email clutter - which is reasonably managed with
the MailTools suite - and can be filtered and managed - including,
if you are up to the game - writing the DBI stuff that would be
able to inventory these bcc's for safety sake but that way
leads to the data retention problem of when to purge your DB
of safety emails since clearly the day that you purge an
entry - will be the day that some user whines that they never
got email foo from bar about baz - and you can not check your
DB of what got sent when to whom.



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What am I doing wrong... I want to increment a number in a DB

2002-06-03 Thread Ovid

--- "FLAHERTY, JIM-CONT" <[EMAIL PROTECTED]> wrote:
> foreach $row(@$array_ref) {
>   my($num,$title,$media,$serial,$time,$class,$remarks,$custody,$loc,
> $format,$qty,$lab,$rew,$sta,$history5,$check) = @$rows;
> 
> $history2 = $history5;
> $history2++;
> 
> }
> $dbh2 =DBI ->connect($data_source, $username, $password);
> my $sth2 = $dbh2 -> prepare("update media1 set history5 ='$history2' where
> num =
>  '$num'");

One problems that I see that no one else appears to have pointed out is the scoping 
issue.  Your
$num is falling out of scope and doesn't have the correct value.  

I would recommend indenting your code (I'm going to shorten the lines in hopes of 
avoiding
wrapping and making the issue clearer):



foreach $row (@$array_ref) {
my($num,$serial,$history5,$check) = @$rows;
$history2 = $history5 + 1;
}

$dbh2 = DBI->connect($data_source, $username, $password);
$history2 = $dbh2->quote( $history2 );
$num  = $dbh2->quote( $num );

$sql = "UPDATE media1 SET history5 = $history2 WHERE num = $num"
my $sth2 = $dbh2->prepare( $sql );



Now the above snippet is functionaly equivant to yours.  Aside from shortening the 
lines for
clarity, I also quoted the two variables used in the SQL to avoid possible problems 
(see perldoc
DBI for more info on this).  Since they should both be numbers, this probably isn't 
necessary, but
later on if you start changing a lot of stuff, it could be important.

The reason indenting is so important is that it shows immediately an issue that was 
not apparent
at first:  your $num has fallen out of the scope of the for loop.  When it gets to the 
sql, either
it is undef (in which case, your SQL won't update - assuming $num is an ID), or it has 
retained
some value that was defined outside of the scope we see in the current snippet.

Also, I can't help but wonder what's intended here.  Are there several rows in 
$array_ref that you
want to update?  If so, the above snippet will only update the last one.  Since you 
have an array
reference, it looks like you meant to update several (otherwise, you wouldn't be using 
a for
loop).  Therefore, you could try this:



$dbh2 = DBI->connect($data_source, $username, $password);
$sql  = "UPDATE media1 SET history5 = ? WHERE num = ?"

# always prepare the sql outside of a loop, if possible.
my $sth2 = $dbh2->prepare( $sql );

foreach $row (@$array_ref) {
my($num,$serial,$history5,$check) = @$rows;
$history2 = $dbh2->quote( $history5 + 1 );
$num  = $dbh2->quote( $num );
my $rc = $sth2->execute( $history2, $num );
# do something with return code...
}



Hope this helps.

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 06:23 , Ron Powell wrote:

> Heya,
>
> I just read this article --
> http://use.perl.org/articles/02/06/01/1944202.shtml?tid=6
> 
>
> Being very new to perl, I don't understand what impact most of these 
> changes
> will have,

first off I presume you noted the big caps:

"WE DO NOT RECOMMEND USING RELEASE CANDIDATE 1 IN A PRODUCTION ENVIRONMENT.
"

this is a perlish way of noting 'we feel reasonably sure that we
have most of the wackoPerlGeeks out of the 5.7.X world at this point'
and hence that you can modestly consider it as a candidate for being
your production grade perl code...

I presume you also noted:

"THIS IS A REAL NEW PERL RELEASE THAT IS BINARY INCOMPATIBLE WITH ANY 
PREVIOUS PERL RELEASE. THIS MEANS THAT YOUR OLD EXTENSIONS (.xs code, 
those Perl modules requiring a C compiler) WILL NOT WORK AND WILL HAVE TO 
BE RECOMPILED. (Pure Perl modules should continue working.)"

which is a perlish way of noting -

"you will most likely need to do a lot of work to upgrade here"


> but I'm particularly interested in the addition of the SWITCH
> statement.

I presume you mean:

cf: http://mirrors.kernel.org/cpan/doc/perldelta.pod

and grovel down to 'use Switch' -

depending upon your orthodoxy - you either consider leaving the
'branch tree' construction up to the compiler a good thing or
merely laziness that allows the mediocre to write more banal
code faster

You may have noticed the recent 300 coin thread - where we have
been discussing which is worse - writing a GaGillion lines of
canonical

if 
elsif
...
else { die "bad voodo happened";}

or would one be better off doing this with using the implicit
branch structuring in a Hash - in part because of prior discussions
about the merits of building 'branch tables' where we index into
functions with something on the order of

cf - http://www.wetware.com/drieux/pbl/misc/HashSwitch.txt

That we have all been through the misadventures of play as noted in

perldoc -q switch

that they have opted to simply provide a mechanism for doing this
means that it will be 'simpler' in the future to write banal code.

> I thought it might be an interesting to discuss which feature(s)
> the more advanced users are looking forward to, and what impact that will
> have - sort of a learning experience I guess.

all upgrades are evil, bad, wrong.

True Believers can do perl golf in perl4

The Apocalypse is Coming, this is a False Start and should not be 
supported.

Do not bend, fold spindle or mutilate.

> Anyways, have at it :)

never put a challenge like that,

"lead me not into temptation
for surely I can find it on my own"
- oscar wilde

but thank you for asking

ciao
drieux

---


Remember boys and girls, the big advantage of having
someone on staff who has been kissing wall sockets since
their youth is that they are cheaper than owning a volt meter,
and way techNoir if they can also tell 50Hz from 60Hz circuitry.

The downside is that they are less suceptible to 'electro-shock' therapy,
and you may have to find some other form of chemo-therapy to help them
on the road to recovery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Checking the status of sendmail

2002-06-03 Thread Chuck Tomasi

Perl 5.6.0
OS: NetBSD 1.5.2 (and Solaris 7)

I've got a program that regularly sends mail to people, however once in a
while I get a report from someone stating that they missed a piece of
mail. It's not all the time or I would have a major problem on my hands. 
I'm using the following construct:

# &ErrorMsg includes an exit()
open(F_MAIL, "|/usr/sbin/sendmail -t") || &ErrorMsg("Cannot open mail");
print F_MAIL "To: $user->{'Name'} <$user->{'Email'}>\n";
print F_MAIL "From: $admin->{'Name'} <$admin->{'Email'}\n";
print F_MAIL "Subject: Message Updated\n";
print F_MAIL "\n";
print F_MAIL $msg->{'Text'};
print F_MAIL "\n";
close(F_MAIL);

I have a wrapper around all of this to redirect STDERR and STDOUT to a log
file in the event of things like "no such user". That part seems to be
working fine, but I need to increase the robustness a little more if
possible.

I would like to know if sendmail spits back an error or exit status other
than 0. Can eval() be of any help here or is there another way I can use
sendmail to the achieve the same result and return an error code (please
don't suggest a system() call.)

Thanks

--Chuck


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Repository access issues

2002-06-03 Thread Jenda Krynicky

From: Manoj Jacob <[EMAIL PROTECTED]>

> Dear Jenda and all,
> 
> I have been trying to access the Repositories and even after setting
> the HTTP_Proxy to the Proxy server as "http://191.1.32.***:
>  8080"...it has not worked. 

My repository was down due to a hardware failure. Sorry about that.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Storing variable names in strings

2002-06-03 Thread drieux


On Monday, June 3, 2002, at 03:21 , Hanson, Robert wrote:

> I think the general answer you will get is "don't do it that way" for
> various reasons.  It is only ever a good idea if there are absolutely no
> alternatives, and even then you should always rethink doing it that way.

below I will try to offer you some support as to why such is
convolution creation enablement HELL

> This code will do exactly the same thing except it uses keys in a hash to
> give you the ability to dynamically specify the name of the data, and gets
> rid of the warning.
>
> #!/usr/bin/perl -w
> my $hello='helloworld';
> $data{$hello} = 'foo';
> print STDOUT $data{helloworld}."\n";

Robert - you would of course wish to add:

use strict;
my %data;

to make sure that you got safely on down the line.

[..]
> -Original Message-
> From: Alan John Drew [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 6:15 AM
[..]
> [PbFe]$ more foobar.pl
> #!/usr/bin/perl -w
> #my $helloworld;
> my $hello='helloworld';
> ${$hello}='foo';
> print STDOUT $helloworld."\n";
>
> [PbFe]$ ./foobar.pl
> Name "main::helloworld" used only once: possible typo at ./test.pl line 7.
> foo
> [PbFe]$
[..]
> Can't declare scalar deref in my at ./foobar.pl line 4, near "}="
> Execution of ./foobar.pl aborted due to compilation errors.
[..]

part of what you need to do is 'use it again' if all you want is to
turn off the warning

the problem of course is that you are on the fast path to making
side effect driven buggy code.

Note that you can not easily use strict to protect you - so you
can not do the

# my $helloworld;

since that would lead to the circular problem of what was the
${$hello} really suppose to be referencing...

notice what happens with:

my $hello='helloworld';
${$hello}='foo';
print "\${\$hello} is $helloworld.\n";

${$hello}='bar';
print "\${\$hello} is $helloworld.\n";

$hello='badWorld';
${$hello}='spazMe';

print "\${\$hello} is $helloworld at ${$hello}\n";
$helloworld='FremongeNoid';
print "\${\$hello} is $helloworld at ${$hello}\n";

this will generate

${$hello} is foo.
${$hello} is bar.
${$hello} is bar at spazMe
${$hello} is FremongeNoid at spazMe

so while your original piece offered the 'hint' that you would
be able to do 'cool things' - within only a few tweeks you have
begun to lose track of who changed what when where and why - without
much real improvement on the code. PLUS you have had to give up

a) use strict
b) initialization of variables
{ hence no chance to use 'default values' }

All so that you could imply to yourself the potential equivolencey of

$helloworld sometimes is ${$hello}

so while yes, it can be done - the question really is whether
or not you wish to be that RUDE to yourself when you come back in
a while and have to maintain that code ... { or will your future
you come back and just slap your YabaHo's around the room }

The other principle reason you hear people advocating against
this approach is that it allows a security issue Think what
would happen if you took in data somewhere and assigned it to
this $hello variable and you had taken this sort of habit,
suddenly your code would be breeding variables all over the place
in its run time environment mjd's article is out there

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread Bob Showalter

> -Original Message-
> From: Ron Powell [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 6:23 AM
> To: '[EMAIL PROTECTED]'
> Subject: Perl 5.8.0rc1 changelogs. What are you most excited about?
> 
> 
> Heya,
> 
> I just read this article --
> http://use.perl.org/articles/02/06/01/1944202.shtml?tid=6
>  
> 
> Being very new to perl, I don't understand what impact most 
> of these changes
> will have, but I'm particularly interested in the addition of 
> the SWITCH
> statement.  I thought it might be an interesting to discuss 
> which feature(s)
> the more advanced users are looking forward to, and what 
> impact that will
> have - sort of a learning experience I guess.
> 
> Anyways, have at it :)

These three look interesting:

* File handles can be opened to "in memory" files held in Perl scalars via:

   open($fh,'>', \$variable) || ...

* Anonymous temporary files are available without need to
'use FileHandle' or other module via

   open($fh,"+>", undef) || ...

That is a literal undef, not an undefined value.

* The list form of C is now implemented for pipes (at least on UNIX):

   open($fh,"-|", 'cat', '/etc/motd')

creates a pipe, and runs the equivalent of exec('cat', '/etc/motd') in
the child process.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What am I doing wrong... I want to increment a number in a DB

2002-06-03 Thread Adam Morton

>> Some where it resets back to zero all the time

You do "foreach $row", then you set all of your variables to pieces of "@$rows".
Note the trailing 's'.  Typo strikes again.  All of those values are probably
undefined, since I assume "$rows" is undefined, thus they get inserted as 0 or
''.

Simply logging your query, or just printing your variables to an error log or
the screen as a first debugging step should have pointed this out pretty
quickly.

If all of the processing that you are doing on the result set happens on a row
by row basis, it is probably more effecient to use a fetchrow_hashref loop to
step through your initial query result set and do the update rather than
fetching everything to an in-memory array and then looping through that.

Also, if all you want to do is increment a numerical field, you may be able to
do that directly in the SQL by using:

"update media1 set history5 = history5 + 1 where ...  "


--Adam

- Original Message -
From: "FLAHERTY, JIM-CONT" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 02, 2002 9:59 PM
Subject: What am I doing wrong... I want to increment a number in a DB


I have a query to draw it out on my redhat 7.1 box with MySQL 3.23 and I
increment it and run update query . Some where it resets back to zero all
the time

the code


foreach $row(@$array_ref) {
  my($num,$title,$media,$serial,$time,$class,$remarks,$custody,$loc,
$format,$qty,$lab,$rew,$sta,$history5,$check) = @$rows;

$history2 = $history5;
$history2++;

}
$dbh2 =DBI ->connect($data_source, $username, $password);
my $sth2 = $dbh2 -> prepare("update media1 set history5 ='$history2' where
num =
 '$num'");


$sth2 -> execute or die " unable to execute query ";






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl 5.8.0rc1 changelogs. What are you most excited about?

2002-06-03 Thread Ron Powell

Heya,

I just read this article --
http://use.perl.org/articles/02/06/01/1944202.shtml?tid=6
 

Being very new to perl, I don't understand what impact most of these changes
will have, but I'm particularly interested in the addition of the SWITCH
statement.  I thought it might be an interesting to discuss which feature(s)
the more advanced users are looking forward to, and what impact that will
have - sort of a learning experience I guess.

Anyways, have at it :)

--
Ron Powell
Senior IT Analyst &
Network Administrator
gomembers, Inc. (Baltimore Office)
[EMAIL PROTECTED]
410-494-1600 x4058





OLE

2002-06-03 Thread Todd_Hemsell

Good Morning,

In the error below where it says "Not a Win32::OLE object" Should I read
that as it is not defined on my server or it is not defined in OLE.pm?

##BOF##

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:


Undefined subroutine &Acrobat::FDF::newFromBuf called at
D:\Hemsell.org\scripts\employee_query.pl line 61.
Win32::OLE(0.1501): GetOleObject() Not a Win32::OLE object at C:/Program
Files/Perl/site/lib/OLE.pm line 115 during global destruction.


##EOF##


I am trying to setup the PDF to FDF samples from Adobe on my server.
I have followed the instructions and loaded the FDF DLL's and registered
them ect.
The ASP Scripts that create FDF objects work, just not the Perl scripts.



Regards,


Todd

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl2exe

2002-06-03 Thread Jenda Krynicky

From: "Jackson, Harry" <[EMAIL PROTECTED]>

> I am trying to compile a script to an executable in Win NT and getting
> the following.
> 
> Converting 'Search_Remedy.pl' to Search_Remedy.exe
> Warning: Can't locate Tie/Registry.pm at
> C:\Perl\site\lib\DBD\Oracle.pm line 106 @INC = C:\Perl\lib,
> C:\Perl\site\lib, ., must be directory, not file)
> 
> 
> I know I have this module missing and have been unable to find it on
> ASPN. I have found the Win32::TieRegistry but not the one it wants.

If you look better at the code in DBD::Oracle.pm you'll see that the 
module uses Win32::TieRegistry and only if that one is not found 
and it doesn't succeed to open the HKLM\Software\Oracle does it 
try Tie::Registry instead.

perl2exe cannot know that so it warns you that it was not able to 
find a module that might be needed. It doesn't have any way of 
knowing it will never be.

I believe perl2exe will create the .exe anyway, if it does not see it's 
docs and forbide it to try to incorporate Tie::Registry in the .exe.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Help handling text files.

2002-06-03 Thread Jenda Krynicky

From: "Josh" <[EMAIL PROTECTED]>

> Ok Heres the deal :) I have a script to write to a dat file and the
> basic output in the dat file is
> 
> username:plan: so an example would be
> computer:50: meaning the username computer has 50 hours of paid dialup
> access.  
> 
> Now Lets say "computer" calls and wishes to upgrade his account to 100
> hours, i need to figure out how to script it so that it replaces the
> number with the new one..know what i mean? 
> 
> Josh

You may like MJD's Tie::File ( http://perl.plover.com/TieFile/ )
It'll allow you to treat the file as an array. Including modifications 
and deletions.

Jenda



=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: DB_file help.

2002-06-03 Thread Jenda Krynicky

From: "Postman Pat" <[EMAIL PROTECTED]>
> I am trying to create a small database with the information like this:
> 
> Each record has a name ie :
> Dog
> And has the following traits:
>  color
>  weight
>  nick

Well ... actually the subject you've chosen contains the name of a 
module you could use. The module allows you to "store a hash on 
the disk". See 
perldoc DB_File

The DB_File as well as other "DBM"s allow you to store only a 
single string in the database for each key so you must either
1) join the data every time you store them and split them when 
reading
2) Use MLDBM module to do that automaticaly for you.

See
perldoc MLDBM

Jenda


=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Storing variable names in strings

2002-06-03 Thread Hanson, Robert

I think the general answer you will get is "don't do it that way" for
various reasons.  It is only ever a good idea if there are absolutely no
alternatives, and even then you should always rethink doing it that way.

This code will do exactly the same thing except it uses keys in a hash to
give you the ability to dynamically specify the name of the data, and gets
rid of the warning.

#!/usr/bin/perl -w
my $hello='helloworld';
$data{$hello} = 'foo';
print STDOUT $data{helloworld}."\n"; 

Rob


-Original Message-
From: Alan John Drew [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 6:15 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]'
Subject: Storing variable names in strings


Hi, I have this snippet of code which actually works, but I would like to
get rid of the warning

[PbFe]$ more foobar.pl
#!/usr/bin/perl -w
#my $helloworld;
my $hello='helloworld';
${$hello}='foo';
print STDOUT $helloworld."\n"; 

[PbFe]$ ./foobar.pl
Name "main::helloworld" used only once: possible typo at ./test.pl line 7.
foo
[PbFe]$


Kinda neat, dont you think? Even if I dont get an answer, it may help some
other poor perl beginner. As you can see, I tried to define
$helloworld to fix this problem, but get the following error when run:

Can't declare scalar deref in my at ./foobar.pl line 4, near "}="
Execution of ./foobar.pl aborted due to compilation errors.

Any ideas?
A.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Storing variable names in strings

2002-06-03 Thread Alan John Drew

Hi, I have this snippet of code which actually works, but I would like to
get rid of the warning

[PbFe]$ more foobar.pl
#!/usr/bin/perl -w
#my $helloworld;
my $hello='helloworld';
${$hello}='foo';
print STDOUT $helloworld."\n"; 

[PbFe]$ ./foobar.pl
Name "main::helloworld" used only once: possible typo at ./test.pl line 7.
foo
[PbFe]$


Kinda neat, dont you think? Even if I dont get an answer, it may help some
other poor perl beginner. As you can see, I tried to define
$helloworld to fix this problem, but get the following error when run:

Can't declare scalar deref in my at ./foobar.pl line 4, near "}="
Execution of ./foobar.pl aborted due to compilation errors.

Any ideas?
A.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: What am I doing wrong... I want to increment a number in a DB

2002-06-03 Thread ivan . drvaric


Hi,

The question appears if your data is reset in database after transaction or
during transaction.
If after transaction is the case then you should take care on commit
mechanism of transaction.
Some database interfaces or databases can be set to so called auto-commit
where commit is
issued to database after every sql dml cluase ( insert, update, delete).
If that's not the case then after disconnecting from the DB rollback is
issued and
no change of data is done.

Hope this is in your direction ...

Kind Regards
Ivan Drvaric




|-+>
| |   "FLAHERTY,   |
| |   JIM-CONT"|
| | |
| ||
| |   06/03/2002 03:59 |
| |   AM   |
| ||
|-+>
  
>-|
  |
 |
  |   To:   "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
 |
  |   cc:  
 |
  |   Subject:  What am I doing wrong... I want to increment a number in a DB  
 |
  
>-|




I have a query to draw it out on my redhat 7.1 box with MySQL 3.23 and I
increment it and run update query . Some where it resets back to zero all
the time

the code


foreach $row(@$array_ref) {
  my($num,$title,$media,$serial,$time,$class,$remarks,$custody,$loc,
$format,$qty,$lab,$rew,$sta,$history5,$check) = @$rows;

$history2 = $history5;
$history2++;

}
$dbh2 =DBI ->connect($data_source, $username, $password);
my $sth2 = $dbh2 -> prepare("update media1 set history5 ='$history2' where
num =
 '$num'");


$sth2 -> execute or die " unable to execute query ";






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: regexp help

2002-06-03 Thread David . Wagner

You can use a module File::Basename or I use for my scripts a simple
one to extract the filename of my scripts to use in displays(Basic
assumption is a valid filename being searched):
my $MyFilename ;

if ( /^.+[\\\/](.+)/ ) {  # assuming full or partial filename is in
$_
   $MyFilename = $1;
 }

Wags ;)
-Original Message-
From: Zysman, Roiy [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 02, 2002 04:44
To: '[EMAIL PROTECTED]'
Subject: FW: regexp help




>  -Original Message-
> From: Zysman, Roiy  
> Sent: Sunday, June 02, 2002 2:40 PM
> To:   '[EMAIL PROTECTED]'
> Subject:  regexp help
> 
> Hi all
> how do i catch the last segment of a path and file name
> for example i would like to catch only "test.gif" in /usr/src/test.gif or
> from /usr/src/test1/../...//test.gif   
> 10x
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Repository access issues

2002-06-03 Thread Manoj Jacob

Dear Jenda and all,
 
I have been trying to access the Repositories and even after setting the
HTTP_Proxy to the Proxy server as "http://191.1.32.***:
 8080"...it has not worked. 
 
C:\Perl\repository>ppm
PPM interactive shell (2.1.5) - type 'help' for available commands.
PPM> search
Error connecting to
'http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPM
Server'.
PPM>
 
Is the Firewall the problem ?
 
Then i just tried Repository Describe and I noticed that the "Type:" is
Unsupported as you would see below. Is this the problem ? if so how do i
work around this ? Is it possible to set the Type ?

ppm> rep des 1
Warning: 501 Protocol scheme '' is not supported
Describing Repository 1:
Name: ActiveState PPM2 Repository
Location: http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
 
Type: unsupported
ppm> search
No search result sets -- provide a search term.
ppm> rep des 1
Warning: 501 Protocol scheme '' is not supported
Describing Repository 1:
Name: ActiveState PPM2 Repository
Location: http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
 
Type: unsupported
ppm> rep des 2
Warning: 501 Protocol scheme '' is not supported
Describing Repository 2:
Name: ActiveState Package Repository
Location:
http://ppm-ia.ActiveState.com/PPM/ppmserver.plex?urn:/PPM/Server/SQL
 
Type: unsupported
ppm>
 
Please help me...Hoping to hear from you all your ideas.
 
Regards,
manoj