href arguments

2001-08-07 Thread Francesco Scaglioni

Hi,

THis is probably a simple question.  Am new to perl and CGI so please
have mercy. I have a script which displays a list of files with links
to them.  The links when hovered over in a browser show as:

display_file.pl?filename=blahblah

How can I extract the blahblah bit (which is the name of the selected
file) so that the display_file.pl script can know which file it is to
open and process?  I think this makes sence.  I want the script
display_file.pl to perform an action on file blahblah.

TIA

Francesco

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




Re: AW: href arguments

2001-08-07 Thread Francesco Scaglioni

## Alessandro Lenzen [EMAIL PROTECTED] on: Tue, 7 Aug 2001 13:21:22 +0200 
## 
::  Hello Francesco,
alenzen:: 
alenzen:: first of all you should read the CGI.pm manpage if you want to write good
alenzen:: CGIs.
alenzen:: You don't need to use the CGI.pm module, but it is considered good
alenzen:: programming practice and it saves a lot of time since you don't have to
alenzen:: bother with a lot of things.
alenzen:: 
alenzen:: The following code should help you get the idea:
alenzen:: 
alenzen:: #!/usr/bin/perl -w
alenzen:: use strict;
alenzen:: use CGI qw(:standard);
alenzen:: my $file = param(filename);
alenzen:: #now the blahblah bit is extracted and saved in $file
alenzen:: 
alenzen:: 
alenzen:: -Ursprüngliche Nachricht-
alenzen:: Von: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
alenzen:: Gesendet: Dienstag, 7. August 2001 13:05
alenzen:: An: [EMAIL PROTECTED]
alenzen:: Betreff: href arguments
alenzen:: 
alenzen:: 
alenzen:: Hi,
alenzen:: 
alenzen:: THis is probably a simple question.  Am new to perl and CGI so please
alenzen:: have mercy. I have a script which displays a list of files with links
alenzen:: to them.  The links when hovered over in a browser show as:
alenzen:: 
alenzen:: display_file.pl?filename=blahblah
alenzen:: 
alenzen:: How can I extract the blahblah bit (which is the name of the selected
alenzen:: file) so that the display_file.pl script can know which file it is to
alenzen:: open and process?  I think this makes sence.  I want the script
alenzen:: display_file.pl to perform an action on file blahblah.
alenzen:: 
alenzen:: TIA
alenzen:: 
alenzen:: Francesco
alenzen:: 
alenzen:: --
alenzen:: To unsubscribe, e-mail: [EMAIL PROTECTED]
alenzen:: For additional commands, e-mail: [EMAIL PROTECTED]
alenzen:: 
alenzen:: 

I didn't generate a form - I am obviously mistaken as I was under the
impression that to use the param call then a form had to specify it.
Boy have I got much to learn.

Cheers

Francesco


RE: href arguments

2001-08-07 Thread Sidharth Malhotra

Once again.  This is a problem that can be easily solved reading the CGI
module documentation at:
http://www.perldoc.com/perl5.6/lib/CGI.html

use the CGI module:
Perl

use CGI;
my $q = new CGI;
my $filename = $q-url_param('filename'); # or
my $filename = $q-param('filename');

/Perl


-Original Message-
From: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 7:05 AM
To: [EMAIL PROTECTED]
Subject: href arguments


Hi,

THis is probably a simple question.  Am new to perl and CGI so please
have mercy. I have a script which displays a list of files with links
to them.  The links when hovered over in a browser show as:

display_file.pl?filename=blahblah

How can I extract the blahblah bit (which is the name of the selected
file) so that the display_file.pl script can know which file it is to
open and process?  I think this makes sence.  I want the script
display_file.pl to perform an action on file blahblah.

TIA

Francesco

-- 
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]




making graphics..

2001-08-07 Thread Rob

Hi,

I want to be able to create graphic logos witha perl script - any ideas on
how to do this?

What I mean is I will provide a list of titles and a list of font styles
then the script will create a gif for each title using a random font style..

Can it be done? Is it difficult? I've never tried any kind of graphical
stuff with perl before so its all a mystery..


Thanks.



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




Re: making graphics..

2001-08-07 Thread Brett W. McCoy

On Tue, 7 Aug 2001, Rob wrote:

 I want to be able to create graphic logos witha perl script - any ideas on
 how to do this?

 What I mean is I will provide a list of titles and a list of font styles
 then the script will create a gif for each title using a random font style..

 Can it be done? Is it difficult? I've never tried any kind of graphical
 stuff with perl before so its all a mystery..

Look into the GD module from CPAN -- it can create graphics on the fly
like this.

From the README:

[GD] is a autoloadable interface module for libgd, a popular library
for creating and manipulating PNG files.  With this library you can
create PNG images on the fly or modify existing files.  Features
include:

a.  lines, polygons, rectangles and arcs, both filled and unfilled
b.  flood fills
c.  the use of arbitrary images as brushes and as tiled fill patterns
d.  line styling (dashed lines and the like)
e.  horizontal and vertical text rendering
f.  support for transparency and interlacing

-- Brett
   http://www.chapelperilous.net/btfwk/

filibuster, n.:
Throwing your wait around.



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




Re: M$ Word to HTML

2001-08-07 Thread Adam Carson

I have tried that, and Word generates HTML documents (XML actually) that have 
consistently had incorrect formatting.

  Adam Carson
MIS Department
 Berkeley County, SC

 Brett W. McCoy [EMAIL PROTECTED] 08/07/01 11:22AM 
On Tue, 7 Aug 2001, Adam Carson wrote:

 Does anyone know of a perl module/program to convert M$ Word documents into HTML?  I 
have looked at the perldocs, and searched CPAN, but haven't found one.

Word itself can generate HTML documents from Word documents.  Maybe you
can set up some OLE automation to perform this task (you can do OLE
automation in Perl with ActiveState Perl).

-- Brett
   http://www.chapelperilous.net/btfwk/ 

It'll be just like Beggars' Canyon back home.
-- Luke Skywalker


-- 
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: M$ Word to HTML

2001-08-07 Thread Bradley M. Handy

If you have Dreamweaver you can use the 'Clean up Word HTML' option in the
Modify menu on the toolbar.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

 -Original Message-
 From: Adam Carson [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 11:22 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: M$ Word to HTML


 I have tried that, and Word generates HTML documents (XML
 actually) that have consistently had incorrect formatting.

   Adam Carson
 MIS Department
  Berkeley County, SC

  Brett W. McCoy [EMAIL PROTECTED] 08/07/01 11:22AM 
 On Tue, 7 Aug 2001, Adam Carson wrote:

  Does anyone know of a perl module/program to convert M$ Word
 documents into HTML?  I have looked at the perldocs, and searched
 CPAN, but haven't found one.

 Word itself can generate HTML documents from Word documents.  Maybe you
 can set up some OLE automation to perform this task (you can do OLE
 automation in Perl with ActiveState Perl).

 -- Brett
  http://www.chapelperilous.net/btfwk/
 
 It'll be just like Beggars' Canyon back home.
   -- Luke Skywalker


 --
 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]



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




RE: M$ Word to HTML

2001-08-07 Thread Adam Carson

Thanks.  I'll try that.

  Adam Carson
MIS Department
 Berkeley County, SC

 Bradley M. Handy [EMAIL PROTECTED] 08/07/01 11:26AM 
If you have Dreamweaver you can use the 'Clean up Word HTML' option in the
Modify menu on the toolbar.

Brad Handy
--www.jack-of-all-trades.net 
[EMAIL PROTECTED] 

 -Original Message-
 From: Adam Carson [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, August 07, 2001 11:22 AM
 To: [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Subject: Re: M$ Word to HTML


 I have tried that, and Word generates HTML documents (XML
 actually) that have consistently had incorrect formatting.

   Adam Carson
 MIS Department
  Berkeley County, SC

  Brett W. McCoy [EMAIL PROTECTED] 08/07/01 11:22AM 
 On Tue, 7 Aug 2001, Adam Carson wrote:

  Does anyone know of a perl module/program to convert M$ Word
 documents into HTML?  I have looked at the perldocs, and searched
 CPAN, but haven't found one.

 Word itself can generate HTML documents from Word documents.  Maybe you
 can set up some OLE automation to perform this task (you can do OLE
 automation in Perl with ActiveState Perl).

 -- Brett
  http://www.chapelperilous.net/btfwk/ 
 
 It'll be just like Beggars' Canyon back home.
   -- Luke Skywalker


 --
 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] 



-- 
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: popup-menue in a html-page

2001-08-07 Thread Moon, John

Hope this helps ...  you can run this from the command line then enter
Ctrl+d to see what is generates... I'm sure there are other ways of doing
this ... 

You make wish to check the permissions on /etc/password at your shop ..

use CGI;
$q-new CGI;
while (($name,undef,$uid)= getpwent) {
$PASSWD{$uid}=$name;
push @passwd_values, $uid;
}
print $q-popup_menu(-name=list,-values=\@passwd_values,
-labels=\%PASSWD)

-Original Message-
From: sendmail [mailto:[EMAIL PROTECTED]]
Sent: August 07, 2001 01:00
To: [EMAIL PROTECTED]
Subject: popup-menue in a html-page


hi list,
I got this problem:
I want to take all my user names from /etc/password and show them on a
html-page with a popup-menu.
this way the admin should be able to choose one of the user for another
action like deleting the user, renaming him ...
please help me with this popup, perhaps I should use cgi.pm?


--
peter grotz
rehberger architekten
schertlinstr 23
86 159 augsburg

tel 0821 25980-29
fax 0821 25980-20



-- 
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: M$ Word to HTML

2001-08-07 Thread Mark Saunders

Yeah, the dreamweaver 'Clean up Word HTML' is amazing.  
It does miss some tags, like class, so you have to take an extra step or
two to remove them.

-Original Message-
From: Bradley M. Handy [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 11:26 AM
To: Adam Carson; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: M$ Word to HTML

If you have Dreamweaver you can use the 'Clean up Word HTML' option in
the
Modify menu on the toolbar.

Brad Handy
--www.jack-of-all-trades.net
[EMAIL PROTECTED]

 -Original Message-
 From: Adam Carson [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 11:22 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: M$ Word to HTML


 I have tried that, and Word generates HTML documents (XML
 actually) that have consistently had incorrect formatting.

   Adam Carson
 MIS Department
  Berkeley County, SC

  Brett W. McCoy [EMAIL PROTECTED] 08/07/01 11:22AM 
 On Tue, 7 Aug 2001, Adam Carson wrote:

  Does anyone know of a perl module/program to convert M$ Word
 documents into HTML?  I have looked at the perldocs, and searched
 CPAN, but haven't found one.

 Word itself can generate HTML documents from Word documents.  Maybe
you
 can set up some OLE automation to perform this task (you can do OLE
 automation in Perl with ActiveState Perl).

 -- Brett
  http://www.chapelperilous.net/btfwk/


 It'll be just like Beggars' Canyon back home.
   -- Luke Skywalker


 --
 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]



-- 
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]




Redirecting STDOUT

2001-08-07 Thread Mark Ross

Hi all,

I have a Perl script that takes the contents of a
form, feeds them to GnuPG for encryption and then
emails me the encrypted document. GPG wants to either
display the results in STDOUT or write a text file,
both of which aren’t good.

I was hoping redirect STDOUT to a variable for a short
time.

I’ve seen references to redirecting filehandles in the
documentation, but no details on how to do it. (Which
I’m sure are there, but I’ve just missed). Could
someone point me where to look?

Thanks,
--Mark.

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: getting the calling function name.

2001-08-07 Thread Curtis Poe

--- Rajeev Rumale [EMAIL PROTECTED] wrote:
 Thanks  Dwalu,
 
 But the what i need is the grep the name of the sub which is calling the
 loging sub.
 As you have suggested caller only gives only the name of current sub
 routine that is debugLogger it self.
 And I had to do call the caller before calling the debugLogger and pass
 all the info to it.
 
 What i need is the the name of the sub rotuine which is calling the sub
 debuLogger.

Pass it as an argument:
 
sub someSub{
statement 1;
statement 2;
statement 3;
debugLogger($message, (caller(0))[3]);
anotherSub;
}

sub anotherSub{
statement 1;
statement 2;
statement 3;
debugLogger($message, (caller(0))[3]);
}


sub debugLogger {
my ( $message, $sub_name ) = @_;

open (LOGGER,  my.log) || die  unable to ope the log file;
print LOGGER \n;
print LOGGER \nCalled from $sub_name.;
print LOGGER \n$message;
print LOGGER \n;
close LOGGER;
}

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: getting the calling function name.

2001-08-07 Thread Dwalu Z. Khasu

Good morning,

'caller' also takes an optional argument that specifies how far up the
calling stack (list of embedded functions) to traverse.  Try experimenting
with caller($i) where $i  0 in your 'debugLogger' subroutine and you'll
see what I mean.  'caller' in a list context prints out additional data so
for just the function/subroutine name, try (caller($i))[3].

Make it fun...play around a little :-)

- Dwalu
.peace
--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
- Student Creed

On Sat, 7 Jul 2001, Rajeev Rumale wrote:

=Thanks  Dwalu,
=
=But the what i need is the grep the name of the sub which is calling the
=loging sub.
=As you have suggested caller only gives only the name of current sub
=routine that is debugLogger it self.
=And I had to do call the caller before calling the debugLogger and pass
=all the info to it.
=
=What i need is the the name of the sub rotuine which is calling the sub
=debuLogger.
=
=Consider the following subs
=
=
=sub someSub{
=statement 1;
=statement 2;
=statement 3;
=debugLogger($message);
=anotherSub;
=}
=
=sub anotherSub{
=statement 1;
=statement 2;
=statement 3;
=debugLogger($message);
=}
=
=
=sub debugLogger {
=
=my $message = @_;
=
= $sub_name = ; #  Get the subroutine name.This is what i need to grep.
=
=open (LOGGER,  my.log) || die  unable to ope the log file;
=print LOGGER \n;
=print LOGGER \nCalled from $sub_name.;
=print LOGGER \n$message;
=print LOGGER \n;
=close LOGGER;
=
=}
=
=
=
=So if the sub someSub is called
=The information I expect in the file is .
=
=
=called from someSub
=Here is the message.
=
=
=
=called from anotherSub
=Here is the message.
=
=
=
=with regards
=
=Rajeev Rumale
=
=
=-
=Artificial Intelligence is no match for Natural Stupidity.
=
=-
=
=
=- Original Message -
=From: Dwalu Z. Khasu [EMAIL PROTECTED]
=To: Rajeev Rumale [EMAIL PROTECTED]
=Cc: Beginners-Cgi (E-mail) [EMAIL PROTECTED]
=Sent: Monday, August 06, 2001 3:47 PM
=Subject: Re: getting the calling function name.
=
=
= See perldoc -f caller
=
=
= On Mon, 6 Aug 2001, Rajeev Rumale wrote:
=
= =Hello Every Body,
= =
= =I need some help.
= =I am using a sub routine to log all the messages to be used for
=debugging
= =purpose.
= =ie. debugLogger($debug_message);
= =Since very similare kind of messages are genrated at serveral places, I
=add
= =the function name.
= =i.e., debugLogger(inside x  \n $debug_message);
= =
= =I feel it would be better as a prgramming style if sub debugLog is able
=to
= =find the name of the calling function or the name of the function
= =calling this sub and genrate the appropriate message.
= =
= =
= =with regards
= =
= =
= =Rajeev Rumale
= =
= =
= =***
= = The human race has one really effective weapon, and that is
=laughter.
= =***
= =
= =
= =
= =--
= =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]
=
=





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




RE: Redirecting STDOUT

2001-08-07 Thread Mark Ross

Have you taken a look at the GnuPG or Crypt::GPG
modules on CPAN?

Yep, I've looked (and longed), but my Web hosting
service refers to them as hooky. I think he's
hostile because they aren't version 1 or higher (not
that it really makes much difference). I also don't
have the ability to directly ftp info into my cgi-bin,
so I can't install the modules myself. I have to feed
scripts to the hosting's support staff.

I know using a module would be much better (I am quite
the newbie), but I'm think I'm stuck trying it myself.

So, other than changing hosting providers, any hints?

--Mark.

 I have a Perl script that takes the contents of a
 form, feeds them to GnuPG for encryption and then
 emails me the encrypted document. GPG wants to
either
 display the results in STDOUT or write a text file,
 both of which aren’t good.

 I was hoping redirect STDOUT to a variable for a
short
 time.

 I’ve seen references to redirecting filehandles in
the
 documentation, but no details on how to do it.
(Which
 I’m sure are there, but I’ve just missed). Could
 someone point me where to look?

 Thanks,
 --Mark.



__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




double quotes within a cgi-argument

2001-08-07 Thread shawn

I've been scrounging the internet for this answer, but can't find one


html code

a
href=edit.pl?submit=editid=$$row{'id'}title=$$row{'title'}description=$$
row{'description'}model=$$row{'model'}serial=$$row{'serial'}value=$$row{'
valuation'}status=$$row2{'description'}manufacturer=$$row3{'name'}categor
y=$$row4{'name'}catnum=$$row{'category'}notes=$$row{'notes'}EDIT/a


/html code

This code works, if, and only if there are _no_ double_quotes(  ) received
from the database. Yes you guessed it, there are some things that have ('s
i.e. 17 monitor, 24 cable). As you know, double quotes end the href
string.

Question being, how to include a double quote into the href string(s)?

Thanks,
Shawn


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




RE: Redirecting STDOUT

2001-08-07 Thread Curtis Poe

--- Mark Ross [EMAIL PROTECTED] wrote:
 Have you taken a look at the GnuPG or Crypt::GPG
 modules on CPAN?
 
 Yep, I've looked (and longed), but my Web hosting
 service refers to them as hooky. I think he's
 hostile because they aren't version 1 or higher (not
 that it really makes much difference). I also don't
 have the ability to directly ftp info into my cgi-bin,
 so I can't install the modules myself. I have to feed
 scripts to the hosting's support staff.
 
 I know using a module would be much better (I am quite
 the newbie), but I'm think I'm stuck trying it myself.
 
 So, other than changing hosting providers, any hints?
 
 --Mark.

Well, here's one hint, though it may be a stretch:  on a post at Perlmonks, someone 
claimed that
they could not use CGI.pm due to the server [he] will be using [his program] on.  
Randal
Schwartz pointed out that this still wasn't an excuse: 
http://www.perlmonks.org/index.pl?node_id=77669lastnode_id=9073

The point of that post is that there *are* ways you can sneak modules into your code.  
Give it a
shot and see what happens.  If your code is subjected to code review by the support 
staff, I can
virtually guarantee that they do not know Perl terribly well.  You may want to alter 
some of the
comments and POD to disguise the source (if this is allowed under the license).

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: double quotes within a cgi-argument

2001-08-07 Thread Curtis Poe

--- shawn [EMAIL PROTECTED] wrote:
 I've been scrounging the internet for this answer, but can't find one
 
 
 html code
 
 a
 href=edit.pl?submit=editid=$$row{'id'}title=$$row{'title'}description=$$
 row{'description'}model=$$row{'model'}serial=$$row{'serial'}value=$$row{'
 valuation'}status=$$row2{'description'}manufacturer=$$row3{'name'}categor
 y=$$row4{'name'}catnum=$$row{'category'}notes=$$row{'notes'}EDIT/a
 
 
 /html code
 
 This code works, if, and only if there are _no_ double_quotes(  ) received
 from the database. Yes you guessed it, there are some things that have ('s
 i.e. 17 monitor, 24 cable). As you know, double quotes end the href
 string.
 
 Question being, how to include a double quote into the href string(s)?
 
 Thanks,
 Shawn

If the query string needs something like Curtis Ovid Poe, it gets encoded like this:

name=Curtis%20%22Ovid%22%20Poe

Check out the URI::Escape module for information on how to handle this properly.

And before Randal chews us out for not mentioning this :), the ampersands in your href 
should be
changed to amp;  For example:

color=redcolor=bluename=Curtis Ovid Poe

Becomes

color=redamp;color=blueamp;name=Curtis%20%22Ovid%22%20Poe

Cheers,
Curtis Ovid Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




How to profile CGI scripts?

2001-08-07 Thread Jason Purdy

Disclaimer: I've read the docs, talked to several folks, and played around
with the scripts, but I must be missing something.

I'd like to get the tmon.out file output from the -d:DProf flag when my
CGI scripts execute remotely on the web server that I'm developing on, but
whenever I add the '-d:DProf' flag in the shebang line, I get a 500 Internal
Server Error.  I've also tried setting the 'PERL_DPROF_OUT_FILE_NAME'
environment variable in a BEGIN block.

Any thoughts?

Thanks in advance,

Jason


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




Re: M$ Word to HTML

2001-08-07 Thread Morten Liebach

On  7, Aug, 2001 at 12:11:29PM -0400, Mark Saunders wrote:
 Yeah, the dreamweaver 'Clean up Word HTML' is amazing.  
 It does miss some tags, like class, so you have to take an extra step or
 two to remove them.

HTML-TIDY claims to be able to clean up dirty Word html, get it from
http://www.w3.org/People/Raggett/tidy/.

And it's free!

Regards
Morten

-- 
×·.¸¸.·´¨)¸.·´  ¸.·´¨) OMorten Liebach [EMAIL PROTECTED]
(_¸.·´ (¸.·´  ¸.·× 0http://home1.stofanet.dk/liebach/
 (_¸.·´ohttp://pc89225.stofanet.dk/
   .

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




Re: How to profile CGI scripts?

2001-08-07 Thread Curtis Poe

--- Jason Purdy [EMAIL PROTECTED] wrote:
 Disclaimer: I've read the docs, talked to several folks, and played around
 with the scripts, but I must be missing something.
 
 I'd like to get the tmon.out file output from the -d:DProf flag when my
 CGI scripts execute remotely on the web server that I'm developing on, but
 whenever I add the '-d:DProf' flag in the shebang line, I get a 500 Internal
 Server Error.  I've also tried setting the 'PERL_DPROF_OUT_FILE_NAME'
 environment variable in a BEGIN block.
 
 Any thoughts?
 
 Thanks in advance,
 
 Jason

I just tested a command line script by putting -d:Dprof in the shebang line and didn't 
have any
problem.  Of course, I'm using ActiveState here and that might make a difference.  
Perhaps you
could tell us what's in your error log?

You could create a new file extension and associate that with the -d:Dprof flag.  
Then, run the
script (with the new extension) and manually grab the tmon.out file.  You could even 
write another
perl script that runs continually in the background and detects the creation of the 
tmon.out file,
grabs it, and writes it to a new directory with some sort of identifier embedded in 
the filename.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: How to profile CGI scripts?

2001-08-07 Thread Jason Purdy

 I just tested a command line script by putting -d:Dprof in the shebang
line and didn't have any
 problem.  Of course, I'm using ActiveState here and that might make a
difference.  Perhaps you
 could tell us what's in your error log?

Yea ... that's another problem - I don't have access to the error log -
talk about your pure black box development. ;)  The server I use is hosted
by ValueWeb and it's a Linux box (I also believe it's an Apache server).
The server I'm developing on is also Apache, but Win2K and ActiveState.
 The -d:DProf flag works fine on my box, though it's not using my
$ENV{PERL_DPROF_OUT_FILE_NAME} definition.

 You could create a new file extension and associate that with the -d:Dprof
flag.  Then, run the
 script (with the new extension) and manually grab the tmon.out file.  You
could even write another
 perl script that runs continually in the background and detects the
creation of the tmon.out file,
 grabs it, and writes it to a new directory with some sort of identifier
embedded in the filename.

Not following you here.  The presence of -d:DProf seems to result in a 500
error for any script on the host I'm using, even a simple Hello World
script.

Jason


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




AW: href arguments

2001-08-07 Thread Alessandro Lenzen

Hello Francesco,

first of all you should read the CGI.pm manpage if you want to write good
CGIs.
You don't need to use the CGI.pm module, but it is considered good
programming practice and it saves a lot of time since you don't have to
bother with a lot of things.

The following code should help you get the idea:

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
my $file = param(filename);
#now the blahblah bit is extracted and saved in $file


-Ursprüngliche Nachricht-
Von: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 7. August 2001 13:05
An: [EMAIL PROTECTED]
Betreff: href arguments


Hi,

THis is probably a simple question.  Am new to perl and CGI so please
have mercy. I have a script which displays a list of files with links
to them.  The links when hovered over in a browser show as:

display_file.pl?filename=blahblah

How can I extract the blahblah bit (which is the name of the selected
file) so that the display_file.pl script can know which file it is to
open and process?  I think this makes sence.  I want the script
display_file.pl to perform an action on file blahblah.

TIA

Francesco

--
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]




AW: AW: href arguments

2001-08-07 Thread Alessandro Lenzen

Oh, I see. I'm a bit confused. Maybe it's my fault...
Do you have a string like display_file.pl?filename=blahblah or are you
calling the CGI with http://www.domain.it/display_file.pl?filename=blahblah
?
The code I wrote is for the latter...
In the first case, you could use regexes:

#!/usr/bin/perl
$_ = display_file.pl?filename=blahblah;
m/=(\w+)$/;
$file = $1;

This works quite fine, but it is no good, if the String looks like
http://www.domain.it/display_file.pl?filename=blahblahsex=yespleasedrugs=j
ustsayno

But I think you got the idea...
No, wait. I got the idea...

m/filename=(\w+)?/;

should work perfectly...

al
-Ursprüngliche Nachricht-
Von: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 7. August 2001 13:33
An: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Betreff: Re: AW: href arguments


## Alessandro Lenzen [EMAIL PROTECTED] on: Tue, 7 Aug 2001
13:21:22 +0200 ##
::  Hello Francesco,
alenzen::
alenzen:: first of all you should read the CGI.pm manpage if you want to
write good
alenzen:: CGIs.
alenzen:: You don't need to use the CGI.pm module, but it is considered
good
alenzen:: programming practice and it saves a lot of time since you don't
have to
alenzen:: bother with a lot of things.
alenzen::
alenzen:: The following code should help you get the idea:
alenzen::
alenzen:: #!/usr/bin/perl -w
alenzen:: use strict;
alenzen:: use CGI qw(:standard);
alenzen:: my $file = param(filename);
alenzen:: #now the blahblah bit is extracted and saved in $file
alenzen::
alenzen::
alenzen:: -Ursprüngliche Nachricht-
alenzen:: Von: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
alenzen:: Gesendet: Dienstag, 7. August 2001 13:05
alenzen:: An: [EMAIL PROTECTED]
alenzen:: Betreff: href arguments
alenzen::
alenzen::
alenzen:: Hi,
alenzen::
alenzen:: THis is probably a simple question.  Am new to perl and CGI so
please
alenzen:: have mercy. I have a script which displays a list of files with
links
alenzen:: to them.  The links when hovered over in a browser show as:
alenzen::
alenzen:: display_file.pl?filename=blahblah
alenzen::
alenzen:: How can I extract the blahblah bit (which is the name of the
selected
alenzen:: file) so that the display_file.pl script can know which file it
is to
alenzen:: open and process?  I think this makes sence.  I want the script
alenzen:: display_file.pl to perform an action on file blahblah.
alenzen::
alenzen:: TIA
alenzen::
alenzen:: Francesco
alenzen::
alenzen:: --
alenzen:: To unsubscribe, e-mail: [EMAIL PROTECTED]
alenzen:: For additional commands, e-mail: [EMAIL PROTECTED]
alenzen::
alenzen::

I didn't generate a form - I am obviously mistaken as I was under the
impression that to use the param call then a form had to specify it.
Boy have I got much to learn.

Cheers

Francesco


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




RE: href arguments

2001-08-07 Thread Joel Hughes

Sidrath,
is there any need to adopt that surly attitude when responding?

joel

-Original Message-
From: Sidharth Malhotra [mailto:[EMAIL PROTECTED]]
Sent: 07 August 2001 13:23
To: 'Francesco Scaglioni'
Cc: '[EMAIL PROTECTED]'
Subject: RE: href arguments


Once again.  This is a problem that can be easily solved reading the CGI
module documentation at:
http://www.perldoc.com/perl5.6/lib/CGI.html

use the CGI module:
Perl

use CGI;
my $q = new CGI;
my $filename = $q-url_param('filename'); # or
my $filename = $q-param('filename');

/Perl


-Original Message-
From: Francesco Scaglioni [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 7:05 AM
To: [EMAIL PROTECTED]
Subject: href arguments


Hi,

THis is probably a simple question.  Am new to perl and CGI so please
have mercy. I have a script which displays a list of files with links
to them.  The links when hovered over in a browser show as:

display_file.pl?filename=blahblah

How can I extract the blahblah bit (which is the name of the selected
file) so that the display_file.pl script can know which file it is to
open and process?  I think this makes sence.  I want the script
display_file.pl to perform an action on file blahblah.

TIA

Francesco

-- 
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]



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




Newbie -- got a question

2001-08-07 Thread Lee Hoffner

I'm new to scripting in PERL (I've only done Javascript and Lingo before).

I'm building a script to write an HTML page on the fly, using image files
that are in a directory that is given to the script as a variable. How do I
pass my variable to my script from the HREF link that my user clicks? (EG:
my script is in my cgi-bin directory and is named pgbuilder.pl. Do I make
the link something like
http://www.domain.com/cgi-bin/pgbuilder.pl?archimage, where archimage is
the name of the directory I want to pass the script?

The script itself will use
   $dir = param('dir')
to receive/store the variable.



Thanks!

__
Lee Hoffner


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




Re: Newbie -- got a question

2001-08-07 Thread Curtis Poe

--- Lee Hoffner [EMAIL PROTECTED] wrote:
 I'm new to scripting in PERL (I've only done Javascript and Lingo before).
 
 I'm building a script to write an HTML page on the fly, using image files
 that are in a directory that is given to the script as a variable. How do I
 pass my variable to my script from the HREF link that my user clicks? (EG:
 my script is in my cgi-bin directory and is named pgbuilder.pl. Do I make
 the link something like
 http://www.domain.com/cgi-bin/pgbuilder.pl?archimage, where archimage is
 the name of the directory I want to pass the script?
 
 The script itself will use
$dir = param('dir')
 to receive/store the variable.

You almost had it!  First, you'll probably want to tweak the HREF link just a bit:

http://www.domain.com/cgi-bin/pgbuilder.pl?dir=archimage

Then, the Perl code:

use strict;
use CGI qw/ :standard /;
my $dir = param( 'dir' );

However, this could be a problem.  What, exactly, is 'dir' supposed to contain and how 
do you want
to open that directory?  If you are opening directories and serving content directly 
from them,
you could have some serious security issues.  Unfortunately, security is very 
difficult to get
right.  One example of how this can go horribly wrong is at
http://www.perlmonks.org/index.pl?node_id=36121

If you can post some more of your code (particularly what you're doing with $dir), we 
can go over
it and let you know if there are any issues that you may want to address.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: Newbie -- got a question

2001-08-07 Thread Lee Hoffner

I think you might want to see my script, to see where I am trying to go. As
this is my first day on this list, I'd like to know if it's okay for me to
post an entire script before I do. It's 69 lines, with a lot of comments
stating what I am trying to do. Would you all mind if I post it, or would
you prefer to communicate with me off-list?

Much obliged!





- Original Message -
From: Lee Hoffner
To: PERL Beginner List
Sent: Tuesday, August 07, 2001 6:48 PM
Subject: Newbie -- got a question


I'm new to scripting in PERL (I've only done Javascript and Lingo before).

I'm building a script to write an HTML page on the fly, using image files
that are in a directory that is given to the script as a variable. How do I
pass my variable to my script from the HREF link that my user clicks? (EG:
my script is in my cgi-bin directory and is named pgbuilder.pl. Do I make
the link something like
http://www.domain.com/cgi-bin/pgbuilder.pl?archimage, where archimage is
the name of the directory I want to pass the script?

The script itself will use
   $dir = param('dir')
to receive/store the variable.



Thanks!

__
Lee Hoffner





Re: Newbie -- got a question

2001-08-07 Thread Curtis Poe

--- Lee Hoffner [EMAIL PROTECTED] wrote:
 I think you might want to see my script, to see where I am trying to go. As
 this is my first day on this list, I'd like to know if it's okay for me to
 post an entire script before I do. It's 69 lines, with a lot of comments
 stating what I am trying to do. Would you all mind if I post it, or would
 you prefer to communicate with me off-list?
 
 Much obliged!

Considering what you are trying to do, I think seeing the entire script would probably 
be a good
thing.  Sixty-nine lines is not very long, but others on this list might disagree.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: Newbie -- got a question

2001-08-07 Thread Lee Hoffner

Thanks, Curtis! Below is the script. (I hope it's clear!)



#!/usr/local/bin/perl

#This script will be called using the POST method, 
#contained in a HREF that the
#site visitor clicked on.
#The call will contain an argument, which will 
#be the name of the directory for the
#script to read using READDIR.


use strict;
use CGI qw/:standard/;
my $dir = param('dir');

#Verify that the requested directory exists.
#I imagine I want to say something like:
if (-d $dir) {

#Anyway, if the directory represented by 
# $dir does exist, 
# I start a table on the HTML page...
 print END;
 Content-Type: text/html\n\n
 html
 body
 table
 END
 #...then I build an array of all files that are GIF or JPEG...
 #(I think this would get me all the files in the directory $dir.)
 #(By the way, do I need my in front of this declaration?)

 @filearray = opendir(D,$dir) or die $!;

 #From the complete listing in @filearray, 
 #build a new array, which contains only
 #files of HIF and JPG types...

@imagefiles = grep/\.(gif|jpg)$/,readdir(D);
closedir D;

#With @imagefiles successfully defined, I want to loop through the slots
#in @imagefiles, using each entry as the IMG SRC in a new table row...
 for ($i = 0; $i = $#imagefiles; $i++) {
 print END;
 tr
 td
 img src=$i
 /td
 /tr
 END
 last;
 }
 
 #With the loop finished, the script finishes writing the HTML page.
 print END;
 /table
 /body
 /html
 END
 #Fail (somewhat) gracefully...
 } else {
 print END;
 Content-Type: text/html\n\n
 html
 body
 H3The directory could not be found.
 /body
 /html
 END
}


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




Re: M$ Word to HTML

2001-08-07 Thread Richard Hulse

Adam,

I needed a clean output from Word for very large docs that only have 
paragraph styles. So I wrote a little VB macro that tags anything in Word 
with its style. It only handles para styles not other formatting.

So after running the macro: a heading1 styled paragraph would be end up as 
heading1the heading/heading1.
Normal would be: normalthis is body text/normal.

The file is saved as text and can then be parsed as simple xml with Perl.

regards,
Richard


At 11:22 7/08/01 -0400, Brett W. McCoy wrote:
  Does anyone know of a perl module/program to convert M$ Word documents 
 into HTML?  I have looked at the perldocs, and searched CPAN, but haven't 
 found one.


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




Re: Newbie -- got a question

2001-08-07 Thread Lisa Nyman

Hi,

On Tue, 7 Aug 2001, Lee Hoffner wrote:

 use strict;
 use CGI qw/:standard/;
 my $dir = param('dir');
 
 #Verify that the requested directory exists.
 #I imagine I want to say something like:
 if (-d $dir) {
 
  print END;
  Content-Type: text/html\n\n
  html
  body
  table
  END

  @filearray = opendir(D,$dir) or die $!;

Since you've already opened the HTML page, you would want a graceful die
procedure here, something like

dieNice {  # assume http headers sent already and html page has begun
print Sorry, this system is unavailable now.P
print /BODY/HTML;
exit;
} 

I like to tell users that a system is unavailable rather than some not
found message.   Of course in this case, you'd want to send yourself a
message since you're passing the image directory to yourself, but a user
can change it.

Lastly, you could also pass the image directory as a PATH_INFO variable:

http://foo.com/script.pl/image_dir

$ENV{PATH_INFO} = image_dir  (I can't remember if / is included or not)


Lisa Wolfisch Nyman  [EMAIL PROTECTED]  IT Warrior Princess
Life is too short to wear ugly underwear.
Get the facts at http://quickfacts.census.gov/




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




Re: getting the calling function name.

2001-08-07 Thread Me

 caller only gives only the name of current sub

You didn't read the docs carefully enough...

caller($calldepth)

perldoc -f caller


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




Re: PERL and HTML question...

2001-08-07 Thread Tom Malone

The difference between HTML version 3.2 and version 4.0 is the number and 
type of tags that are available to you. The browsers don't really know the 
difference between the different versions - they just either support the 
latest version (4.0) or they don't. You'll find out when you try to use some 
4.0 version tags and they don't work. 
As a general rule, I have found that Internet Explorer 5.0 and above supports 
most elements of HTML 4.0 pretty well. Netscape 6.0 also supports it pretty 
well, although each browser has it's own implementation of the HTML 4.0 
standards, which differs from the other's implementation. Netscape 4.* does 
not support many elements of HTML 4.0 very well, except for some aspects of 
Cascading Style Sheets, such as font-size, colors, etc. Some of the 3.* and 
earlier browsers do not even support HTML 3.2 very well, and you would be 
surprised how many people (and even whole organizations) out there are still 
using these old browsers for some strange reason.
Again, all the above browser information comes from my own experience as a 
web designer.  There are websites out there that provide more detailed (and 
probably more accurate) information about which browsers support different 
standards and how they implement them.  Try webreference.com

Tom Malone
http://www.tom-malone.com

On Tuesday 07 August 2001  1:46, you wrote:
 Dear List,

 printHTML;
   head
   HELLO WOLRD!
   /head
 HTML

 If this HTML is being run with Perl which it is of coarse how would I know
 what version of the HTML it is.

 I really hope this makes sense.  I read there is alot of different versions
 of HTML such as 3.2 and 4.0.  Does the browser take care of this?

 Regards,

 Daniel Falkenberg

 ==
 VINTEK CONSULTING PTY LTD
 (ACN 088 825 209)
 Email:  [EMAIL PROTECTED]
 WWW:http://www.vintek.net
 Tel:(08) 8523 5035
 Fax:(08) 8523 2104
 Snail:  P.O. Box 312
 Gawler   SA   5118
 ==

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




Re: PERL and HTML question...

2001-08-07 Thread Michael Fowler

On Tue, Aug 07, 2001 at 03:16:44PM +0930, Daniel Falkenberg wrote:
 printHTML;
   head
   HELLO WOLRD!
   /head
 HTML
 
 If this HTML is being run with Perl which it is of coarse how would I know
 what version of the HTML it is.

HTML is not run, it's not a programming language, or really anything that
can be 'run'.  It's rendered by your web browser, but that's really
irrelevant here.  Your Perl program has no idea it's dealing with HTML, it's
simply outputting the text you told it to.

 
 I really hope this makes sense.  I read there is alot of different versions
 of HTML such as 3.2 and 4.0.  Does the browser take care of this?

Yes.


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

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




Compare large files memory error

2001-08-07 Thread Mbedish

Is there a better way to compare large files than this snippet, which runs out of 
memory if files  30mb. 

It is also slow, about the same speed as comparing in a text editor!

Thank you.

__SNIP__

@file1 =  (IN1);
@file2 =  (IN2);
$are_equal = compare_arrays(\@file1, \@file2);

if ($are_equal) {

print Files are IDENTICAL \n;
}

else

{

print Files are DIFFERENT \n;
}

sub compare_arrays {
   my ($first, $second) = @_;
   #no warnings;  # silence spurious -w undef complaints
   return 0 unless @$first == @$second;
   for (my $i = 0; $i  @$first; $i++) {
   return 0 if $first-[$i] ne $second-[$i];
   }
   return 1;
   }

__SNIP__

Regards,

Mark

Surrey,UK




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




Upgrade woes!

2001-08-07 Thread d_c_s

Hi all, I wonder if someone can shed any light on this for me. 

I run a Solaris 8 machine (sparc) at work and had problems installing DBI for perl 
5.6.0 - for future reference (for other newbies) if your perl has come precompiled on 
your system, and you install gcc to compile modules, perl doesn't like it!  Anyway to 
cut a long story short I got 5.6.1 from CPAN, compiled with gcc - and installed DBI..

Then things started to go wrong.  My intranet site relies quite heavily on perl and a 
number of things stopped working.

Checking the apache error logs:

 BEGIN failed--compilation aborted at /usr/apache/htdocs/mrbs/badpw.pl line 8.
Can't locate strict.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.1/sun4-solaris 
/usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at 
/usr/apache/htdocs/mrbs/badpw.pl line 8.

obviously the call to use strict in badpw.pl is erroring. However I thought strict.pm 
was installed as standard!!!
I'm not familiar with @INC - its not in my llama book :(

strict.pm is located in 
/usr/local/lib/perl5/5.6.1/strict.pm though!!

bash-2.03# find / -name strict.pm
/usr/perl5/5.00503/strict.pm
/usr/local/lib/perl5/5.6.1/strict.pm

so now I'm twice as confused and humbly request a helping hand!

cheers,

Dan

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




connectivity

2001-08-07 Thread vsarunkumar

hai
i tried to pass  three variables  obtain the output to be in table format
.but i could not get any output.
The code is as follows.

my html program (calling)
html
head
title h2 Post Method /h2 /title
/head
body
pre
form method = post action = http://mc6308/cgi-bin/check.cgi;br
Name  input type = text name = Name br
Age   input type = text name = Age br
City  input type = text name = City br
 input type=submit name=Submit value=SUBMIT

/pre
/form
/body


my cgi program (called )
print Content-type: text/html \n\n;

$indata = STDIN;
@store = split(,$indata);
for($i=0; $i=$#store; $i++)
{

   ($name[$i],$value[$i]) = split ( =, $store[$i] );
$value[$i] =~ s/%(..)/pack (C,hex($1))/ge;
$value[$i] =~ s/\+/ /ge;
}
$i=0;

print EOD;

html
head
title h2 This is an example for the post method /h2
/title
/head
body
table border = 4 
th align=lefth3 NAME /h3
th align=lefth3 AGE /h3
th align=lefth3 CITY /h3
trtd $value[ $i] td$value[++$i] td $value[++$i]
/table
/body
/html
EOD

 What is the problem ? How to change it

Thank you
With Regards..
Arun.





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




Re: Compare large files memory error

2001-08-07 Thread Maxim Berlin

Hello Mbedish,

Tuesday, August 07, 2001, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Mac Is  there  a better way to compare large files than this snippet,
Mac which runs out of memory if files  30mb.

Mac It is also slow, about the same speed as comparing in a text editor!

Mac Thank you.

Mac __SNIP__

Mac @file1 =  (IN1);
Mac @file2 =  (IN2);
first, it is a very bad practice to read entire file into memory.  for
example, if file size is bigger than free memory, you'll have unpredictable
result.
second, the slowest operation in your example is file I/O. your files
may have differences in second string, so you do not need to read rest of
file.


Mac $are_equal = compare_arrays(\@file1, \@file2);

Mac if ($are_equal) {

Mac print Files are IDENTICAL \n;
Mac }

Mac else

Mac {

Mac print Files are DIFFERENT \n;
Mac }

Mac sub compare_arrays {
Macmy ($first, $second) = @_;
Mac#no warnings;  # silence spurious -w undef complaints
third, you compare your arrays two times

first pass:
Macreturn 0 unless @$first == @$second;
second pass:
Macfor (my $i = 0; $i  @$first; $i++) {
Macreturn 0 if $first-[$i] ne $second-[$i];
Mac}

Macreturn 1;
Mac}

Mac __SNIP__
so, i can recommend something like
$retval=1;
while( $a=IN1 )
{
$b=IN2;
if ($a ne $b)
{
$retval=0; last;
}
}
close IN1; close IN2;
return $retval;

at the beginning, you can compare files size (perldoc -f stat).


Best wishes,
 Maximmailto:[EMAIL PROTECTED]



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




Re: Compare large files memory error

2001-08-07 Thread Jos I. Boumans

if you're just interested in *EXACTLY* the same files, use MD5 (get it from
search.cpan.org)
even one BIT of difference (literally) will result in a different checksum
thorough and fast

hth
Jos Boumans

- Original Message -
From: Maxim Berlin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 1:35 PM
Subject: Re: Compare large files memory error


 Hello Mbedish,

 Tuesday, August 07, 2001, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Mac Is  there  a better way to compare large files than this snippet,
 Mac which runs out of memory if files  30mb.

 Mac It is also slow, about the same speed as comparing in a text editor!

 Mac Thank you.

 Mac __SNIP__

 Mac @file1 =  (IN1);
 Mac @file2 =  (IN2);
 first, it is a very bad practice to read entire file into memory.  for
 example, if file size is bigger than free memory, you'll have
unpredictable
 result.
 second, the slowest operation in your example is file I/O. your files
 may have differences in second string, so you do not need to read rest of
 file.


 Mac $are_equal = compare_arrays(\@file1, \@file2);

 Mac if ($are_equal) {

 Mac print Files are IDENTICAL \n;
 Mac }

 Mac else

 Mac {

 Mac print Files are DIFFERENT \n;
 Mac }

 Mac sub compare_arrays {
 Macmy ($first, $second) = @_;
 Mac#no warnings;  # silence spurious -w undef complaints
 third, you compare your arrays two times

 first pass:
 Macreturn 0 unless @$first == @$second;
 second pass:
 Macfor (my $i = 0; $i  @$first; $i++) {
 Macreturn 0 if $first-[$i] ne $second-[$i];
 Mac}

 Macreturn 1;
 Mac}

 Mac __SNIP__
 so, i can recommend something like
 $retval=1;
 while( $a=IN1 )
 {
 $b=IN2;
 if ($a ne $b)
 {
 $retval=0; last;
 }
 }
 close IN1; close IN2;
 return $retval;

 at the beginning, you can compare files size (perldoc -f stat).


 Best wishes,
  Maximmailto:[EMAIL PROTECTED]



 --
 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: connectivity

2001-08-07 Thread Abdulaziz Ghuloum

Hello,

Why are you not using CGI.pm?  Why are you parsing the data yourself?
Doing so is very error prone and you *will* get into trouble.

Try doing the following in your script:

#!/usr/bin/perl -w
use strict;
use CGI qw/param/;

my $name = param('Name');
my $age = param('Age');
my $city = param('City');

print Content-type: text/html\n\n;

print EOF;
html
head
title h2 This is an example for the post method /h2 /title
/head
body
table border = 4 
th align=lefth3 NAME /h3
th align=lefth3 AGE /h3
th align=lefth3 CITY /h3
trtd $name td $age td $city /table
/body
/html
EOF


Hope this helps,,,

Aziz,,,


 hai
 i tried to pass  three variables  obtain the output to be in table
 format .but i could not get any output.
 The code is as follows.
 
 my html program (calling)
 html
 head
 title h2 Post Method /h2 /title /head
 body
 pre
 form method = post action = http://mc6308/cgi-bin/check.cgi;br
 Name  input type = text name = Name br Age   input type = text
 name = Age br City  input type = text name = City br
  input type=submit name=Submit value=SUBMIT
 
 /pre
 /form
 /body
 
 
 my cgi program (called )
 print Content-type: text/html \n\n;
 
 $indata = STDIN;
 @store = split(,$indata);
 for($i=0; $i=$#store; $i++)
 {
 
($name[$i],$value[$i]) = split ( =, $store[$i] );
 $value[$i] =~ s/%(..)/pack (C,hex($1))/ge; $value[$i] =~ s/\+/
 /ge;
 }
 $i=0;
 
 print EOD;
 
 html
 head
 title h2 This is an example for the post method /h2 /title
 /head
 body
 table border = 4 
 th align=lefth3 NAME /h3
 th align=lefth3 AGE /h3
 th align=lefth3 CITY /h3
 trtd $value[ $i] td$value[++$i] td $value[++$i] /table
 /body
 /html
 EOD
 
  What is the problem ? How to change it
 
 Thank you
 With Regards..
 Arun.
 
 
 


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




RE: ideas to clean this up?

2001-08-07 Thread Yacketta, Ronald

Peter,

Thanxs for the help!
I found a little typo in your code tho

 foo (@{$logFiles{$key})
should be
 foo (@{$logFiles{$key}})

missed that trailing } ;)

-Ron

 -Original Message-
 From: Peter Scott [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 15:20
 To: Yacketta, Ronald; Beginners (E-mail)
 Subject: RE: ideas to clean this up?
 
 
 At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
 Thanxs!
 
 now off to modify my exec code that parses an entire array 
 of files :)
 
 Of course, the arrayrefs could equally well have been stored 
 in an array 
 instead of a hash.  There's a thin justification for a hash 
 in the absence 
 of any other context, but the actual context could easily change that.
 
 And your exec code ought not to have to change.  If you're 
 used to doing 
 something that says
 
  foo (@files)
 
 then just do instead
 
  foo (@{$logFiles{$key})
 
 where $key is one of the hash keys - obviously now you can 
 loop through all 
 of them.
 
   This may seem a little obvious, but...
  
   my %logFiles;
   for my $key (1 .. 6) {
  opendir DIR, ../logs/set$key or die opendir
   ../logs/set$key: $!\n;
  push @{$logFiles{$key}}, map ../logs/set$key/$_,
   grep !/^\.\.?$/, sort readdir DIR;
  closedir DIR;
   }
  
   Now the filenames are in arrays which are referenced from the
   values of the
   hash %logFiles (keys are 1 through 6, but maybe you want 
 to use the
   directory name instead).  I took the liberty of removing 
 the usually
   useless directory entries and sorting, since you'll probably
   want them
   sorted later.
 
 --
 Peter Scott
 Pacific Systems Design Technologies
 http://www.perldebugged.com
 

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




Re: Executing the kill command from within an suid script.

2001-08-07 Thread Elaine -HFB- Ashton

Jeff Rouse/NCO/CEtv [[EMAIL PROTECTED]] quoth:
*
*I have been an SA and DBA for 7 years and have worked in a lot of different
*environments for several companies and I didn't go into apoplectic shock at
*my suggestion :-)

Look at the suidperl source code, you will :) suid, even if root is not
the target id, is inherently insecure because of how suid operates. 

I hear XML-RPC is the new wave of web services for things such as this so
you might have a look just for fun.

e.

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




magic import of extensions?

2001-08-07 Thread Edwin Günthner

Hi there,

I am wondering if it is possible to create my own module
and to allow programers to use it without any importing or so.

For example, if MyPackage has subs like init, doThis, 
doThat - is it possible to have a script that looks like:

scr.pl:

init;
doThis $someArg;
doThat $anotherArg $oneMore;

and just run it with 

 perl scr.pl

.. so what I am looking for is a mechanism
to automatically load MyPackage whenever
Perl starts. Is that possible?

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




RE: magic import of extensions?

2001-08-07 Thread Tu, Hanming

Yes. Here is how

1) In your MyPackage.pm, you import the Exporter module as

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(init doThis doThat);

2) install MyPackage in a search directory, i.e., including your path in
@INC

3) Then in your scr.pl or other programmer's scripts

use MyPackage;

Those subs will be imported into the scripts.

Hanming


-Original Message-
From: Edwin Günthner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 10:30 AM
To: [EMAIL PROTECTED]
Subject: magic import of extensions?


Hi there,

I am wondering if it is possible to create my own module
and to allow programers to use it without any importing or so.

For example, if MyPackage has subs like init, doThis, 
doThat - is it possible to have a script that looks like:

scr.pl:

init;
doThis $someArg;
doThat $anotherArg $oneMore;

and just run it with 

 perl scr.pl

.. so what I am looking for is a mechanism
to automatically load MyPackage whenever
Perl starts. Is that possible?

-- 
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: Remove White Space

2001-08-07 Thread Scott Martin

Ahh!! Thanks for help.  That did it.

-Scott


-Original Message-
From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 11:46 AM
To: [EMAIL PROTECTED]
Cc: Perl Help
Subject: RE: Remove White Space


On Aug 7, Scott Martin said:

I am stumped, none of these are working.  I even tried something like
$url=~s/\t*^\.htm/\.htm/g

Well, that is totally broken, so don't worry.

   $url =~ s/br//gs;#removes accidental br in the file

That /s modifier is totally useless there.

   $url=~s/\t*^\.htm/\.htm/g  #the troubled line I can't figure
out, 
remove the space between filename and .htm

If you want to remove ANY whitespace immediately preceding the .htm,
then
do:

  $url =~ s/\s+\.htm/.htm/;

If you want to remove ANY whitespace in the string at all, do:

  $url =~ s/\s+//g;

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


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




Re: ideas to clean this up?

2001-08-07 Thread Romek Krisztián

Hello!

 And your exec code ought not to have to change.  If you're used to doing
 something that says

  foo (@files)

 then just do instead

  foo (@{$logFiles{$key})

 where $key is one of the hash keys - obviously now you can loop through
all
 of them.

Sorry, but did you forget a brace?

foo (@{$logFiles{$key}})

Krisztian


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




Newbie Question about subroutine

2001-08-07 Thread Barry Carroll


Hi all, i want to have a subroutine for checking user input:

here is a snippet of the code:

print (Is your Terminal ANSI compliant?\nYes or No, \(y\) or \(n\)?\n);
chomp ($input = STDIN);

verifyInput($input);

sub verifyInput
{
# Subroutine to verify input
# Will return the correct value
# and discard bad values

my $vInput = @_;

processing in here

}

The problem is that I tried entering 'y', 'n', anything!, but no luck.
I found out that $vInput is always getting assigned the numeric value '1'.

The rest of the sub after this is fine, if i could just figure out why
$vInput is being assigned '1'

Any ideas? - Thanks in advance :)

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




Perl script to telnet into another box ... help ...

2001-08-07 Thread innovative-peripherals

I have a project where I have to run a job on demand on 
another box. Since I can telnet into that box from the server 
I'm running my Perl scripts on, I'd like to write a script that 
would telnet into that box.

But I think my problem would be adding whatever symbol
to the end of my login ID that the system would interpret 
as an ENTER key being pressed. The same problem 
would exist for my password ID and also for the command 
line I would execute after the login ID and the password ID.

Does anyone know what I need to add? (like X0D, or X0A, 
or something like that ...)

Thanks,

~


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




length of an array

2001-08-07 Thread Romek Krisztián

Hello!

@array[$a] = [1, 2, 3, 4, 5];

How can I determine the length of an array inside an array?

I tried the followings:

$length = $#array[$a]# -- syntax error
$length = scalar(@array[$a]) # -- ARRAY(blablabla)

Any ideas?

Krisztian


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




pls ignore last msg

2001-08-07 Thread Barry Carroll


sorry guys i got it, silly mistake

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




RE: ideas to clean this up?

2001-08-07 Thread Peter Scott

[My rule is that beginners' questions arising from a thread on the 
beginners' list get answered on the list, FYI.  I may make mistakes that 
others will catch.]

At 09:37 AM 8/7/01 -0400, Yacketta, Ronald wrote:
Peter,

Does this look correct?

exec egrep, $lookFor, @{$logFiles{$_}} unless $pid=fork; # fork new process
for cmd

Your egrep ought to be quoted, unless you're running without strictness 
enabled, in which case you have more problems...

That will in fact background an egrep command like you want.  It's output 
will go to wherever your program's output goes.  It won't be captured by 
your program.  If your program is going to continue for any great length of 
time or is going to spawn a lot of processes, make sure to waitpid() for 
your children.

Since you're using egrep rather than grep, I assume you want to take 
advantage of it's extended regex syntax, therefore your $lookfor may 
contain regex metacharacters.  Make sure you've escaped what needs to be 
escaped, etc.

I would use a perl regex, but it takes way to much cpu/time.

Perl's way of searching files with regexen will be just as fast as egrep's, 
possibly faster.

I need to
beable to spawn 3 - 4 utils to parse for the $lookFor in each file within
the logFiles array.

As long as you just want the results of an egrep search to go to your 
programs stdout and stderr, fine.  The day you want your program to get at 
those results, things will get more complicated and you'll probably end up 
doing the regex searching in Perl, still in forked children.

-Ron

  -Original Message-
  From: Peter Scott [mailto:[EMAIL PROTECTED]]
  Sent: Monday, August 06, 2001 15:20
  To: Yacketta, Ronald; Beginners (E-mail)
  Subject: RE: ideas to clean this up?
 
 
  At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
  Thanxs!
  
  now off to modify my exec code that parses an entire array
  of files :)
 
  Of course, the arrayrefs could equally well have been stored
  in an array
  instead of a hash.  There's a thin justification for a hash
  in the absence
  of any other context, but the actual context could easily change that.
 
  And your exec code ought not to have to change.  If you're
  used to doing
  something that says
 
   foo (@files)
 
  then just do instead
 
   foo (@{$logFiles{$key})
 
  where $key is one of the hash keys - obviously now you can
  loop through all
  of them.
 
This may seem a little obvious, but...
   
my %logFiles;
for my $key (1 .. 6) {
   opendir DIR, ../logs/set$key or die opendir
../logs/set$key: $!\n;
   push @{$logFiles{$key}}, map ../logs/set$key/$_,
grep !/^\.\.?$/, sort readdir DIR;
   closedir DIR;
}
   
Now the filenames are in arrays which are referenced from the
values of the
hash %logFiles (keys are 1 through 6, but maybe you want
  to use the
directory name instead).  I took the liberty of removing
  the usually
useless directory entries and sorting, since you'll probably
want them
sorted later.
 
  --
  Peter Scott
  Pacific Systems Design Technologies
  http://www.perldebugged.com
 

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Re: Newbie Question about subroutine

2001-08-07 Thread Brett W. McCoy

On Tue, 7 Aug 2001, Barry Carroll wrote:

 here is a snippet of the code:

 print (Is your Terminal ANSI compliant?\nYes or No, \(y\) or \(n\)?\n);

First of all, get rid of those backslashes.  No need to put your string in
parens.  You can do this:

print Is your Terminal ANSI compliant?\nYes or No, (y) or (n)?\n

   sub verifyInput
   {
   # Subroutine to verify input
   # Will return the correct value
   # and discard bad values

   my $vInput = @_;

The problem is that you are assigning an array to a scalar, which means
your array is put into a scalar context, which means the scalar will be
assigned number of elements in the array.  Since you are only passing one
argument to the sub, you just need:

sub verifyInput {
  my $vInput = shift;
  ...
}

If you have multiple arguments, you can do:

my ($vInput1, $vInput2) = @_;

or

my $vInput1 = shift;
my $vInput2 = shift;

-- Brett
   http://www.chapelperilous.net/btfwk/

The way I understand it, the Russians are sort of a combination of evil and
incompetence... sort of like the Post Office with tanks.
-- Emo Philips


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




RE: pls ignore last msg

2001-08-07 Thread Mooney Christophe-CMOONEY1

Too late -- i already posted.

Oh, well! ;)

-Original Message-
From: Barry Carroll [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 11:12 AM
To: '[EMAIL PROTECTED]'
Subject: pls ignore last msg



sorry guys i got it, silly mistake

-- 
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: Newbie Question about subroutine

2001-08-07 Thread Barry Carroll

Thanks, 

I didn't know that, i got around the problem with this:

print (Is your Terminal ANSI compliant?\nYes or No, \(y\) or \(n\)?\n);
chomp ($input = STDIN);

verifyInput($input);

sub verifyInput
{
# Subroutine to verify input
# Will return the correct value
# and discard bad values

my ($vInput) = @_;
..
}

just put the sclar in brackets :)

-Original Message-
From: Mooney Christophe-CMOONEY1 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 5:19 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Newbie Question about subroutine


@_ is a list and $vInput is a scalar.  A list in scalar context returns the
number of elements in the array.

So,

$vInput=@_

will put the number of elements in @_ into $vInput, which, naturally, is
always one.

To extract the single argument from the list, do this:

$vInput=shift;

This will take the first (and only) element in @_ and assign it to $vInput.

-Original Message-
From: Barry Carroll [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 11:03 AM
To: '[EMAIL PROTECTED]'
Subject: Newbie Question about subroutine



Hi all, i want to have a subroutine for checking user input:

here is a snippet of the code:

print (Is your Terminal ANSI compliant?\nYes or No, \(y\) or \(n\)?\n);
chomp ($input = STDIN);

verifyInput($input);

sub verifyInput
{
# Subroutine to verify input
# Will return the correct value
# and discard bad values

my $vInput = @_;

processing in here

}

The problem is that I tried entering 'y', 'n', anything!, but no luck.
I found out that $vInput is always getting assigned the numeric value '1'.

The rest of the sub after this is fine, if i could just figure out why
$vInput is being assigned '1'

Any ideas? - Thanks in advance :)

-- 
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]

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




Re: length of an array

2001-08-07 Thread Brett W. McCoy

On Tue, 7 Aug 2001, Romek Krisztián wrote:

 @array[$a] = [1, 2, 3, 4, 5];

Should be

$array[$a] = [ 1, 2, 3, 4, 5 ];

 How can I determine the length of an array inside an array?

 I tried the followings:

 $length = $#array[$a]# -- syntax error
 $length = scalar(@array[$a]) # -- ARRAY(blablabla)

$length = @{ $array[$a] };

-- Brett
   http://www.chapelperilous.net/btfwk/

Only that in you which is me can hear what I'm saying.
-- Baba Ram Dass


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




Re: Compare large files memory error

2001-08-07 Thread Peter Scott

At 09:59 AM 8/7/01 -0400, [EMAIL PROTECTED] wrote:
Randal,

Thanks for the file compare tip, it is incredibly fast! However it doesnt 
tell me where the difference is. Can I get it to print out the first block 
of data that is different?

Does your system have the 'cmp' program on it?  IIRC this is a standard or 
fairly standard Unix utility which does exactly what you want and you could 
just call it from Perl...

Regards

Mark Bedish
Surrey,UK


In a message dated Tue, 7 Aug 2001 13:36:50  British Summer Time, 
[EMAIL PROTECTED] (Randal L. Schwartz) writes:

   Jos == Jos I Boumans [EMAIL PROTECTED] writes:
 
  Jos if you're just interested in *EXACTLY* the same files, use MD5 
 (get it from
  Jos search.cpan.org)
  Jos even one BIT of difference (literally) will result in a different 
 checksum
  Jos thorough and fast
 
  MD5 is useful when you don't want to use the original data to compare
  (or no longer have access to it).  But if you've got both big files
  sitting in front of you, it's a waste to compute md5(one) == md5(two).
  Instead, just get File::Compare from the CPAN, which does a very
  efficient comparison: first length, then big-block by big-block
  equality.
 
  print Just another Perl hacker,;
 
  --
  Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
  [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
  Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
  See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
 training!
 
  --
  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]

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Re: ideas to clean this up?

2001-08-07 Thread Peter Scott

At 09:29 AM 8/7/01 +0200, Romek Krisztián wrote:
  And your exec code ought not to have to change.  If you're used to doing
  something that says
 
   foo (@files)
 
  then just do instead
 
   foo (@{$logFiles{$key})
 
  where $key is one of the hash keys - obviously now you can loop through
all
  of them.

Sorry, but did you forget a brace?

foo (@{$logFiles{$key}})

Yep, thanks.  If I'd been editing that in Emacs instead of doing a quickie 
in my editor it'd have been caught for me.  Well, that's the danger of 
quickies.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Re: getting the calling function name.

2001-08-07 Thread Me

[Rajeev, please keep beginner topics on the list]

 Thanks again

You're welcome :

 But how to calculate the $calldepth value here.

 Actually I tried with the values for $i or $calldepth as given in the
docs.

(Note that I just made up the variable name $calldepth.)

 I understand that 1 represents the first level of call. and 2 second.
 In can of recursions and loops how can we keep track of just previous
 level here?

Er, that's 1. The call depth goes backwards.
0 = current sub
1 = caller (sub that called the current sub)
2 = caller's caller (sub that called the sub that called the current
sub)

Also, Be aware that the optimizer might have optimized call frames
away before `caller' had a chance to get the information.

hth

 with regards

 Rajeev Rumale


 - Original Message -
 From: Me [EMAIL PROTECTED]
 To: Rajeev Rumale [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, August 07, 2001 2:53 PM
 Subject: Re: getting the calling function name.


   caller only gives only the name of current sub
 
  You didn't read the docs carefully enough...
 
  caller($calldepth)
 
  perldoc -f caller
 
 



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




using system?

2001-08-07 Thread insomniak

Hi,
What is the best way to find out if a command is suceesful/finished when
using system();
Im trying things like
die if system(some command); or warn if system(some command);
 - not really worried about why it fails only if it fails and when it has
finished
This works but I would like to be able to run the next system command
only after the first has finished.
I read that this could be somthing to do with wait() but I cannot find any
exmaple to work from. Any help is much appreciated.

Regards
Mark Kneen


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




RE: using system?

2001-08-07 Thread Matt Crapo

System commands return zero for true, some other value for failure.
This is backwards from perl's logic.  You need to test for a return of
zero, or use and instead of or like this:

 if ((system(system command)) == 0) { success }
  or
 system(system command) and die $!\n; # AND says Did I get a
non-zero?

I prefer the first because it's easier to understand - especially if
somebody else ever has to look at your code.

And I suggest doing it on every system command (verifying the return
value, that is).  Better yet, see if you can do it from within perl
first.

Good Luck!
Matt

-Original Message-
From: insomniak [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 9:44 AM
To: [EMAIL PROTECTED]
Subject: using system?


Hi,
What is the best way to find out if a command is suceesful/finished when
using system(); Im trying things like die if system(some command); or
warn if system(some command);
 - not really worried about why it fails only if it fails and when it
has finished This works but I would like to be able to run the next
system command only after the first has finished. I read that this could
be somthing to do with wait() but I cannot find any exmaple to work
from. Any help is much appreciated.

Regards
Mark Kneen


-- 
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: ideas to clean this up?

2001-08-07 Thread Yacketta, Ronald

Peter,

Sorry about the off list email, I did a reply vice a reply to all

the code actualy uses
   exec $cmd, $lookFor, @{$logFiles{$_}}  unless $pid=fork; # fork new
process for cmd
I replaced the $cmd for some stupid reason

I am not sure why, but this does not work I can print the members of the
hash 
for ( 0 .. 4) {
print @{$logFiles{$_}}\n;
}

and the number of elements

for ( 0 .. 4 ) {
print @{$logFiles{$_}} . \n;
}

but can not seem to make the egrep parse the members of the array/hash.

-Ron


 -Original Message-
 From: Peter Scott [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 12:20
 To: Yacketta, Ronald
 Cc: [EMAIL PROTECTED]
 Subject: RE: ideas to clean this up?
 
 
 [My rule is that beginners' questions arising from a thread on the 
 beginners' list get answered on the list, FYI.  I may make 
 mistakes that 
 others will catch.]
 
 At 09:37 AM 8/7/01 -0400, Yacketta, Ronald wrote:
 Peter,
 
 Does this look correct?
 
 exec egrep, $lookFor, @{$logFiles{$_}} unless $pid=fork; # 
 fork new process
 for cmd
 
 Your egrep ought to be quoted, unless you're running without 
 strictness 
 enabled, in which case you have more problems...
 
 That will in fact background an egrep command like you want.  
 It's output 
 will go to wherever your program's output goes.  It won't be 
 captured by 
 your program.  If your program is going to continue for any 
 great length of 
 time or is going to spawn a lot of processes, make sure to 
 waitpid() for 
 your children.
 
 Since you're using egrep rather than grep, I assume you want to take 
 advantage of it's extended regex syntax, therefore your $lookfor may 
 contain regex metacharacters.  Make sure you've escaped what 
 needs to be 
 escaped, etc.
 
 I would use a perl regex, but it takes way to much cpu/time.
 
 Perl's way of searching files with regexen will be just as 
 fast as egrep's, 
 possibly faster.
 
 I need to
 beable to spawn 3 - 4 utils to parse for the $lookFor in 
 each file within
 the logFiles array.
 
 As long as you just want the results of an egrep search to go to your 
 programs stdout and stderr, fine.  The day you want your 
 program to get at 
 those results, things will get more complicated and you'll 
 probably end up 
 doing the regex searching in Perl, still in forked children.
 
 -Ron
 
   -Original Message-
   From: Peter Scott [mailto:[EMAIL PROTECTED]]
   Sent: Monday, August 06, 2001 15:20
   To: Yacketta, Ronald; Beginners (E-mail)
   Subject: RE: ideas to clean this up?
  
  
   At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
   Thanxs!
   
   now off to modify my exec code that parses an entire array
   of files :)
  
   Of course, the arrayrefs could equally well have been stored
   in an array
   instead of a hash.  There's a thin justification for a hash
   in the absence
   of any other context, but the actual context could easily 
 change that.
  
   And your exec code ought not to have to change.  If you're
   used to doing
   something that says
  
foo (@files)
  
   then just do instead
  
foo (@{$logFiles{$key})
  
   where $key is one of the hash keys - obviously now you can
   loop through all
   of them.
  
 This may seem a little obvious, but...

 my %logFiles;
 for my $key (1 .. 6) {
opendir DIR, ../logs/set$key or die opendir
 ../logs/set$key: $!\n;
push @{$logFiles{$key}}, map ../logs/set$key/$_,
 grep !/^\.\.?$/, sort readdir DIR;
closedir DIR;
 }

 Now the filenames are in arrays which are referenced from the
 values of the
 hash %logFiles (keys are 1 through 6, but maybe you want
   to use the
 directory name instead).  I took the liberty of removing
   the usually
 useless directory entries and sorting, since you'll probably
 want them
 sorted later.
  
   --
   Peter Scott
   Pacific Systems Design Technologies
   http://www.perldebugged.com
  
 
 --
 Peter Scott
 Pacific Systems Design Technologies
 http://www.perldebugged.com
 

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




file size limitation

2001-08-07 Thread Michael Moore

hello--

i was wondering if anyone knew what the file size limitation is for perl and
if there are any work arounds. i tried to compile it with the gcc flags that
are necessary for LFS, but to no avail. i dont have a problem with large files
under other programs. any ideas? 

i am running redhat - roswell and a 2.4.6 kernel.

thanks,

Michael Moore

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




Re: using system?

2001-08-07 Thread Sudarsan Raghavan

I am new to perl myself. Maybe I am missing something here, but still
$? contains the exit status of the system call. $?  8 will give the exact
signal with which the call exited.
0 for success and anything else for failure.

Sudarsan

insomniak wrote:

 Hi,
 What is the best way to find out if a command is suceesful/finished when
 using system();
 Im trying things like
 die if system(some command); or warn if system(some command);
  - not really worried about why it fails only if it fails and when it has
 finished
 This works but I would like to be able to run the next system command
 only after the first has finished.
 I read that this could be somthing to do with wait() but I cannot find any
 exmaple to work from. Any help is much appreciated.

 Regards
 Mark Kneen

 --
 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]




To read from a file using RegExp

2001-08-07 Thread Qiang Qiang

I have a file as follows:

.SUBCKT JTJTAG Z@@793 Z@@753 Z@@109 Z@@86 Z@@15 Z@@296 Z@@61 Z@@207 Z@@135
+ Z@@275 Z@@313 Z@@1134 Z@@232 Z@@184 Z@@162 Z@@976 Z@@1014 Z@@253 Z@@954 
Z@@39
+  Z@@138 Z@@622 Z@@1060 Z@@405 Z@@368 Z@@735

Z@@xxx stands for a node.

What I need to do is that read every node in the file and compare everyone 
with a given node to see whether it is in this file.  What can I do using 
RegExp?  Thanks:-)


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




Re: Can I use a pointer as key of a hash?

2001-08-07 Thread Troy Denkinger

On Monday 06 August 2001 22:26, Qiang Qiang wrote:
 Can I use a pointer as key of a hash?  I wanted to do this way however, it
 failed and output nothing.  Then I change to use the content of the pointer
 as key, it works.

Can you post a bit of code illustrating what you were trying to do?  The 
thing is, Perl doesn't have pointers, per se.  So I'm not sure how you were 
trying to use them or what, indeed, you were using.

Regards,

Troy


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




RE: To read from a file using RegExp

2001-08-07 Thread Wagner-David

Better point would be a hash and use split on whitespace to isolate
the node info. Then using what is in the hash, you can read a file and check
whether the node info for that particular node is in the hash or not. Then
you can process accordingly.

Wags ;)

-Original Message-
From: Qiang Qiang [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 10:46
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: To read from a file using RegExp


I have a file as follows:

.SUBCKT JTJTAG Z@@793 Z@@753 Z@@109 Z@@86 Z@@15 Z@@296 Z@@61 Z@@207 Z@@135
+ Z@@275 Z@@313 Z@@1134 Z@@232 Z@@184 Z@@162 Z@@976 Z@@1014 Z@@253 Z@@954 
Z@@39
+  Z@@138 Z@@622 Z@@1060 Z@@405 Z@@368 Z@@735

Z@@xxx stands for a node.

What I need to do is that read every node in the file and compare everyone 
with a given node to see whether it is in this file.  What can I do using 
RegExp?  Thanks:-)


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
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]




Variable Recalculation

2001-08-07 Thread Michael Kelly

Is there any way to recalculate a certain variable when another variable's
value changes? For instance if,

$a = 5;
$b = $a * 4;
$a = 10;

At the end of that, $a will be 10, but $b will still be 20 (5 * 4).  Is
there any way, short of manually recalculating $b every time $a might
change, to have $b set to 40 when $a is set to 10? I know I could just do
something like:

print $a * 4, \n;

instead of 

print $b\n;

But with a large set of variables like this that are used quite often, this
method is rather slow and error-prone.

I've tried to do this with references, but I've had no luck.

Thanks,
-Michael Kelly
Email: [EMAIL PROTECTED]



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




RE: ideas to clean this up?

2001-08-07 Thread Yacketta, Ronald

Peter,

I have tried a few different perl: ways to grep for patterns in files
(~1500 files totaling ~350MB) cleanly and efficiently. each timed I thought
of something / tried something it was ridiculously slow.

I have tried a foreach on an array of files and parsing the $_ etc.. that
took nearly ~5 mins! which
is way way to slow for this task. the three (or four) system calls to egrep
works ok, seeing the load
is split upon 3 - 4 cpus (unix here), if I could write a perl function that
was total internal to perl with no system calls that was roughly 45 - 60
seconds in parsing time that would be great, but me being me I doubt it will
happen any time soon


 -Original Message-
 From: Peter Scott [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 12:20
 To: Yacketta, Ronald
 Cc: [EMAIL PROTECTED]
 Subject: RE: ideas to clean this up?
 
 
 [My rule is that beginners' questions arising from a thread on the 
 beginners' list get answered on the list, FYI.  I may make 
 mistakes that 
 others will catch.]
 
 At 09:37 AM 8/7/01 -0400, Yacketta, Ronald wrote:
 Peter,
 
 Does this look correct?
 
 exec egrep, $lookFor, @{$logFiles{$_}} unless $pid=fork; # 
 fork new process
 for cmd
 
 Your egrep ought to be quoted, unless you're running without 
 strictness 
 enabled, in which case you have more problems...
 
 That will in fact background an egrep command like you want.  
 It's output 
 will go to wherever your program's output goes.  It won't be 
 captured by 
 your program.  If your program is going to continue for any 
 great length of 
 time or is going to spawn a lot of processes, make sure to 
 waitpid() for 
 your children.
 
 Since you're using egrep rather than grep, I assume you want to take 
 advantage of it's extended regex syntax, therefore your $lookfor may 
 contain regex metacharacters.  Make sure you've escaped what 
 needs to be 
 escaped, etc.
 
 I would use a perl regex, but it takes way to much cpu/time.
 
 Perl's way of searching files with regexen will be just as 
 fast as egrep's, 
 possibly faster.
 
 I need to
 beable to spawn 3 - 4 utils to parse for the $lookFor in 
 each file within
 the logFiles array.
 
 As long as you just want the results of an egrep search to go to your 
 programs stdout and stderr, fine.  The day you want your 
 program to get at 
 those results, things will get more complicated and you'll 
 probably end up 
 doing the regex searching in Perl, still in forked children.
 
 -Ron
 
   -Original Message-
   From: Peter Scott [mailto:[EMAIL PROTECTED]]
   Sent: Monday, August 06, 2001 15:20
   To: Yacketta, Ronald; Beginners (E-mail)
   Subject: RE: ideas to clean this up?
  
  
   At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
   Thanxs!
   
   now off to modify my exec code that parses an entire array
   of files :)
  
   Of course, the arrayrefs could equally well have been stored
   in an array
   instead of a hash.  There's a thin justification for a hash
   in the absence
   of any other context, but the actual context could easily 
 change that.
  
   And your exec code ought not to have to change.  If you're
   used to doing
   something that says
  
foo (@files)
  
   then just do instead
  
foo (@{$logFiles{$key})
  
   where $key is one of the hash keys - obviously now you can
   loop through all
   of them.
  
 This may seem a little obvious, but...

 my %logFiles;
 for my $key (1 .. 6) {
opendir DIR, ../logs/set$key or die opendir
 ../logs/set$key: $!\n;
push @{$logFiles{$key}}, map ../logs/set$key/$_,
 grep !/^\.\.?$/, sort readdir DIR;
closedir DIR;
 }

 Now the filenames are in arrays which are referenced from the
 values of the
 hash %logFiles (keys are 1 through 6, but maybe you want
   to use the
 directory name instead).  I took the liberty of removing
   the usually
 useless directory entries and sorting, since you'll probably
 want them
 sorted later.
  
   --
   Peter Scott
   Pacific Systems Design Technologies
   http://www.perldebugged.com
  
 
 --
 Peter Scott
 Pacific Systems Design Technologies
 http://www.perldebugged.com
 

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




Re: Variable Recalculation

2001-08-07 Thread Jeff 'japhy/Marillion' Pinyan

On Aug 7, Michael Kelly said:

Is there any way to recalculate a certain variable when another variable's
value changes? For instance if,

$a = 5;
$b = $a * 4;
$a = 10;

You can use my DynScalar module from CPAN.

  use DynScalar;

  $x = 5;
  $y = dynamic { $x * 4 };
  print $x * 4 = $y\n;

  $x = 10;
  print $x * 4 = $y\n;

A similar outcome can be gotten with tied scalars:

  package Tie::DynScalar;

  sub TIESCALAR {
my ($class, $func) = @_;
bless $func, $class;
  }

  sub FETCH { $_[0]-() }

  sub STORE { $_[0] = $_[1] }

  1;

This package is used like so:

  use Tie::DynScalar;

  $x = 5;
  tie $y, 'Tie::DynScalar', sub { $x * 4 };
  print $x * 4 = $y\n;

  $x = 10;
  print $x * 4 = $y\n;

The overall effect is the same.

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


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




RE: Newbie Question about subroutine

2001-08-07 Thread Russell Kroboth

or you could just change this:
my $vInput = @_;
to thisL
my $vInput = @_[0];

-Original Message-
From: Barry Carroll [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 12:03 PM
To: '[EMAIL PROTECTED]'
Subject: Newbie Question about subroutine



Hi all, i want to have a subroutine for checking user input:

here is a snippet of the code:

print (Is your Terminal ANSI compliant?\nYes or No, \(y\) or \(n\)?\n);
chomp ($input = STDIN);

verifyInput($input);

sub verifyInput
{
# Subroutine to verify input
# Will return the correct value
# and discard bad values

my $vInput = @_;

processing in here

}

The problem is that I tried entering 'y', 'n', anything!, but no luck.
I found out that $vInput is always getting assigned the numeric value '1'.

The rest of the sub after this is fine, if i could just figure out why
$vInput is being assigned '1'

Any ideas? - Thanks in advance :)


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




RE: To read from a file using RegExp

2001-08-07 Thread Russell Kroboth

this might do it:


$file=SUBCKT JTJTAG Z\@\@793 Z\@\@753 Z\@\@109 Z\@\@86 Z\@\@15 Z\@\@296
Z\@\@61 Z\@\@207 Z\@\@135
+ Z\@\@275 Z\@\@313 Z\@\@1134 Z\@\@232 Z\@\@184 Z\@\@162 Z\@\@976 Z\@\@1014
Z\@\@253 Z\@\@954
Z\@\@39;

$node=Z\@\@323;

if ($file=~/$node/){
print found\n;
} else {
print not found\n;
}


-Original Message-
From: Qiang Qiang [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 1:46 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: To read from a file using RegExp


I have a file as follows:

.SUBCKT JTJTAG Z@@793 Z@@753 Z@@109 Z@@86 Z@@15 Z@@296 Z@@61 Z@@207 Z@@135
+ Z@@275 Z@@313 Z@@1134 Z@@232 Z@@184 Z@@162 Z@@976 Z@@1014 Z@@253 Z@@954
Z@@39
+  Z@@138 Z@@622 Z@@1060 Z@@405 Z@@368 Z@@735

Z@@xxx stands for a node.

What I need to do is that read every node in the file and compare everyone
with a given node to see whether it is in this file.  What can I do using
RegExp?  Thanks:-)


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp



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




Re: magic import of extensions?

2001-08-07 Thread Paul Johnson

On Tue, Aug 07, 2001 at 04:30:12PM +0200, Edwin Günthner wrote:

 .. so what I am looking for is a mechanism
 to automatically load MyPackage whenever
 Perl starts. Is that possible?

export PERL5LIB=-MMyPackage

Or the equivalent for your shell.  But it's really not terribly
sociable.  Your program won't run properly unless the environment is
configured, and you may even break some other programs.

Is it really that bad to have your programmers use the appropriate
module?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




RE: Variable Recalculation

2001-08-07 Thread Bob Showalter

 -Original Message-
 From: Michael Kelly [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 2:00 PM
 To: [EMAIL PROTECTED]
 Subject: Variable Recalculation
 
 
 Is there any way to recalculate a certain variable when 
 another variable's
 value changes? For instance if,
 
 $a = 5;
 $b = $a * 4;
 $a = 10;
 
 At the end of that, $a will be 10, but $b will still be 20 (5 
 * 4).  Is
 there any way, short of manually recalculating $b every time $a might
 change, to have $b set to 40 when $a is set to 10? I know I 
 could just do
 something like:
 
 print $a * 4, \n;
 
 instead of 
 
 print $b\n;
 
 But with a large set of variables like this that are used 
 quite often, this
 method is rather slow and error-prone.
 
 I've tried to do this with references, but I've had no luck.

In addition to Jeff's suggestions,

   perldoc overload

will give you all the rope you need to hang yourself.

It might be better if you told us more about what you're actually trying to
do here...

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




RE: magic import of extensions?

2001-08-07 Thread Bob Showalter

 -Original Message-
 From: Paul Johnson [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 2:25 PM
 To: Edwin Günthner
 Cc: [EMAIL PROTECTED]
 Subject: Re: magic import of extensions?
 
 
 On Tue, Aug 07, 2001 at 04:30:12PM +0200, Edwin Günthner wrote:
 
  .. so what I am looking for is a mechanism
  to automatically load MyPackage whenever
  Perl starts. Is that possible?
 
 export PERL5LIB=-MMyPackage

That should be PERL5OPT, not PERL5LIB

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




Hashes with multiple values per key

2001-08-07 Thread Sophia Corwell

Hello Perl Help,

Does anyone have any ideas on what is a good way to
check the existance of a value for a key that has
multiple values?

Thanks in advance,

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: magic import of extensions?

2001-08-07 Thread Paul Johnson

On Tue, Aug 07, 2001 at 02:38:52PM -0400, Bob Showalter wrote:

  export PERL5LIB=-MMyPackage
 
 That should be PERL5OPT, not PERL5LIB

Right, thanks.  I had even looked it up to make sure too 

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: Hashes with multiple values per key

2001-08-07 Thread Casey West

On Tue, Aug 07, 2001 at 12:14:55PM -0700, Sophia Corwell wrote:
: Hello Perl Help,
: 
: Does anyone have any ideas on what is a good way to
: check the existance of a value for a key that has
: multiple values?

I'm not quite sure what you're asking for so I'm going to try and
rephrase your question, then answer that one.  :-)

Question:  I have a key in my hash that could have several valid
  values.  For instance, $hash{key} could return foo and bar and
  my program would be ok with that.  What is the best way to figure
  out what value $hash{key} has?

I hope that I got the question sorted out right in my head.  The
answer I would give to that question is, use an if statement:

  if ( $hash{key} eq 'foo' ) {
# do stuff based on 'foo' here
  } elsif ( $hash{key} eq 'bar' ) {
# do stuff based on 'bar' here
  } else {
# we should probably throw an error here because there are no
# valid values of $hash{key} left
  }

If I got this wrong, and it's very possible, try and set me straight
so we ( the list ) can help you better.

Thanks,

  Casey West

-- 
Disclaimer - These opiini^H^H geez! ^H^H ^Q ^[  :w :q :wq :wq! ^d
X ^? exit X Q ^C ^? :quitbye CtrlAltDel ~~q :~q logout save/quit
:!QUIT ^[zz ^[ZZ ^H man vi ^ ^L ^[c ^# ^E ^X ^I ^T ? help helpquit
^D ^d man help ^C ^c help ?Quit ?q CtrlShftDelHey, what does this
button d... -- Seen in a .signature file

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




RE: getting the calling function name.

2001-08-07 Thread Wagner Jeff Civ Logicon/TTMS

The following rough code example will get you what you want.  The parameter
passed to caller tells the function how many frames to go back in the call
stack.  The fourth list element (which is number 3, starting at 0) contains
the name of the subroutine at that frame.


Code


sub bbb {
my @call_info = caller(1);
print Subroutine is:  , $call_info[3], \n;
}

sub aaa {
bbb;
}

aaa;


Output


Subroutine is:  main::aaa


-Original Message-
From: Rajeev Rumale [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 07, 2001 01:22
To: Me; [EMAIL PROTECTED]
Subject: Re: getting the calling function name.


Thanks  me.

But the what i need is the grep the name of the sub which is calling the
loging sub.
As you have suggested caller only gives only the name of current sub
routine that is debugLogger it self.
And I had to do call the caller before calling the debugLogger and pass
all the info to it.

What i need is the the name of the sub rotuine which is calling the sub
debuLogger.

Consider the following subs


sub someSub{
statement 1;
statement 2;
statement 3;
debugLogger($message);
anotherSub;
}

sub anotherSub{
statement 1;
statement 2;
statement 3;
debugLogger($message);
}


sub debugLogger {

my $message = @_;

 $sub_name = ; #  Get the subroutine name.This is what i need to grep.

open (LOGGER,  my.log) || die  unable to ope the log file;
print LOGGER \n;
print LOGGER \nCalled from $sub_name.;
print LOGGER \n$message;
print LOGGER \n;
close LOGGER;

}



So if the sub someSub is called
The information I expect in the file is .


called from someSub
Here is the message.



called from anotherSub
Here is the message.



with regards

Rajeev Rumale


-
Artificial Intelligence is no match for Natural Stupidity.

-



- Original Message -
From: Me [EMAIL PROTECTED]
To: Rajeev Rumale [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 3:49 PM
Subject: Re: getting the calling function name.


 perldoc -f caller
 perldoc Carp.pm
 http://search.cpan.org/search?mode=modulequery=assert

  Hello Every Body,
 
  I need some help.
  I am using a sub routine to log all the messages to be used for
 debugging
  purpose.
  ie. debugLogger($debug_message);
  Since very similare kind of messages are genrated at serveral places,
 I add
  the function name.
  i.e., debugLogger(inside x  \n $debug_message);
 
  I feel it would be better as a prgramming style if sub debugLog is
 able to
  find the name of the calling function or the name of the function
  calling this sub and genrate the appropriate message.
 
 
  with regards
 
 
  Rajeev Rumale
 
 
  ***
   The human race has one really effective weapon, and that is
 laughter.
  ***
 
 
 
  --
  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: magic import of extensions?

2001-08-07 Thread Edwin Günthner

 Actually, i think the 'use MyPackage' statement is what Edwin is trying
 avoid, hence the term magic ... ?

Yep, thats exactly what I am looking for.

 It's not really a good idea to do this, but you could create a second perl
 command in another location (or rename it in the same location ...) which
 says:

Well, we have some reasons to do it this way: we want
to provide a range of commands to people that do not
need much more than our functions ... maybe they 
need for loops from time to time, or simple if / elseifs -
but not much more. 

Most of these people do not have ANY idea of perl.

If we can provide this magic extensions it would
be extremly easy for them to use our functions - 
they would just need to know about 
- our functions and their args
- how to write a loop in perl
- how to write if statements

Our users are really just interested in the commands
that we provide for them - they do not care what
language is around those commands.

Therefore accessing our subs should be as simple
as possible for them. 

thx for the help,

edwin günthner

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




RE: ideas to clean this up?

2001-08-07 Thread Peter Scott

At 01:28 PM 8/7/01 -0400, Yacketta, Ronald wrote:
Peter,

Sorry about the off list email, I did a reply vice a reply to all

the code actualy uses
exec $cmd, $lookFor, @{$logFiles{$_}}  unless $pid=fork; # fork new
process for cmd
I replaced the $cmd for some stupid reason

I am not sure why, but [snip] can not seem to make the egrep parse the 
members of the array/hash.

I just did a test and it worked for me.  Pass the arguments to a shell 
script of your own instead of egrep so you can dump them out and check that 
the arguments look right.

-Ron


  -Original Message-
  From: Peter Scott [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 07, 2001 12:20
  To: Yacketta, Ronald
  Cc: [EMAIL PROTECTED]
  Subject: RE: ideas to clean this up?
 
 
  [My rule is that beginners' questions arising from a thread on the
  beginners' list get answered on the list, FYI.  I may make
  mistakes that
  others will catch.]
 
  At 09:37 AM 8/7/01 -0400, Yacketta, Ronald wrote:
  Peter,
  
  Does this look correct?
  
  exec egrep, $lookFor, @{$logFiles{$_}} unless $pid=fork; #
  fork new process
  for cmd
 
  Your egrep ought to be quoted, unless you're running without
  strictness
  enabled, in which case you have more problems...
 
  That will in fact background an egrep command like you want.
  It's output
  will go to wherever your program's output goes.  It won't be
  captured by
  your program.  If your program is going to continue for any
  great length of
  time or is going to spawn a lot of processes, make sure to
  waitpid() for
  your children.
 
  Since you're using egrep rather than grep, I assume you want to take
  advantage of it's extended regex syntax, therefore your $lookfor may
  contain regex metacharacters.  Make sure you've escaped what
  needs to be
  escaped, etc.
 
  I would use a perl regex, but it takes way to much cpu/time.
 
  Perl's way of searching files with regexen will be just as
  fast as egrep's,
  possibly faster.
 
  I need to
  beable to spawn 3 - 4 utils to parse for the $lookFor in
  each file within
  the logFiles array.
 
  As long as you just want the results of an egrep search to go to your
  programs stdout and stderr, fine.  The day you want your
  program to get at
  those results, things will get more complicated and you'll
  probably end up
  doing the regex searching in Perl, still in forked children.
 
  -Ron
  
-Original Message-
From: Peter Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 15:20
To: Yacketta, Ronald; Beginners (E-mail)
Subject: RE: ideas to clean this up?
   
   
At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
Thanxs!

now off to modify my exec code that parses an entire array
of files :)
   
Of course, the arrayrefs could equally well have been stored
in an array
instead of a hash.  There's a thin justification for a hash
in the absence
of any other context, but the actual context could easily
  change that.
   
And your exec code ought not to have to change.  If you're
used to doing
something that says
   
 foo (@files)
   
then just do instead
   
 foo (@{$logFiles{$key})
   
where $key is one of the hash keys - obviously now you can
loop through all
of them.
   
  This may seem a little obvious, but...
 
  my %logFiles;
  for my $key (1 .. 6) {
 opendir DIR, ../logs/set$key or die opendir
  ../logs/set$key: $!\n;
 push @{$logFiles{$key}}, map ../logs/set$key/$_,
  grep !/^\.\.?$/, sort readdir DIR;
 closedir DIR;
  }
 
  Now the filenames are in arrays which are referenced from the
  values of the
  hash %logFiles (keys are 1 through 6, but maybe you want
to use the
  directory name instead).  I took the liberty of removing
the usually
  useless directory entries and sorting, since you'll probably
  want them
  sorted later.
   
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
   
 
  --
  Peter Scott
  Pacific Systems Design Technologies
  http://www.perldebugged.com
 

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




RE: ideas to clean this up?

2001-08-07 Thread Peter Scott

At 02:02 PM 8/7/01 -0400, Yacketta, Ronald wrote:
Peter,

I have tried a few different perl: ways to grep for patterns in files
(~1500 files totaling ~350MB) cleanly and efficiently. each timed I thought
of something / tried something it was ridiculously slow.

I have tried a foreach on an array of files and parsing the $_ etc.. that
took nearly ~5 mins! which
is way way to slow for this task. the three (or four) system calls to egrep
works ok, seeing the load
is split upon 3 - 4 cpus (unix here), if I could write a perl function that
was total internal to perl with no system calls that was roughly 45 - 60
seconds in parsing time that would be great, but me being me I doubt it will
happen any time soon

Okay, try this really simple approach.  Also, are the patterns you're 
searching for really patterns or are they just substrings?  Might be faster 
to use index() instead of // in that case.

use POSIX 'WNOHANG';
$| = 1;
# Next three lines were just for testing...
forkgrep('foo', glob'a/*');
forkgrep('bar', glob'b/*');
forkgrep('b.*z', glob'c/*');
1 while waitpid(-1, WNOHANG);

sub forkgrep {
   return if fork;
   (my $regex, @ARGV) = @_;
   while () {
 print $ARGV: $_ if /$regex/o;
   }
   exit;
}



  -Original Message-
  From: Peter Scott [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 07, 2001 12:20
  To: Yacketta, Ronald
  Cc: [EMAIL PROTECTED]
  Subject: RE: ideas to clean this up?
 
 
  [My rule is that beginners' questions arising from a thread on the
  beginners' list get answered on the list, FYI.  I may make
  mistakes that
  others will catch.]
 
  At 09:37 AM 8/7/01 -0400, Yacketta, Ronald wrote:
  Peter,
  
  Does this look correct?
  
  exec egrep, $lookFor, @{$logFiles{$_}} unless $pid=fork; #
  fork new process
  for cmd
 
  Your egrep ought to be quoted, unless you're running without
  strictness
  enabled, in which case you have more problems...
 
  That will in fact background an egrep command like you want.
  It's output
  will go to wherever your program's output goes.  It won't be
  captured by
  your program.  If your program is going to continue for any
  great length of
  time or is going to spawn a lot of processes, make sure to
  waitpid() for
  your children.
 
  Since you're using egrep rather than grep, I assume you want to take
  advantage of it's extended regex syntax, therefore your $lookfor may
  contain regex metacharacters.  Make sure you've escaped what
  needs to be
  escaped, etc.
 
  I would use a perl regex, but it takes way to much cpu/time.
 
  Perl's way of searching files with regexen will be just as
  fast as egrep's,
  possibly faster.
 
  I need to
  beable to spawn 3 - 4 utils to parse for the $lookFor in
  each file within
  the logFiles array.
 
  As long as you just want the results of an egrep search to go to your
  programs stdout and stderr, fine.  The day you want your
  program to get at
  those results, things will get more complicated and you'll
  probably end up
  doing the regex searching in Perl, still in forked children.
 
  -Ron
  
-Original Message-
From: Peter Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 15:20
To: Yacketta, Ronald; Beginners (E-mail)
Subject: RE: ideas to clean this up?
   
   
At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
Thanxs!

now off to modify my exec code that parses an entire array
of files :)
   
Of course, the arrayrefs could equally well have been stored
in an array
instead of a hash.  There's a thin justification for a hash
in the absence
of any other context, but the actual context could easily
  change that.
   
And your exec code ought not to have to change.  If you're
used to doing
something that says
   
 foo (@files)
   
then just do instead
   
 foo (@{$logFiles{$key})
   
where $key is one of the hash keys - obviously now you can
loop through all
of them.
   
  This may seem a little obvious, but...
 
  my %logFiles;
  for my $key (1 .. 6) {
 opendir DIR, ../logs/set$key or die opendir
  ../logs/set$key: $!\n;
 push @{$logFiles{$key}}, map ../logs/set$key/$_,
  grep !/^\.\.?$/, sort readdir DIR;
 closedir DIR;
  }
 
  Now the filenames are in arrays which are referenced from the
  values of the
  hash %logFiles (keys are 1 through 6, but maybe you want
to use the
  directory name instead).  I took the liberty of removing
the usually
  useless directory entries and sorting, since you'll probably
  want them
  sorted later.
   
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
   
 
  --
  Peter Scott
  Pacific Systems Design Technologies
  http://www.perldebugged.com
 

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL 

Re: Hashes with multiple values per key

2001-08-07 Thread Luke Bakken

 Does anyone have any ideas on what is a good way to
 check the existance of a value for a key that has
 multiple values?

I'll assume that your hash table has the following structure:

$hash{$key} = [ ];

that is, the value of each hash element is an array reference.

Let's say you're looking for element frazzle in the key represented by
variable $key :

for $ele ( @{$hash{$key}} )
{
if( $ele eq 'frazzle' )
{
print YEAH\n;
}
}

Luke


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




Re: Upgrade woes!

2001-08-07 Thread Elaine -HFB- Ashton

[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*Hi all, I wonder if someone can shed any light on this for me. 
*
*I run a Solaris 8 machine (sparc) at work and had problems installing DBI for perl 
5.6.0 - for future reference (for other newbies) if your perl has come precompiled on 
your system, and you install gcc to compile modules, perl doesn't like it!  Anyway to 
cut a long story short I got 5.6.1 from CPAN, compiled with gcc - and installed DBI..

Solaris 8 ships with perl 5.005_03 which was compiled, quite predictably,
with Sun's C compiler, the Forte CC. This is specific to Sun's
installation so it should be a caveat only to Solaris users. You can
compile your modules with gcc but it gets a bit messy and is just easier
in the long run if you leave the Sun Perl alone for use with kstat, etc.
and build your own for use with gcc.

You'll need to make sure you compiled perl correctly...did you do a 'make
test' before you installed it? Also, if you have gcc 2.95 on a 64-bit
solaris you'll need to upgrade your gcc as it has issues with perl and
others. ./configure -des works in most cases for Solaris.

And, check your environment for the web server as there could be a path in
there somewhere that is confusing your scripts due to version mismatches.
And...check your permissions on the perl tree...I noticed perl 5.6.1 had a
077 umask for some reason a while back when I installed it the first time
so it may just be owned by root with a 700 dir permission so your web
server can't get to itI'll bet money that this is probably the issue
:)

e.

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




Re: list archives

2001-08-07 Thread Elaine -HFB- Ashton

Mooney Christophe-CMOONEY1 [[EMAIL PROTECTED]] quoth:
*Got a question related to this list:
*
*I went to the specified archive because i wanted to find an older post, but
*it looks like the list only contains this month's postings.  Does anyone
*know where the older posts are?  Are they lost and gone forever?

http://lists.perl.org/showlist.cgi?name=beginners

http://archive.develooper.com/beginners%40perl.org/dateindex.html

e.

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




Re: Compare large files memory error

2001-08-07 Thread Mbedish

No, I am using Win NT.

Regards,

Mark
Surrey,UK

 Does your system have the 'cmp' program on it?  IIRC this is a standard or 
 fairly standard Unix utility which does exactly what you want and you could 
 just call it from Perl...

Regards

Mark Bedish
Surrey,UK


In a message dated Tue, 7 Aug 2001 13:36:50  British Summer Time, 
[EMAIL PROTECTED] (Randal L. Schwartz) writes:

   Jos == Jos I Boumans [EMAIL PROTECTED] writes:
 
  Jos if you're just interested in *EXACTLY* the same files, use MD5 
 (get it from
  Jos search.cpan.org)
  Jos even one BIT of difference (literally) will result in a different 
 checksum
  Jos thorough and fast
 
  MD5 is useful when you don't want to use the original data to compare
  (or no longer have access to it).  But if you've got both big files
  sitting in front of you, it's a waste to compute md5(one) == md5(two).
  Instead, just get File::Compare from the CPAN, which does a very
  efficient comparison: first length, then big-block by big-block
  equality.
 
  print Just another Perl hacker,;
 
  --
  Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095
  [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
  Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
  See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
 training!
 
  --
  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]

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
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: list archives

2001-08-07 Thread Mooney Christophe-CMOONEY1

Yes, i know--that's where i went in the first place, but 'dateindex' only
has posts from May 29-June 1, and those are repeated over and over again.

Something gives me the impression that this MHonArc thing that they're
using isn't working properly ...

-Original Message-
From: Elaine -HFB- Ashton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 3:08 PM
To: Mooney Christophe-CMOONEY1
Cc: [EMAIL PROTECTED]
Subject: Re: list archives


Mooney Christophe-CMOONEY1 [[EMAIL PROTECTED]] quoth:
*Got a question related to this list:
*
*I went to the specified archive because i wanted to find an older post,
but
*it looks like the list only contains this month's postings.  Does anyone
*know where the older posts are?  Are they lost and gone forever?

http://lists.perl.org/showlist.cgi?name=beginners

http://archive.develooper.com/beginners%40perl.org/dateindex.html

e.

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




Re: Variable Recalculation

2001-08-07 Thread Michael Kelly

On 8/7/01 11:05 AM, Jeff 'japhy/Marillion' Pinyan wrote:

 You can use my DynScalar module from CPAN.
snip

On 8/7/01 11:36 AM, Bob Showalter wrote:
 In addition to Jeff's suggestions,
snip

Thank you both! Although it wasn't real, the example I gave modeled what I'm
trying to do quite precicely, and your suggestions work great!

Thanks!
-Michael Kelly
Email: [EMAIL PROTECTED]



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




Frustrated installing modules!?!

2001-08-07 Thread John Way

I am truly frustrated that I can't even find any documentation on how to
install a module from, say, CPAN! I have activestate's installation of Perl
5.6.1.628 for Windows2000. I downloaded the binary version and have been
learning perl for about 4 months or so. The FAQ's say to use ppm to instal
modules, but after following the instructions for setting up environment
proxy setting variables for WINDOWS NT (not specific for Windows 2000
Professional), the ppm still couldn't connect to the website. Next I tried
the old fashioned make method, but when I type   c:\perlnmake  I get the
message 'nmake' is not recognized as an internal or external
command,operable program or batch file. I searched the entire hard drive,
but there is no nmake or nmake.*

Neither of these methods worked for me and I can't locate any
troubleshooting documentation!

Can anyone help?

John Way




 Confidentiality Notice: ***
Privileged/Confidential information may be contained in this message
and is intended only for the use of the addressee.  Please advise
immediately if you or your employer do not consent to Internet e-mail
for messages of this kind.  If you are not the addressee, or person
responsible for delivering to the person addressed, you may not copy or
deliver this to anyone else.  If you receive this message by mistake,
please notify the sender immediately by return e-mail.  Thank you.





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




RE: Frustrated installing modules!?!

2001-08-07 Thread Wagner-David

Here is my setup for AS using ppm:

PPM interactive shell (2.1.2) - type 'help' for available commands.
PPM set
Commands will be confirmed.
Temporary files will be deleted.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Tracing info will be written to 'PPM.LOG'.
Screens will pause after 24 lines.
Query/search results will be verbose.
Current PPD repository paths:
ActiveState Package Repository:
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
Packages will be built under: C:\DOCUME~1\dwagne01\LOCALS~1\Temp
PPM

Also the three variables needed if behind firewall:

HTTP_proxy=http://internet:80
HTTP_proxy_pass=password
HTTP_proxy_user=userid

Using this under AS 5.6.0 build 623, I am able to download modules to run.
Note: Must make sure your password is up to date and either export if not or
restart to make certain you are current.

Wags ;)
-Original Message-
From: John Way [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 13:48
To: [EMAIL PROTECTED]
Subject: Frustrated installing modules!?!


I am truly frustrated that I can't even find any documentation on how to
install a module from, say, CPAN! I have activestate's installation of Perl
5.6.1.628 for Windows2000. I downloaded the binary version and have been
learning perl for about 4 months or so. The FAQ's say to use ppm to instal
modules, but after following the instructions for setting up environment
proxy setting variables for WINDOWS NT (not specific for Windows 2000
Professional), the ppm still couldn't connect to the website. Next I tried
the old fashioned make method, but when I type   c:\perlnmake  I get the
message 'nmake' is not recognized as an internal or external
command,operable program or batch file. I searched the entire hard drive,
but there is no nmake or nmake.*

Neither of these methods worked for me and I can't locate any
troubleshooting documentation!

Can anyone help?

John Way




 Confidentiality Notice: ***
Privileged/Confidential information may be contained in this message
and is intended only for the use of the addressee.  Please advise
immediately if you or your employer do not consent to Internet e-mail
for messages of this kind.  If you are not the addressee, or person
responsible for delivering to the person addressed, you may not copy or
deliver this to anyone else.  If you receive this message by mistake,
please notify the sender immediately by return e-mail.  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: Frustrated installing modules!?!

2001-08-07 Thread Mooney Christophe-CMOONEY1

What's PPM?  Is this similar to CPAN?

-Original Message-
From: Wagner-David [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 3:55 PM
To: [EMAIL PROTECTED]
Subject: RE: Frustrated installing modules!?!


Here is my setup for AS using ppm:

PPM interactive shell (2.1.2) - type 'help' for available commands.
PPM set
Commands will be confirmed.
Temporary files will be deleted.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Tracing info will be written to 'PPM.LOG'.
Screens will pause after 24 lines.
Query/search results will be verbose.
Current PPD repository paths:
ActiveState Package Repository:
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
Packages will be built under: C:\DOCUME~1\dwagne01\LOCALS~1\Temp
PPM

Also the three variables needed if behind firewall:

HTTP_proxy=http://internet:80
HTTP_proxy_pass=password
HTTP_proxy_user=userid

Using this under AS 5.6.0 build 623, I am able to download modules to run.
Note: Must make sure your password is up to date and either export if not or
restart to make certain you are current.

Wags ;)
-Original Message-
From: John Way [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 13:48
To: [EMAIL PROTECTED]
Subject: Frustrated installing modules!?!


I am truly frustrated that I can't even find any documentation on how to
install a module from, say, CPAN! I have activestate's installation of Perl
5.6.1.628 for Windows2000. I downloaded the binary version and have been
learning perl for about 4 months or so. The FAQ's say to use ppm to instal
modules, but after following the instructions for setting up environment
proxy setting variables for WINDOWS NT (not specific for Windows 2000
Professional), the ppm still couldn't connect to the website. Next I tried
the old fashioned make method, but when I type   c:\perlnmake  I get the
message 'nmake' is not recognized as an internal or external
command,operable program or batch file. I searched the entire hard drive,
but there is no nmake or nmake.*

Neither of these methods worked for me and I can't locate any
troubleshooting documentation!

Can anyone help?

John Way




 Confidentiality Notice: ***
Privileged/Confidential information may be contained in this message
and is intended only for the use of the addressee.  Please advise
immediately if you or your employer do not consent to Internet e-mail
for messages of this kind.  If you are not the addressee, or person
responsible for delivering to the person addressed, you may not copy or
deliver this to anyone else.  If you receive this message by mistake,
please notify the sender immediately by return e-mail.  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]

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




Create an array of arrrays from a scalar

2001-08-07 Thread Chris Rogers

Maybe I'm crazy, but I would like to create an array of arrays from a single
string.  Here's an example of a string:
((TEXT PLAIN (format flowed) NIL NIL 7BIT 206 4 NIL NIL
NIL)(TEXT PLAIN (name Display.txt format flowed) NIL NIL 8BIT
16330 412 NIL (attachment (filename Display.txt)) NIL) mixed
(boundary =_NextPart_000_36cf_58cd_f54) NIL NIL)
This string will be contained a single scalar variable.  I have tried a few
different things, all of which have failed miserably.  My guess is that
spaces will need to be changed to commas. Any help would be greatly
appreciated.

Thanks,
Chris

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




RE: Create an array of arrrays from a scalar

2001-08-07 Thread Mooney Christophe-CMOONEY1

hehe -- i tried to do the exact same thing last year.

The solution?  Mail::*Client from CPAN (your example looks like IMAP, but i'm not sure 
...)

You may not be crazy now, but if you continue down this dark path, you'll certainly 
end up there.  Trust me.  ;)

-Original Message-
From: Chris Rogers [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 3:58 PM
To: Beginners@Perl. Org (E-mail)
Subject: Create an array of arrrays from a scalar


Maybe I'm crazy, but I would like to create an array of arrays from a single
string.  Here's an example of a string:
((TEXT PLAIN (format flowed) NIL NIL 7BIT 206 4 NIL NIL
NIL)(TEXT PLAIN (name Display.txt format flowed) NIL NIL 8BIT
16330 412 NIL (attachment (filename Display.txt)) NIL) mixed
(boundary =_NextPart_000_36cf_58cd_f54) NIL NIL)
This string will be contained a single scalar variable.  I have tried a few
different things, all of which have failed miserably.  My guess is that
spaces will need to be changed to commas. Any help would be greatly
appreciated.

Thanks,
Chris

-- 
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: Hashes with multiple values per key

2001-08-07 Thread RArul

I am afraid, I have different stats with my study:

I ran for 100,000 loops and for 1,000,000 loops but yet, the map,grep
contexts are giving me efficient stats than the foreach loop stuff. Since
our comparing contexts differ, there might be significant difference between
the two approaches, I guess. Else, how can you attribute the difference in
stats?

Here is my code:

use Benchmark;
open(INP,t.txt);

my $expressiveCode = sub {
$hash{'jmj'} =
['john','doe','laura','george','bill','nelson'];
for $ele (
@{$hash{'jmj'}} )
{
if( $ele eq
'george' )
{

print INP Take working Vacation Bud!\n;
}
}
 };
my $idiomaticCode = sub{#Mode Idiomatic Way and is more efficient too!
map { print INP Take
working vacation bud\n; }
grep{$_ eq 'george'}
@{$hash{'jmj'}};
};
close(INP);
timethis(100, $expressiveCode);
timethis(100, $idiomaticCode);


Please refer attachment for the stats(small file).

-- Rex
-Original Message-
From: Luke Bakken [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 4:57 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Hashes with multiple values per key



attachment: Perl.jpg
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Hashes with multiple values per key

2001-08-07 Thread Sophia Corwell

Thanks for the reply eventhough my question was not
clear.

Let me explain what I am trying to do.

I have a hash named %orgjobs whose keys have multiple
values.  The keys are department numbers and the
values are job_titles.  There is a also a text file
that has a list of departments, users, and the users'
job titles.  I want a report that shows the
departments and the job titles in that department. 
For example:
Dept 100: Engineer, Scientist
Dept 200: Programmer, Manager
Dept 300: Secretary, Student

A dept 100, for example, can have more than one
engineer and more than one scientist.  However, the
report just need to show one.

So this is what I did in perl

$found = 0;
foreach $job (@{$orgjobs{$dept}}) {
   if ($job eq $job_title) {
   $found++;
   }
}
if ($found == 0) {
push(@{$orgjobs{$dept}},$job_title);
}

The variable job_title is assigned earlier in the code
and contains a the name of a job title.  I am using a
while loop to iterate through the text file.

My question is:
Is there another way to find out if a particular value
already exists as a value for a key when the key has
multiple values? I know it sounds confusing.

--- Casey West [EMAIL PROTECTED] wrote:
 On Tue, Aug 07, 2001 at 12:14:55PM -0700, Sophia
 Corwell wrote:
 : Hello Perl Help,
 : 
 : Does anyone have any ideas on what is a good way
 to
 : check the existance of a value for a key that has
 : multiple values?
 
 I'm not quite sure what you're asking for so I'm
 going to try and
 rephrase your question, then answer that one.  :-)
 
 Question:  I have a key in my hash that could have
 several valid
   values.  For instance, $hash{key} could return
 foo and bar and
   my program would be ok with that.  What is the
 best way to figure
   out what value $hash{key} has?
 
 I hope that I got the question sorted out right in
 my head.  The
 answer I would give to that question is, use an if
 statement:
 
   if ( $hash{key} eq 'foo' ) {
 # do stuff based on 'foo' here
   } elsif ( $hash{key} eq 'bar' ) {
 # do stuff based on 'bar' here
   } else {
 # we should probably throw an error here because
 there are no
 # valid values of $hash{key} left
   }
 
 If I got this wrong, and it's very possible, try and
 set me straight
 so we ( the list ) can help you better.
 
 Thanks,
 
   Casey West
 
 -- 
 Disclaimer - These opiini^H^H geez! ^H^H ^Q ^[ 
 :w :q :wq :wq! ^d
 X ^? exit X Q ^C ^? :quitbye CtrlAltDel ~~q :~q
 logout save/quit
 :!QUIT ^[zz ^[ZZ ^H man vi ^ ^L ^[c ^# ^E ^X ^I
 ^T ? help helpquit
 ^D ^d man help ^C ^c help ?Quit ?q CtrlShftDelHey,
 what does this
 button d... -- Seen in a .signature file


__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




how to compare two references (pointers)?

2001-08-07 Thread Qiang Qiang

Who knows how to compare two references (pointers) in OOPerl?  A reference 
is neither a numeric or a string, thus == and eq are useless.  Of 
course, I can use what they point at (the objects) to compare, however, I 
want to know how to deal with references.  Thanks a lot:-)

brbrbrBest Regards,

Katherine Qiang
http://home.cwru.edu/~qxq2
http://kittyqiang.tripod.com


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




Re: list archives

2001-08-07 Thread Elaine -HFB- Ashton

Mooney Christophe-CMOONEY1 [[EMAIL PROTECTED]] quoth:
*Yes, i know--that's where i went in the first place, but 'dateindex' only
*has posts from May 29-June 1, and those are repeated over and over again.

Are you sure you looked at that second URL? It begins some time in May and
lists everything through now. Though, I will admit, it would seem to not
be working as it should.

e.

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




Re: how to compare two references (pointers)?

2001-08-07 Thread Jeff 'japhy/Marillion' Pinyan

On Aug 7, Qiang Qiang said:

Who knows how to compare two references (pointers) in OOPerl?  A reference 
is neither a numeric or a string, thus == and eq are useless.  Of 
course, I can use what they point at (the objects) to compare, however, I 
want to know how to deal with references.  Thanks a lot:-)

Your argument about == and eq is wrong.  References behave specially in
numeric context, and are stringified in string context.  Unless an
object is overloaded, you can do:

  $addr = $obj + 0;

and

  $info = $obj;

and get useful information.  You can compare two references numerically,
and find out if they reference to the same place in memory.  Recent
versions of Perl have (thankfully) documented this in the perlref man
page.

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


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




Re: Frustrated installing modules!?!

2001-08-07 Thread Elaine -HFB- Ashton

John Way [[EMAIL PROTECTED]] quoth:
*I am truly frustrated that I can't even find any documentation on how to
*install a module from, say, CPAN! I have activestate's installation of Perl

You must have missed the FAQ link on the front page of CPAN.

http://www.cpan.org/misc/cpan-faq.html

also, http://perldoc.cpan.org/ has perlmod and perlmod lib as well as
http://www.cpan.org/CPAN.html

ActivePerl does have a FAQ for PPM which is also listed in the CPAN FAQ.

e.

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




Re: Please help with perl library path problem!

2001-08-07 Thread Chidi


I am getting an error on my solaris 5.6 sparc box when I try to
run a Perl program with the Sybperl CTLIB extension.

Specifically, I get the following error message:

Can't load

'/tools/ver/perl-5.005_03/lib/site_perl/5.005/sun4-solaris/auto/Sybase/CTlib
/CTlib.so' for module Sybase::CTlib: ld.so.1: /tools/perl/bin/perl: fatal:
libct.so:
 open failed: No such file or directory at
/tools/ver/perl-5.005_03/lib/site_perl/5.005/sun4solaris/DynaLoader.pm line
169.

 Note:
 In the development environment,
 the same Perl program runs successfully on a similar box
 but it FAILS WITH THE SAME ERROR on two other boxes of the same
hardware/software type. Perl was installed in /tools/ver/perl with links in
/tools/perl.-5.005_03 in
 keeping with standards here.

 Please help !! Please.





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




RE: Please help with perl library path problem!

2001-08-07 Thread Matt Crapo

Oops - forgot to share...

-Original Message-
From: Matt Crapo [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 4:19 PM
To: 'Chidi'
Subject: RE: Please help with perl library path problem!


I may be off in left field here, but I've had similar error messages
(keyword ld.so.1).  I found the problem was my environment variable
$LIBPATH (or $LD_LIBRARY_PATH on solaris) was missing a library
directory or two.

My suggestion:  Echo $LIBPATH (or $LD_LIBRARY_PATH) in the environment
that works and compare it with the trouble environment.  Also, pay
attention to the fact that the variables have different names between
solaris and other OS's.  Somebody not familiar with solaris might be
setting up the environment with $LIBPATH when they should be using
$LD_LIBRARY_PATH (or vice versa).

Of course, this may not have anything to do with your problem - just a
shot in the dark.

Good Luck!
Matt

-Original Message-
From: Chidi [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 07, 2001 2:28 PM
To: [EMAIL PROTECTED]
Subject: Re: Please help with perl library path problem!



I am getting an error on my solaris 5.6 sparc box when I try to run a
Perl program with the Sybperl CTLIB extension.

Specifically, I get the following error message:

Can't load

'/tools/ver/perl-5.005_03/lib/site_perl/5.005/sun4-solaris/auto/Sybase/C
Tlib
/CTlib.so' for module Sybase::CTlib: ld.so.1: /tools/perl/bin/perl:
fatal:
libct.so:
 open failed: No such file or directory at
/tools/ver/perl-5.005_03/lib/site_perl/5.005/sun4solaris/DynaLoader.pm
line 169.

 Note:
 In the development environment,
 the same Perl program runs successfully on a similar box
 but it FAILS WITH THE SAME ERROR on two other boxes of the same
hardware/software type. Perl was installed in /tools/ver/perl with links
in /tools/perl.-5.005_03 in  keeping with standards here.

 Please help !! Please.





-- 
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]




  1   2   >