Re: A becomes 1, B becomes 2, etc

2001-12-13 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 On Dec 13, Jenda Krynicky said:

  $num = ord($char) - ord('A') + 1

 or if you do it often
 
  my $char_base = ord('A') - 1;
  ...
  $num = ord($char) - $char_base;

 No benefit to that, really.  ord('A') is calculated at compile-time, not 
 run-time.

there's a design benefit, because you only have to change the
definition of $char_base in one place.  however, a subroutine
would be even better. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: HTML::Parser

2001-12-12 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Walter 
Valenti) wrote:

 Hi, i'm looking for some SIMPLE examples of HTML::Parser module.
 
 I'm find some examples but are complex.

look at some of its subclasses, like HTML::LinkExtor.  

Gisle has also posted some examples on comp.lang.perl.misc.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Reading config file issues

2001-12-12 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 Okay, this is really, really sloppy, but it's much closer in intent to what Randal 
was talking
 about (only relevant code is presented):

 sub doConf
 {
 my ($conf, $directives, $config_data) = @_;
 while (($directive, $config_info) = each(%{$directives}))
 {
 my ($value) = $conf-get($directive);
 if (defined($value))
 {
 $config_data-{ $config_info } = $value;
 print $config_data-{ $config_info } = $value\n;
 }
 }
 return $config_data;
 }


why not simply use a configuration module?  objects simplify this process
a great deal.  see ConfigReader::Simple, for instance.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Can I use PERL to add/remove /etc/passwd entries

2001-12-12 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Daniel Falkenberg) wrote:

 I have just finally finished a WWW based Perl program that can
 add/delete and change users password from a WWW based script.  I have
 tried to make this script as secure as I can. The script can modify the
 /etc/passwd files has any one seen a script like this before?

you should avoid editing /etc/passwd directly.  most systems
will have some sort of vendor specific tool to do this, since
updating one file may require changes elsewhere.  if you
are willing to go through all of the work to re-sync all of the
necessary system databases (can you even name them?) that
rely on /etc/passwd, perhaps you should wonder why you have
so much free time and nothing better to do. ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Confirmation...

2001-12-07 Thread _brian_d_foy

In article 01ad01c17ee7$dcbfff80$5960a9cb@nothing, 
[EMAIL PROTECTED] (Leon) wrote:

 This /([\d.]*)\/.*/g works irregardless whether your ip is 206.48.16.3/12345
 or src=206.48.16.3/12345

it doesn't work at all, actually.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: read textfield from using PERL

2001-12-06 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
wrote:

 prashan kukde menulis pada tgl  06 December 2001 Thursday 04:27 am sbb:
 :: Hi,
 ::  I am trying to read data from the form's text field
 :: using PERL script. Following is the perl code I am
 :: using,

 :: $cgiobject = new CGI;
 :: $userphone=$cgiobject-param(textfield);


 don't add double quote at the textfield
 
  $userphone=$cgiobject-param(textfield);

of course, that is incorrect. now perl will look for
a textfield function, which is not what you want.

 :: textfield. Will it be possible to get the data as it
 :: is filled in the text field ??

it depends on what the user-agent decides to send.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: mysql....postgres

2001-12-06 Thread _brian_d_foy

In article 000801c17e49$4a172df0$[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Nafiseh Saberi) wrote:

 why do you use always mysql and
 not postgres ??

who said nobody uses postgresql?
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: perl script to remove control M's

2001-12-06 Thread _brian_d_foy

In article OFC37CFF55.39E829E6-ON86256B1A.004E73D7@com, 
[EMAIL PROTECTED] (Brent Michalski) wrote:

 I always like to simply use:
 
 perl -pi -e 's/\r//' filename(s)

you have to be careful with that though because it's not
portable.  \r means different things to different OSes :)

perl -pi -e 's/\cM//' filename(s)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Confirmation...

2001-12-06 Thread _brian_d_foy

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Jean-Francois Messier) wrote:

   I'm a beginner in those regular expressions and s/// operations. How
 can I extract only the digits and the periods (.) from a string ? I have
 something like 206.48.16.3/12345. An IP address with a port number. There
 are digits on both sides of the slash, but I would like to keep only the
 digits from on the left as well as the periods. More complex question: If I
 have something like src=206.48.16.3/12345, how can I do the same as bove,
 but also removing the src= at the beginning ?

my $ip = src=206.48.16.3/12345;
$ip =~ s{^src=|/\d+$}{}g;
print $ip;
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: particular CGI (same message as 'no subject' from me)

2001-11-25 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:

 I am developing a community calendar for a local youth group.  I want 
 to be able to enter information into my 'calendar' web page; and have 
 that information be saved in a file for later retrieval and placement 
 into the 'calendar' web page.  Is there a CGI script available that 
 will write input values to a file? 

CGI.pm has features for sticky values and persistence.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Call for Top 10 reasons your form is broken

2001-11-21 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (George Marselis) wrote:

 i'm trying to compile a top ten of why your forms break, i.e. you try to 
 press a submit button but it doesn't work.
 any ideas?

i've already compiled most of them in the CGI Troubleshooting Guide
referenced in the CGI Meta FAQ.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: [OT] Call for Top 10 reasons your form is broken

2001-11-21 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (George Marselis) wrote:

 I would imagine you're doing this to build some sort of FAQ or
 document?  :-)
 
Casey West

yes, i am. the CGI books/FAQs i've read, don't deal with bugs very in 
 depth. they just mention the 500 internal error, chmod 700|755 script or 
 something to that effect.

obviously you haven't seen the CGI Meta FAQ.  i reference two CGI
troubleshooting guides that go into great depth about this.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: recommended perl training in UK?

2001-11-19 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Randal L. Schwartz) wrote:

  Chris == Chris Ball [EMAIL PROTECTED] writes:

 Chris [1]: http://www.stonehenge.com/ being the most obvious example.

 Both Tom Phoenix and I have been to London.  I'd be very happy to go
 back, and maybe even work with you a bit to compensate for the
 increased travel costs.

and New York isn't so far away either.  (but then, only if
Randal lets me ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Tracking FTP traffic

2001-11-09 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 Today my client asked if there was a
 way to track FTP sessions. Since they don't have a standard client for FTP
 sessions, I told him I didn't know of any way in Perl (note: the server logs
 are too big and not available for us to scan). My question to all of you is,
 have you ever done this sort of thing? And, what sort of server
 configuration changes would I have to ask of the administrator (Solaris
 boxes running Netscape Enterprise server)?

ask for access to the ftp logs.  if they are too big, break them into
chunks.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Off-Topic (200%) - Where are you from?

2001-11-09 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Randal L. Schwartz) wrote:

  Christopher == Christopher Solomon [EMAIL PROTECTED] writes:

 Christopher But you must get to meet so many great people!

 I do, for a few hours at a time.  It's hard to do more than get an
 interest in developing further contact before I get no more
 contact. :(

that is, btw, his secret to the 200 some Perl columns he has
written ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: STDERR question.

2001-10-30 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Peter Lemus) wrote:

 I would like to send all errors and messages to a
 file, but also to the screen when the script execute. 

you need IO::Tee

http://search.cpan.org/search?dist=IO-Tee
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Perl file creation

2001-10-30 Thread _brian_d_foy

In article 007101c1617a$9fd47590$58644c18@windomain, 
[EMAIL PROTECTED] (Scott Lutz) wrote:

 I have a Perl script that is creating files. The only problem is that 
 they are being created with the wrong username:group. Any idea as to 
 why this is happening, and an easy way to fix it?

do you run the script under the username and group that you wish the
file to have?
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Not loading CGI totally

2001-10-29 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Etienne 
Marcotte) wrote:

 I am using CGI only to get the data sent to the script from my html
 forms.
 
 each variable is stored in a variable $IN::variablename
 
 When I put use CGI, does it load all the module??

you might want to look at more lightweight derivatives of CGI.pm,
like CGI::Request.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Is this legitimate

2001-10-26 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Donavon Pfeiffer) wrote:

  Is this a legitimate regex for substituting hex cahrs in a string (I'm
 leaving the replacement string out as I know it's right):
 $letter=~s/%[a-fA-F0-9][a-fA-f0-9]/(pack function)/eg;

just use CGI.pm and you don't have to worry about it. ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Dir Denied

2001-10-24 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Angelo Bettati) wrote:

 I'd like to know if there is a way to deny the access to All (except the
 owner of the machine) inside the directory htdocs of Apache in which it's
 possible to put even reserved files.doc

change the directory permissions. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: i need help with Perl and HTML please

2001-10-23 Thread _brian_d_foy

In article 002c01c15be0$ace0cc60$a000330a@watertown, 
[EMAIL PROTECTED] (Matthew Mangione) wrote:

 hey im really new to Perl and HTML and so far I've only learned the 
 basics of the Perl language. I have been aquainted with C++ however 
 and the language is coming to me pretty easily. My job on my webteam 
 that we have for our school is to be the one who writes the 
 CGI-scripts. So far i have basic scripts written out, but i do not 
 know how to have the webpage run the scripts (i am not too good with 
 HTML - it is not my part of the team but the other person also does 
 not know). can anyone help me please??matthew mangione

start with the CGI Meta FAQ :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Path of root directory on production server

2001-10-23 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 Prashant Kukde wrote:

I want to load my perl/ CGI script on production server. But, I dont know
  the root path...
  Is there anyway to get it using perl script or CGI script ??

 if you're running apache, you can get the document root from the
 environment variables:

 print Document root is: , $ENV{DOCUMENT_ROOT};

DOCUMENT_ROOT is not necessarily where CGI scripts go.  instead
of everyone suggesting that the poster guess by running simple
minded programs, suggest that the poster ask the system
administrator, or read the server configuration file. :)

and, as always, if you are going to need to work with this
sysadmin a lot, a case of his favorite beer goes a long way.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Obtaining data from a web site via an automated Perl script

2001-10-23 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 --- Brian Jackson [EMAIL PROTECTED] wrote:

  We need to capture data from a website that happens to be a text file.
  Currently we have to manually save the data via the browser, then
  manually move the txt data and process it. 

 use LWP::Simple;

 my $url = 'http://www.someserver.com/somepath/somedoc.txt';
 my $data = get( $url );

 open OUT,  $file or die Cannot open $file for writing: $!;
 print OUT $data or die Could not print to $file: $!;

you could do this with getstore() :)

if you are doing this from a shell script, the GET program that came
with libwww might be easier:

GET http://www.perl.org  file.html
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: HTML::Parser

2001-10-22 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Sunthari) wrote:

 How do I use HTML::Parser to visit each urls.I need to
 extract some lines in each pages.

to extract URLs use HTML::SimpleLinkExtor :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: how to match pattern at initial line

2001-10-22 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
wrote:

 if I have these lines:
 ---
 AAA BBB CCC
 BBB CCC AAA
 CCC AAA BBB
 ---
 
 How to matching BBB at line 2 (BBB at the beginning of the line)
 but not matching line 1 and 3. ' /^BBB/ ' is not work.

use the m (for multiline) flag:

/^BBB/m

now the ^ matches at the beginning of internal lines rather 
than only at the beginning of the string.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: accessing environment variables

2001-10-19 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Greg Froese) wrote:


 I want to be able to test whether I'm in Windows or Linux, and this seems 
 like a good way to do it.

you want $^O, not an environment variable.  take a look inside
CGI.pm for some example code. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Parsing HTTP links

2001-10-18 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Greg Froese) wrote:

 thanks for all the help with this.  I actually did mean HTML Links as I am 
 looking to parse out specific links from an HTML file.  I'm not only 
 concerned with HTTP link (a href) but also other HTML flags.  Right 
 now I'm using HTML::SimpleLinkExtor but I'm not sure that gives me exactly 
 what I want.

please let me know if HTML::SimpleLinkExtor could be improved ;)

 Essentially what I'm trying to do is parse out all info from a web page 
 that is in bold (btext/b).  I'm going to revisit LinkExtor but if 
 there is a better solution, I'm all ears.

HTML::SimpleLinkExtor and HTML::LinkExtor only extract information
for link-like tags (a, base, img, and so on).  if you want to extract
stuff in other tags, you'll need to subclass HTML::Parser directly.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Factory method

2001-10-18 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
wrote:

 http://www.perfascist.com/factory.tar.gz

couldn't find this domain *shrug*

 The List class is nothing but a placeholder for its subclasses. When it's 
 constructor method (sub new) is called, it creates an instance of one of its 
 subclasses, the choice of subclass being based on one of the arguments to 
 the constructor method.

 Is this the factory method, or am I deluding myself? Does anyone have any 
 decent links for design patterns in Perl?

this is a factory since it creates objects in other packages. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: BETWEEN Comparison Operator

2001-10-18 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Mark Martin) wrote:

 I can only seem to do this with 2 conditional statements(IF  ELSIF) and
 the action repeated. What I want is a Between operator for the range -10
 to 10.

 Any ideas,

Perl 6 will have this.  patience :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Fraction to integer.

2001-10-18 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Amit Joshi) wrote:

 Is there a way in perl to directly convert a fractional number to
 its nearest integer value ??

use the int() function.

http://www.perldoc.com/perl5.6.1/pod/func/int.html
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: array of arrays

2001-10-18 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Michael Fowler) wrote:

 $array[$i][$j][$k][$l][$m] eq $list[$l][$m]

 However, this is the first time I've seen someone intentionally using such a
 large-dimension array.  What is this for?

i've used many more dimensions than that ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Parsing HTTP links

2001-10-16 Thread _brian_d_foy

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Brett W. McCoy) wrote:

 On Tue, 16 Oct 2001 [EMAIL PROTECTED] wrote:

  I need to parse out all http links stored in a local file.
  How would I go about doing this?

  which modules would I need to use?

 Take a look at HTML::Parser, which is available from CPAN.


or even HTML::SimpleLinkExtor

http://search.cpan.org/search?dist=HTML-SimpleLinkExtor
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Checking if file starts with X or Y

2001-10-15 Thread _brian_d_foy

In article 012301c155a0$8ada3890$[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Chuck) wrote:

 my $dh = DirHandle-new($dir);
 return sort
grep {  }
map   { $dir/$_ }
grep  { !/^\./}
$dh-read();

 Where you see the XXX's in the line containig grep, I need a check for
 this:

 If the file starts with  REL or WinCIS. I tried egrep { ^WiNCIS|^REL } but
 it did not work.

why not check for that in the first grep? note that you only have
to sort the filenames though ;)

return
map { $dir/$_ }
sort
grep { /^(?:WiNCIS|REL)/ }
$dh-read();
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Browser Redirection

2001-10-13 Thread _brian_d_foy

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Brett W. McCoy) wrote:

 On Fri, 12 Oct 2001, Carl Franks wrote:

  if (condition) {
   print Location:page.html\n\n;
   } else {
   print Content-type: text/html\n\n;
   print ...html...;
   }
  }

 BTW, for a Location header, you should an absolute URL and not a relative
 URL, even if it's on the same server as the request URI.

that depends on your intent and whether or not you want the
browser to know what you are doing.  you do not always have to
use an absolute URL.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Browser Redirection

2001-10-10 Thread _brian_d_foy

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] (Brett W. McCoy) wrote:

 On Wed, 10 Oct 2001, Michael Kelly wrote:
 
  print Content-type: text/html\n;
  print Location: http://www.mysite.com/page.html\n\n;;

 This is incorrect also, because the Location: ...\n\n is an http header
 and should not be used after a Content-type header is sent to the browser.
 It should be used as the only header.

i mentioned this before, but perhaps you mean something else.
Location, as an HTTP header, should also include a Content-type
header and a brief message body.  people who say Content-type
and Location don't go together simply haven't read the HTTP
specification.

furthermore, the ordering of header fields is irrelevant.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Why so slow!!?

2001-10-03 Thread _brian_d_foy

In article 977EA50D7F5AD51182AB0002B33B44133CA70F@UK07EX242, 
[EMAIL PROTECTED] (Garry Grierson) wrote:

 The following code runs very slowly compared to similar routines running on
 the same type of systems.

profile your code to find the slow spots:

http://www.ddj.com/columns/perl/2001/0104pl001/0104pl001.htm
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Connecting to an Access/MySQL database

2001-10-03 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Greg Froese) wrote:

 what module(s) would I need to connect to an access database?

use the DBI module.

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

perhaps with an ODBC driver

http://search.cpan.org/search?dist=DBD-ODBC

 and if I code an app that uses an access database, can that be easily 
 changed to MySQL or whatever just by changing the connect string?

aside from using special database server features, you simply
use a different DBD.

you may also like to see my review of _Programming the Perl DBI_
on

http://www.perl.org/books/recommendations.html

good luck :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Data Structures

2001-10-03 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (David Gilden) wrote:

 Here are my two questions, first is there a cleaner way of dealing 
 the 'radio button group' next is the building of a hash of hashs, and 
  I can not seem to sort desired criteria. As a PERL neophyte all help 
 is appreciated,

CGI.pm's HTML functions are easier than what you are doing. ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: $variable manipulation question

2001-10-02 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Shannon Murdoch) wrote:

  $x = join ' ', split //, $x;
 
 That looks like a very compact way of doing it, Brian- is it possible to get
 a bit of a rundown of how it works?

start from the right and work your way left. ;)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: $variable manipulation question

2001-10-02 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Shannon Murdoch) wrote:

 Brian's

*ahem* - brian.

 print join ' ', split //, $input;
 
 doesn't actually change $input's content however.

if that is what you wanted then you just need to fill in the
details:

$input = join ' ', split //, $input;
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Killing multiple ' ' spaces from a string/$variable

2001-10-02 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Shannon Murdoch) wrote:

  From: [EMAIL PROTECTED] (Kevin Meltzer)

  my @codes = split(/\s+/,$all_codes);

 Worked like a charm.  While we're on the topic of deletion/exclusion of
 string elements when brought in to an array, how do I kill '\n' line breaks
 from the string (or even just exclude them at array input time)?
 
 ie. 'hello how are you /n I am fine'
 becomes (hello,how,are,you,I,am,fine) when in the array.


since a newline is whitespace, Kevin's example still works. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: dot-named sub

2001-10-02 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jos? Luis Sancho) 
wrote:

 I am in need of a tip to name a sub with a '.' (dot) as
 
 sub www.com {
 bla, bla
 }

you can't use a full stop. use an underscore instead.  

sub www_com { }
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: dot-named sub

2001-10-02 Thread _brian_d_foy

In article 00a201c14b46$2d177330$9f01a8c0@Jaya, [EMAIL PROTECTED] 
(Rajeev Rumale) wrote:

 Well only _brian_d_foy [EMAIL PROTECTED] can answer that ,  as he/she has
 posted the question.

i posted the answer, not the question. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: matching

2001-10-02 Thread _brian_d_foy

In article 
[EMAIL PROTECTED] 
[EMAIL PROTECTED], COLLINEAU wrote:

 The matching doesn't work ! want to match for example :
 http://www.01net.com/rdn?oid=54682rub=12456 

use HTML::SimpleLinkExtor

http://search.cpan.org/search?dist=HTML-SimpleLinkExtor
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: CGI script to change user's password.

2001-10-02 Thread _brian_d_foy

In article 006301c14b33$25b5c7d0$9f01a8c0@Jaya, [EMAIL PROTECTED] 
(Rajeev Rumale) wrote:

 I am sure there would be some read packages to do all user management tasks.
 May be Gurus can put for light on the subject.

just search CPAN for HTTPD::UserAdmin.

http://search.cpan.org/search?dist=HTTPD-User-Manage
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: extraction

2001-10-02 Thread _brian_d_foy

In article 
[EMAIL PROTECTED] 
[EMAIL PROTECTED], COLLINEAU wrote:

 The finding lines are like that: gqgfqsgdkg a
 href=rdn?oiddsfhlhfdsrub=lhfdlhg class sljdfsgkjfd 

 I only want to extract the underlined string. How can i do to stop the
 extraction at class ?

i don't see any underlined string, but if you want to extract
links you can use HTML::SimpleLinkExtor.
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: How many elements are there in a hash?

2001-09-24 Thread _brian_d_foy

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] (George S Pereira) wrote:

 I need to find out the number of elements in the hash.
 
 Is there any quick way, like $#array for arrays.

the keys() function, in scalar context, returns the number
of pairs in the hash.

http://www.perldoc.com/perl5.6.1/pod/func/keys.html
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Inserting into the middle of arrays

2001-09-24 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Walter 
Valenti) wrote:

[original citation missing]

  How do I insert $scalar into position $x of @array, where $x is smaller than
  $#array?

 $array[$x]=$scalar;

this replaces whatever was at index $x.  to insert something
you need to use splice.

http://www.perldoc.com/perl5.6.1/pod/func/splice.html
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: going down an uncharted path

2001-09-24 Thread _brian_d_foy

In article  
[EMAIL PROTECTED]
m, [EMAIL PROTECTED] (Ronald Yacketta) wrote:

 Could someone point me to some examples? please, dont send the usual perldoc
 -f blah.. the company I am doing these scripts for does not have the perldoc
 installed

there is always a way to get the perl documentation (including
installing it on your own machine ;)

http://www.perldoc.com
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: STDIN Help

2001-09-24 Thread _brian_d_foy

In article  
[EMAIL PROTECTED]
m, [EMAIL PROTECTED] (Ronald Yacketta) wrote:

 my $output = EOF
 Select the number of clients to run for this SLT:
 1)  2000
 2)  1500
 3)  1300
 4)   500
 =
 EOF
 ;
 print $output;
 $num_clients = STDIN;

 how would I get the cursor to be on the same line as the = after the 
 print happens?

don't print a newline after the prompt. :)

my $prompt = = ;

my $output = 'EOF';
Select the number of clients to run for this SLT:
1)  2000
2)  1500
3)  1300
4)   500
EOT

print $output, $prompt;
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: How many elements are there in a hash?

2001-09-24 Thread _brian_d_foy

In article 2FB59B145095D511A7C90050BAC349F312DB@MAIL, 
[EMAIL PROTECTED] (John Edwards) wrote:

 $hash_length = scalar keys %hash;

that's already in scalar context since you are assigning
to a scalar. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: global variables

2001-09-24 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Ruth Albocher) wrote:

 I would like to use a global variable in my perl application, but since
 everything in perl is in a package, it will always belong to some
 package. what can I do?

stay away from global variables. :)

what are you trying to do?
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: global variables

2001-09-24 Thread _brian_d_foy

In article 001201c144fb$4a1ba3d0$ec00a8c0@boxx, [EMAIL PROTECTED] 
(Sascha Kersken) wrote:

 Perl 5.6 provides the 'our' statement as opposite to 'my': it makes a
 variable global to a file in which it's used.

it declares a package variable, actually.  if you aren't in its
package, then you have to use the full package specification to
get to it.  it's not a global variable in the sense that something
like $_ is global (even though it lives in main::).

my() is not really the opposite of our(), either.  it limits the
the variable to whatever scope it is in, and a file is a type of
scope. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Comparing two arrays in longest element order

2001-09-24 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Darin Weeks) wrote:

 I am trying to compare two arrays for a macro building system.  I need to
 start with the longest longest element from array 1 (the macros) and then
 compare it to all elements in array 2.

 Is there a simple way to cycle through the macro array by length of the
 element values WITHOUT permanently reordering the array?

if that is what you really want... ;)

you can use a schwartzian transform to pre-compute the lengths,
then sort on the lengths and recover the original string.


my @elements = qw( a ghi df rewq dfghj f dfghjkl );

foreach my $element (
map { $_-[0] }
sort { $b-[1] = $a-[1] }
map  { [ $_, length ] } 
@elements )
{
print $element\n;
}
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Comparing two arrays in longest element order

2001-09-24 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Randal L. Schwartz) wrote:

  brian == brian d foy [EMAIL PROTECTED] writes:

 brian In article [EMAIL PROTECTED], 
 brian [EMAIL PROTECTED] (Darin Weeks) wrote:

 brian you can use a schwartzian transform to pre-compute the lengths,
 brian then sort on the lengths and recover the original string.

 Except that length is a cheap function, so you've now made
 an expensive tradeoff that would take many hundreds of elements to
 finally equalize out.  I'd just use the length directly:

indeed.

brian[1094]$ cat test.pl
#!/usr/bin/perl

use Benchmark qw(countit timestr);

@elements = ;
print There are  . @elements .  elements\n;

my $map = 'HERE';
@sorted = map { $_-[0] }
sort { $b-[1] = $a-[1] }
map  { [ $_, length ] }
@elements;
HERE

my $sort = 'HERE';
@sorted = sort { length $b = length $a } @elements
HERE

my $t = countit(30, $map);
my $count = $t-iters ;
print $count loops of map took: , timestr($t), \n;

my $t2 = countit(30, $sort);
my $count2 = $t2-iters;
print $count2 loops of sort took: , timestr($t2), \n;

brian[1094]$ perl test.pl foo
There are 38444 elements
31 loops of map took: 31 wallclock secs (30.68 usr +  0.00 sys = 30.68 CPU) @  1.01/s 
(n=31)
105 loops of sort took: 32 wallclock secs (31.41 usr +  0.00 sys = 31.41 CPU) @  
3.34/s (n=105)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: System call to print to webpage

2001-09-23 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (David Freeman) wrote:

 $uptime = system (/usr/bin/uptime);

you want to save the output, so use backticks.

my $uptime = `/usr/bin/uptime`;
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: bless function

2001-09-17 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] (Baby Lakshmi) wrote:

 I really dont understand the functionality and advantages of using bless.

bless() tags a reference with a package name, effectively turning
it into an object.  without bless you don't have objects.

http://www.perldoc.com/perl5.6.1/pod/func/bless.html
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: grep utility

2001-09-14 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(John_kennedy) wrote:

 Is this line correct:

 @UNLOCKED = grep(!/LOCKED/g, @SAME);

you could just as well say

@UNLOCKED = grep( !/LOCKED/, @SAME);

since you only need to find the string once.

 print BOTH @SAME;
 print oBOTH @UNLOCKED;
 
 but when I list the output files they are identical:

make sure that LOCKED appears in the original file
otherwise the two files will be the same. ;)

however, instead of creating a new array to hold data already
found in the old array, you could do something like:

foreach ( @SAME )
{
print oBOTH unless /LOCKED/;
}
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: to remove the file extension

2001-09-13 Thread _brian_d_foy

In article [EMAIL PROTECTED], [EMAIL PROTECTED] 
(Jaya Kumaran) wrote:


   In a directory there exist *.c and *.out files. Here *.out is 
   created for every *.c file. I need to check whether .out is 
   generated for all the .c file. How to achive this.


you can do something like so.  remember that glob and -e are going
to operate in the current working directory so you need to either
be in the directory of interest (perhaps with chdir()) or you
need to use the full path.

#!/usr/bin/perl

foreach( glob('*.c') )
{
my $out = $_;
$out =~ s/\.c$/.obj/;

print Object file does not exist for $_\n
unless -e $out;
}
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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




Re: Sending a user id and password

2001-09-13 Thread _brian_d_foy

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] wrote:

 It's not terribly well-known, but there is an alternative method of 
 using Basic Authentication. 
  

 You should be able to authenticate with the following syntax:

 http://Ovid:[EMAIL PROTECTED]/cgi-bin/ascript.cgi

this isn't any more secure.  the password information is still sent
in the clear.

if you need to protect this stuff, use SSL. :)
-- 
brian d foy [EMAIL PROTECTED] - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html

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