Net::LPDAP + CGI

2000-11-21 Thread Johan Östensson

Hi all!

I am having problem with Net::LDAP (perl-ldap 0.22) and CGI (distributed
with ActivePerl). I'm using Build 620.

In my testscript my search in the Exchange LDAP addressbook works perfectly,
until I add "use CGI;" to webalize it. The suddenly all searches returns 0
hits. By just commenting out that line it works again.

Error in the script? Nop, it works perfectly on my linux box, with "use CGI"
and all.

If this is a known problem please let me know ;-)

/johan

--
Johan Östensson   [EMAIL PROTECTED]
Dataavdelningen   Tfn: 019-21 77 05
Örebro LantmänMobil: 073-654 82 83
Box 1743, 701 17 Örebro   Fax: 019-21 77 54
--
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



pls unsubscribe me

2000-11-21 Thread Pragneshkumar Gandhi

as i am going fro big vacation (tour of aus)
 so for that pl sunsubscribe me from list.
 thankx


=
.  Never ever Give Up .AND .
...Live Life Like King Size.

FROM
PRAGNESHKUMAR GANDHI

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Using Sendmail - inserting html isn't rendered

2000-11-21 Thread byron wise

I am able to send mail using Sendmail with no prob.  But now I want to
insert html tags to change color of text, make things bold, even give a
background color.  When I put them in as I would imagine the tags show up in
the body..not rendered at all.  Is there a fix?  
byron wise



"When you sell a man a book, you don't sell him 12 ounces of paper and ink
and glue - you sell him a whole new life." - Christopher Morley

"Thanks O'REILLY." - Me





___
Tired of slow Internet? Get @Home Broadband Internet
http://www.home.com/xinbox/signup.html

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Email feed -> write to file

2000-11-21 Thread kouryuu

Environment:
Latest ActiveState distro
WinNT
Exchange Mail Server

I need to take email sent to a designated address and feed it to a perl
script that writes it to a file.
Alternately, an option would be to send email to a text file, then run a
perl cron job to process the text file every set time period. The purpose is
to take contents of email messages and pump them into a perl-driven intranet
web board.

Has anyone here ever done anything like this before?

Any hints or pointers to information would be greatly appreciated.

Thank you,

Shawn

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Getting at an HoL in a module

2000-11-21 Thread Ted S.

At 11/21/00 1:24:00 PM, you wrote:

[In the interests of saving space, I've deleted the original script and just left my 
questions.  
You should be able to find the scripts in the original post in this thread.]
 
>> 1) Is there any way to get at the original hashes, so that I can, say, sort 
>%tennishol by 
keys 
>> and then have it do an alphabetical table that way?  I know I could copy the HoL 
>somewhere 
>> else, sort the names and assign an integer to each key of the HoL based on its 
>alphabetical 
>> position, but I'd like to be able to create alphabetical tables of only part of the 
>alphabet 
>> (eg. get only the keys beginning with A or B).  Similarly, I could copy the HoL 
>somewhere 
else 
>> and use Perl to create the HTML pages on my local computer, but part of my desire 
>to go to 
Perl 
>> is so that I only have to upload a script for the alphabetical tables *once*, and 
>that will 
>> create a different table each time I update the data.  I read perlref and perldsc, 
>but 
didn't 
>> see what I'm looking for in either document.
>> 
>> 2) Why do I even have to reference the hashes in the first place and then bless 
>them (or 
bless 
>> something -- since there's nothing between the {} I have no idea what I'm 
>blessing)?  I know 
it 
>> says in perlmod that you have to bless something, but I don't understand the point 
>of it.  
>> There doesn't seem to be anything wrong with the original hashes!
>> 
>> 3) For some reason the test script works just fine until I use strict, and then I 
>get
>> a bunch of error messages about certain (well, every value in the hash) barewords 
>not
>> being allowed.  
I 
>> tried "perldoc -q bareword" and didn't get anything.  I tried setting up the script 
>that 
>> creates the hash to put quote marks around the names, but that gave me error 
>messages of 
having 
>> uninitialized values.  Should I just not use the strict pragma?  (Ducking to avoid 
>the wrath 
of 
>> everybody for not using strict -- at least I use -w -- but I'm serious!  Turning 
>$hashref 
and 
>> $holref into my $hashref and my $holref also causes a bunch of errors.)
>>
>
>Does the module you wrote use a package? If so that would explain
>your experience. 

I presume you're asking whether the code has a line starting with "package 
[module_name];"?  
No, it doesn't.  In reading the various documentation, I had difficulty understanding 
the 
difference between a package and a class is, and why you have to bless stuff.  I just 
kept 
experimenting with various example code in the perldoc until I got something that 
works.  :-)

>You may simply have to qualify the hash names by the
>package name. 

Is the package name Tennisstats or Tennis::Tennisstats?  And what would this make the 
hash 
names?  Seriously.  I looked at the code for the Exporter module (since I apparently 
have to 
use that anyhow) to try to figure out what's meant by the module names and how this 
affects the 
naming of variables, and the only thing I saw what that all the subroutines started 
with 
&exporter_.  Does this mean that I'd have to rename all the variables %Tennisstats_ 
followed by 
my original hash names?  And what's the point of having to do it this way?

BTW: I also don't think I saw anything being blessed in the Exporter module.  Yet it 
works, 
because I was eventually able to export the hash variables.  However, I'm asking the 
questions 
so that I can understand what I'm *supposed* to be doing, and not just have modules 
that 
mysteriously work without my knowing why.  :-)

>Or if you want to do it the way most modules writers
>do, you can export the hash variables so you can reference them
>directly from the code that uses the module.

Will I have to upload both Exporter and Exporter::Heavy to where my web-site is being 
hosted?  
After a bit of fiddling I was eventually able to get the hashes exported.

> [EMAIL PROTECTED] 
> All opinions are my own and not necessarily those of my employer 


Ted S.
[EMAIL PROTECTED]
My cat likes to sit on my lap while I'm at the computer.
If only I could get her to hack Perl code for me.



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Need Pointers to Documentation . . .

2000-11-21 Thread Frank Merrow

I've been through all the usual FAQ and the Perl Docs that I know of.

I do NOT want to do CGI programming, I want to use "client side PerlScript" 
to create of smart pages that run on my local machine WITHOUT a Web server 
to serve up the pages.  Very special application . . .

I get that most of my access will be through $window and $window->document.

I can get simple button clicks and stuff to work.  I've seen "Hello", 
"Greeting", "Mouse Tracking" and "Calculator" in the PerlScript examples 
and they are great as far as they go.

However, I cannot (for instance) get $window->document->FooBar->{Value} = 
"x" to work if I am attempting to do this from the "main" (Global scope) 
portion of the Perl script.  Though clearly some things ARE allowed to be 
at the global level.  That same statement works find in a XXX_onClick() 
routine.

I need information on $window, its scope, when it is created.  What other 
variables beside $window are created and available.  Besides 
$window->document what other items are part of the $window variable.

And why does everything stop working if I try and "use strict"?

I've hit every book I know of.  Several of them have a page or two, but no 
real meat to the discussion.

This information must be on-line someplace . . . can anyone point me at it?

Frank

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: WIN2Kpro

2000-11-21 Thread Rob


> At 05:48 AM 11/22/2000 +1100, Rob wrote:
> > >Of course, you could always contact the
> > >vendor.
>
> I sent a note to [EMAIL PROTECTED] back on the 16th; no
reply
> yet, so I thought I'd try the list.
> --
> Robert Link
>
Yeah, the guys that create those error messages have a wicked sense of
humor, don't they
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Module to talk to a PC's BIOS

2000-11-21 Thread Rob

Hi,
The link worked fine for me - you have to click on the "zip new" in the
right hand margin.
Cheers,
Rob
Visit our website at http://www.kalinabears.com.au
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 22, 2000 6:14 AM
Subject: Re: Module to talk to a PC's BIOS


>
> Update:  I went to Amine's site: http://www.generation.net/~aminer/Perl/
> which lists the module but the link to it is dead.  Does anyone have the
> module in a form they could send to me?
>
>
>
> >A few weeks ago I seem to recall a reference to a module I/O Port or
> >something that would allow you to talk to the CMOS/BIOS of a PC.  Can
> >someone point me to where I can find it?  Thanks,
> >
> >Chuck
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: WIN2Kpro

2000-11-21 Thread Zoltan Celedes

> Hi,
> The error message suggests that there is some incompatibility there.
> Could this problem be associated with Active State's Windows Installer
> which, they claim, does not need to be installed on 2000 because it is
> already part of the operating system? I wonder whether it could be absent
> from your operating system - ie. maybe you do need to download
> their Windows
> Installer first. Then again, would it work anyway? I don't know
> the answers.
> Just something for you to consider. Of course, you could always
> contact the
> vendor.
> That's the only stab in the dark that I can provide.
> Cheers,
> Rob

> > to install, got a message saying, "This installation package could not
be
> > opened.  Contact the application vendor to verify that this is a valid
> > Windows Installer package."  The file name I'm trying to install is


Their installer uses msi which is provided by microsoft - it definitely
comes with all win2k platforms. Just run "msiexec" and you should see you
have at least version 1.1 installed.

The error message sounds like it enountered a corrupt MSI file. I just
installed it on win2k (SP1) and it installed fine. Check the file size - you
should have:

ActivePerl-5.6.0.620-MSWin32-x86-multi-thread.msi
(8,629,248 bytes)

Zoltan.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: regex... please

2000-11-21 Thread Gerrit P. Haase

<21 Nov 2000, 15:47 Uhr wars, als Charles Maier folgendes schrub:>
< regex... please >

> How do I code a m//ig to hit on either a ';' or a "\r\n" or a "\n".. in that
> order???
>

m";|\r\n|\n"ig

- gph -

--
Gerrit Peter Haase
¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



regex... please

2000-11-21 Thread Charles Maier

How do I code a m//ig to hit on either a ';' or a "\r\n" or a "\n".. in that
order???

TIA
Chuck

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Regular Expression question

2000-11-21 Thread Jon Bjornstad

steve silvers wrote:

> I'm calling a bunch of rows from my database.
> In the while loop.
>
> while(my $Dataref = $sth->fetchrow_hashref) {
>my %Data  = %{$Dataref};
>my $text  = ($Data{val});
>
>  $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
>$emailaddress = $1;
>print qq($emailaddress);
> }
>
> In the above regex each row has a text column, with lots of text in them. 
> When I run this through the loop it finds the email address and I have 
> another part that turnes it into a hyperlink. The back reference works 
> great. Now the problem im having is when there is more than one email 
> address. Does anyone know how I can modify this so that it will look past 
> the first email address and also capture the second, third, etc...

i have several comments on your code, Steve.

> while(my $Dataref = $sth->fetchrow_hashref) {
> my %Data  = %{$Dataref};
> my $text  = ($Data{val});

you could redo the sql statement so that it
only returned the column you are interested in.
then you could use fetchrow_array instead.
i only use hashref when it is truly necessary.

like so:

$sth = $dbh->prepare("SELECT TEXTCOLUMN FROM TABLENAME");
$sth->execute;
while (($text) = $sth->fetchrow_array) {
...
}

> 
>   $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
> $emailaddress = $1;
> print qq($emailaddress);
> }
> 

i presume you meant
$text =~
not
$text =
yes?

you could also do this:
($email) = ($text =~ /..(..)../);

and avoid the use of the intermediate $1.
note that the parentheses are required around
$email to put the regular expression in 'list' context.

your statement:
print qq($emailaddress);
is equivalent to:
print "$emailaddress";
which is the same as simply:
print $emailaddress;

the interpolation of the scalar inside
of the double quoted string is not necessary
(unless, of course, you wanted to append "\n").

>   $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)

a very complex regular expression!
you could use the /x modifier to spread it across several lines.
i'm glad it works for you.
it looks as if you are gathering _web_ addresses (with the 'www.')
not email addresses (which would contain an '@').
note that web addresses do not _have_ to
start with 'www.'; most do but not all.
what does the [\001\074]* do at the end there???

> Now the problem im having is when there is more than one email
> address. Does anyone know how I can modify this so that it will look past
> the first email address and also capture the second, third, etc...

yes.   there is a VERY COOL feature of perl regular expressions
where it will do the match for you _globally_ and return all
matched subexpressions in one fell swoop.to illustrate this:

$s = "blah 45 oops 234 lala*()3 !!23 --456%%";
@nums = ($s =~ /(\d+)/g);
print "@nums\n";

this prints:
45 234 3 23 456

the code above extracts just the _numbers_ from the string
into separate elements of the array.   the key points
are the g modifer on the regular expression and assigning
the results of the regular expression to an array which puts
it in list context.

you can use this to get all the web addresses into
an array which you can then loop over!

@web = ($text =~ /...(..).../g);
for my $w (@web) {
print "$w\n";
}

how's that!

and if you wanted to gather them from all records
before conversion to hyperlinks:

push @web, ($text =~ (/...(..).../g);

this would also put the regular expression into list context.

hope this helps,
Jon
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Win32::OLE and Mail subroutines

2000-11-21 Thread Steven Manross
Title: Win32::OLE and Mail subroutines





P.S. I hope this gets to the list in Text... 


For whatever reason, whenever I send a mail via Mail::Sender or Sendmail before connecting to LDAP/Exchange via Win32::OLE, the OLE call fails with an LDAP_SERVER_DOWN 0x8007203a

Using the code below, does anyone else have this problem?


use Win32::OLE;
use Mail::Sender;


mailme ();


$exch_server_name="server";
$exch_org="orgname";
$exch_org_unit="orgunit";
my $exch_recip_container = Win32::OLE->GetObject("LDAP://$exch_server_name/o=$exch_org/ou=$exch_org_unit/cn=Recipients");

if (!$exch_recip_container) {
  my $error = Win32::OLE->LastError;
  print "Error opening Exchange Recipients Container\n\nError: ", $error."\n";
  return 0;
} else {
  print "Success\n";
}


exit;


sub mailme {
  $sender = new Mail::Sender {'smtp' => 'smtp', 'from' => '[EMAIL PROTECTED]'};
  $sender->MailMsg({to  => '[EMAIL PROTECTED]',
    subject => 'Test Message',
    msg => 'Test Message',
  });
}





DBI using cursors

2000-11-21 Thread barons

I have my Perl script set up to page through recordsets. 10 pages at a time.
My SQL call is something like this.

SELECT column1, column2 FROM table.

Now each time the next or prev button is pressed this SQL call is executed and
searches through the table to find where it left off at. This is a bit slower,
and redundent. I want to use DBI with a cursor to mark the spot by 3 rows where
it last left off at. I pretty sure that using a cursor will do this. Does anyone
have a sample snippet of code using a cursor? Any suggestions for what im trying
to do!!

Thanks in advance.
Allan

--
http://www.provide.net
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Regular Expression question

2000-11-21 Thread steve silvers

Im calling a bunch of rows from my database.
In the while loop.

while(my $Dataref = $sth->fetchrow_hashref) {
my %Data  = %{$Dataref};
my $text  = ($Data{val});

  $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
$emailaddress = $1;
print qq($emailaddress);
}

In the above regex each row has a text column, with lots of text in them. 
When I run this through the loop it finds the email address and I have 
another part that turnes it into a hyperlink. The back reference works 
great. Now the problem im having is when there is more than one email 
address. Does anyone know how I can modify this so that it will look past 
the first email address and also capture the second, third, etc...

I tried even knowing that it wouldn't work to use something like.

while(my $Dataref = $sth->fetchrow_hashref) {
my %Data  = %{$Dataref};
my $text  = ($Data{val});

  $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
$emailaddress = $1;
print qq($emailaddress);

  $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
$emailaddress2 = $2;
print qq($emailaddress2);

}

But the problem here is once again it stops after the first www.blabla.com 
(up to next white space) has been found.

Any suggestions. Thanks in advance.
Steve.

_
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Module to talk to a PC's BIOS

2000-11-21 Thread Chuck . Hirstius


Update:  I went to Amine's site: http://www.generation.net/~aminer/Perl/
which lists the module but the link to it is dead.  Does anyone have the
module in a form they could send to me?



>A few weeks ago I seem to recall a reference to a module I/O Port or
>something that would allow you to talk to the CMOS/BIOS of a PC.  Can
>someone point me to where I can find it?  Thanks,
>
>Chuck

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: WIN2Kpro

2000-11-21 Thread Rob

Hi,
The error message suggests that there is some incompatibility there.
Could this problem be associated with Active State's Windows Installer
which, they claim, does not need to be installed on 2000 because it is
already part of the operating system? I wonder whether it could be absent
from your operating system - ie. maybe you do need to download their Windows
Installer first. Then again, would it work anyway? I don't know the answers.
Just something for you to consider. Of course, you could always contact the
vendor.
That's the only stab in the dark that I can provide.
Cheers,
Rob
Visit our website at http://www.kalinabears.com.au
- Original Message -
From: Robert Link <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 22, 2000 3:19 AM
Subject: WIN2Kpro


> Anyone out there running activestate on a Win2000Professional box?  I
tried
> to install, got a message saying, "This installation package could not be
> opened.  Contact the application vendor to verify that this is a valid
> Windows Installer package."  The file name I'm trying to install is
> "ActivePerl-5_6_0_620-MSWin32-x86-multi-thread.msi"  All pointers
appreciated.
> --
> Robert Link
>
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Hash

2000-11-21 Thread Dan Boorstein

Carl Jolley wrote:
> 
> Keep in mind that perl's default way of passing parameters is
> by value so if you passed a hash, perl would copy all the elements
> of the hash and pass that copy to the subroutine. If you want to
> avoid all that copying, you can pass a reference to a hash (or a
> reference to any array). Then the called procedure has to dereference
> the passed parameter in order to access the original sturcture.

I don't think this is the case. The arguments to a subroutine, available
in @_, are more like aliases to the variables used in calling the sub.
They're only copied values if you make them that way by copying the
contents of @_ into some other list.

Note in the example that the subroutine can modify its arguments,
even if that argument is a hash.

That does't mean there aren't things to be gained by passing a
reference to a data structure. You avoid the "flattening" that
way.

Cheers, 

Dan

# BEGIN CODE

sub alter {
  for (@_) {
$_ .= $_;
  }
}

my %foo = qw(foo bar);

&alter(%foo);

for (keys %foo) {
  print "$_ => $foo{$_}\n";
}

__END__

produces:

foo => barbar
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Hash

2000-11-21 Thread Carl Jolley

On Tue, 21 Nov 2000, Rob Lawton wrote:

> Apologies if my Email seems so very simply, bit like it's author really.
> 
> I while ago, (about a month and a bit..), I sent in an Email asking about 
> passing values between procedures and somebody replied that I should look 
> into associated arrays / hashes.  I have been trying to grasp the Perl hash 
> but have a number of questions I'm having difficulty finding responses to 
> with any docs I've been through.
> 
> I know that if I call a procedure with "()" it passes no values to it, 
> similarly if I pass a list between the "()" I will be passing the values to 
> the procedure, (when I have a locally scoped var anyway) but am I correct 
> in believing that with a hash I can access the value's in the hash from 
> within any procedure ? Is this not a waste of memory resources as the 
> value's are ALWAYS sitting in memory and accessible like a globally scoped 
> variable ?
> 
> It's just that I'm going through old code of mine and substituting areas of 
> code I think are memory intensive with procedures that once have used the 
> var will only pass the result on to the procedure that called it. Thus 
> saving memory as the other variables are no longer needed on for that 
> procedure and therefore globally scoped or passing around are wasting 
> resources.
>

Keep in mind that perl's default way of passing parameters is
by value so if you passed a hash, perl would copy all the elements
of the hash and pass that copy to the subroutine. If you want to
avoid all that copying, you can pass a reference to a hash (or a
reference to any array). Then the called procedure has to dereference
the passed parameter in order to access the original sturcture.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Getting at an HoL in a module

2000-11-21 Thread Carl Jolley

On Mon, 20 Nov 2000, Ted S. wrote:

> Hi everybody!
> 
> I apologise if you've already seen this message, but it hasn't shown up in the 
>digest, and it 
> isn't anywhere in the ActiveState archives (at least, not in the recent messages or 
>when I did 
> a search under my e-mail address).  Is anybody else having a problem getting 
>messages to the 
> list?
> 
> As I've mentioned in passing, I run a small web-site on women's tennis that I'd like 
>to use 
> Perl to help manage.  I'm going to have a bunch of pages on separate players along 
>with 
> rankings pages, so in order to get at all the statistics I figured that the easiest 
>solution 
> would be to put all the statistics in a module and then get at the module to get the 
> appropriate data.
> 
> I wrote the following module, called Tennisstats.pm and put it in a folder called 
>Tennis so 
> that I can get at it with the line "use Tennis::Tennisstats;"
> 
> #!perl -w
> 
> my %ratings = (
> # 588-key hash deleted, except that each key is an integer
> # corresponding to the players' ranking
> );
> 
> my %tennishol = (
> # 588-key HoL deleted, except that each key is one of the values
> # in the %ratings hash, with the values being lists of ranking data
> );
> 
> sub ratings {
> $hashref = \%ratings;
> $holref = \%tennishol;
> bless {}
> }
> 
> 1;
> 
> # end of first script
> 
> To see if I could get at the data, I wrote the following test script, which (more or 
>less) 
> works:
> 
> #!perl -w
> 
> use Tennis::Tennisstats;
> 
> &ratings;
> 
> print keys %ratings;
> print values %ratings;
> 
> my $x;
> for $x (1 .. 10) {
> print $x, " ";
> print $holref->{$hashref->{$x}}[0], " "; #print player's name
> print $holref->{$hashref->{$x}}[2]; #print number of wins
> print $holref->{$hashref->{$x}}[3], "\n"; #print number of losses
> }
> 
> # end of second script
> 
> Now, I can use the module to do *most* of what I want.  If I want to make an HTML 
>page of the 
> Top 20 players, as at , I can 
>extend the 
> above for loop and print out the appropriate tags.  For individual players' data, 
>such as won-
> lost records, I can get the appropriate member of the list as in the test script.
> 
> The problem is that I've got a page: 
> 
> that prints out a table of rankings in alphabetical order.  For some reason I can't 
>get at the 
> keys or the values in the hashes by calling them by their original name, but only by 
>the 
> reference.  For example, in the test script, the lines print keys %ratings and print 
>values 
> %ratings do nothing.
> 
> 1) Is there any way to get at the original hashes, so that I can, say, sort 
>%tennishol by keys 
> and then have it do an alphabetical table that way?  I know I could copy the HoL 
>somewhere 
> else, sort the names and assign an integer to each key of the HoL based on its 
>alphabetical 
> position, but I'd like to be able to create alphabetical tables of only part of the 
>alphabet 
> (eg. get only the keys beginning with A or B).  Similarly, I could copy the HoL 
>somewhere else 
> and use Perl to create the HTML pages on my local computer, but part of my desire to 
>go to Perl 
> is so that I only have to upload a script for the alphabetical tables *once*, and 
>that will 
> create a different table each time I update the data.  I read perlref and perldsc, 
>but didn't 
> see what I'm looking for in either document.
> 
> 2) Why do I even have to reference the hashes in the first place and then bless them 
>(or bless 
> something -- since there's nothing between the {} I have no idea what I'm blessing)? 
> I know it 
> says in perlmod that you have to bless something, but I don't understand the point 
>of it.  
> There doesn't seem to be anything wrong with the original hashes!
> 
> 3) For some reason the test script works just fine until I use strict, and then I 
>get a bunch 
> of error messages about certain (well, every value in the hash) barewords not being 
>allowed.  I 
> tried "perldoc -q bareword" and didn't get anything.  I tried setting up the script 
>that 
> creates the hash to put quote marks around the names, but that gave me error 
>messages of having 
> uninitialized values.  Should I just not use the strict pragma?  (Ducking to avoid 
>the wrath of 
> everybody for not using strict -- at least I use -w -- but I'm serious!  Turning 
>$hashref and 
> $holref into my $hashref and my $holref also causes a bunch of errors.)
>

Does the module you wrote use a package? If so that would explain
your experience. You may simply have to qualify the hash names by the
package name. Or if you want to do it the way most modules writers
do, you can export the hash variables so you can reference them
directly from the code that uses the module.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users

Module to talk to a PC's BIOS

2000-11-21 Thread Chuck . Hirstius

A few weeks ago I seem to recall a reference to a module I/O Port or
something that would allow you to talk to the CMOS/BIOS of a PC.  Can
someone point me to where I can find it?  Thanks,

Chuck

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Re: Sorting Question

2000-11-21 Thread Carl Jolley

On Mon, 20 Nov 2000, Tim Cochran wrote:

> I have a array like this:
> @array = ( 54,65,ABC345,ABC684,45,ABC826,18,99,ABC430 )
> 
> I would like to sort by numeric first (ascending), then the Alpha part 
> (descending).  In other words, I want the sorted results to look like this:
> 
> @sorted = (18,45,54,65,99,ABC826,ABC684,ABC430,ABC345)
> 
> I currently accomplish this by two different sorts, then combine the 
> results.  But that seems like a terribly inefficient way of doing it.  I am 
> looking for a better 'PERL' solution (i.e. Schwartzian Transform or 
> something).
>

You could get this effect by "tweeking" your compare function.
You need to check if $a and $b are both numeric, if so return
a result of a numeric compare. If they both contains letters,
return the result of a string compare. If they are mixed,
return the result that indicates the numeric variable is less,
i.e. true if $a is the number and false if $b is the number.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



RE: case INSENSITIVE locate ??

2000-11-21 Thread Carl Jolley

On Mon, 20 Nov 2000, Charles Maier wrote:

> Thanks for the response Carl... but can you show how to use pos to do as you
> suggest??

See if this does it for you:

if ($msg=~/keyword/ig) {
   $location=pos($msg); #offset of the character following keyword 
}

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



Image-Magick

2000-11-21 Thread Margaret Quinn

Hi All,

I have seen this question before - but haven't found the answer.
I would like to convert windows meta files to gif files.

Apparently i need to use Image::Magick to do this. And i have read somewhere
ImageMagick has been "ported" to Win32, it will install "PerlMagick" and the
binary applets ("convert.exe", "mogrify.exe" etc.) to a Windoze computer
Does anyone know where this is or can give me instructions on how to install
this. I have tried to install from Activestate ppm repository - 5.005 but no
luck
I am using Win98, PWS and perl build 5.6.

thanks in advance
Margaret


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users