PARSING

2001-07-17 Thread Rahul Garg

Hello Everybody,

$string ="rahul;john;hary;brian;raj;dolly;jim;

What i want to do is parse the string and put different names in a separate 
variable..How!

Thanx in advance,
Waiting for Reply



RE: PARSING

2001-07-17 Thread Brian

Well, if you don't mind using an array you could just do something like:

my @names = split(/\;/, $string);

This will put each name into a different element of the names array.
So, $names[0] would be rahul, $names[1] would be john, etc...

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> 
> Hello Everybody,
> 
> $string ="rahul;john;hary;brian;raj;dolly;jim;
> 
> What i want to do is parse the string and put different names 
> in a separate variable..How!
> 
> Thanx in advance,
> Waiting for Reply
> 


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




Re:Net::Ping

2001-07-17 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Mon, 16 Jul 2001 17:48:29 +0200 (MEST)
From: Jorge Goncalvez 
Subject: Re:Retrieve host
To: [EMAIL PROTECTED]
Mime-Version: 1.0
Content-MD5: wPL9znYmDeTyzQcXNKmp1Q==

Hi I have the following code:

use Net::Ping;
$p = Net::Ping->new();
unless ($p->ping(cu5s46)) 
{   
require Tk::Dialog;
$dialog =$mw-> Dialog( -title => 'NETWORK ALERT BOX',
   -text => "THE NETWORK IS DOWN",  
   -font => "Arial 16 normal",
   -justify => 'center',
   -default_button => 'OK',
   -bitmap =>'error',
   -buttons => [qw/OK/] );


$dialog->Show;
}


$p->close;  


But I would like to put a variable instead of cu5s46, a variable which could 
represent some host name in my network.

How can i do this?Thanks

- End Forwarded Message -



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




Re: Re:Net::Ping

2001-07-17 Thread Robert Graham

Hi Jorge

You can define the host name as a string eg.
$host = "hostname";
where hostname represents the host name on your network,
and then refer to the string in the ping command:
unless ($p->ping($host))

Hope this helps
Robert Graham

> Hi I have the following code:
>
> use Net::Ping;
> $p = Net::Ping->new();
> unless ($p->ping(cu5s46))
> {
> require Tk::Dialog;
> $dialog =$mw-> Dialog( -title => 'NETWORK ALERT BOX',
>-text => "THE NETWORK IS DOWN",
>-font => "Arial 16 normal",
>-justify => 'center',
>-default_button => 'OK',
>-bitmap =>'error',
>-buttons => [qw/OK/] );
>
>
> $dialog->Show;
> }
>
>
> $p->close;
>
>
> But I would like to put a variable instead of cu5s46, a variable which
could
> represent some host name in my network.
>
> How can i do this?Thanks
>
> - End Forwarded Message -
>
>
>
> --
> 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:perl Tk

2001-07-17 Thread Jorge Goncalvez

Hi , I have made a perl tk script with some labels.
Now i want to put a frame that contains alla labels how can I do this?

I tried this but it doesn't work it seems to ignore -width, -length options.
There is only a little frame at the left top which doen't surrond the labels.

My code:
my $mw = MainWindow->new( -title => "Serveur d'installation "
 );
$mw->geometry('570x377');
$image = $mw->Photo(-file => "logo_alcatel.gif");
&makemenu;
&makeframe;
&makelabels;
$mw->repeat($msdelay,[\&check_syslog,$SYSLOG]);


MainLoop;

# Subroutines 
sub makeframe
{
$mw->Frame(-label => "Informations",
   -relief => 'groove',
   -borderwidth => 2,
   -height => 10,
   -width => 15)->pack(-anchor=>'w');



}





sub makelabels
{




$mw->Label(-text => 'Client Ethernet adress')->pack(-anchor=>'w');
my $label1=$mw->Label(-relief=>'sunken', 
  -textvariable=>\$ethernet_address,
  -width=>$lw,
  -anchor=>'w',
  -bg=>'white')->pack(-anchor=>'w');

$mw->Label(-text=> 'Client IP address')->pack(-anchor=>'w');
my $label2=$mw->Label(-relief=>'sunken',
  -textvariable=>\$IP_address,
  -width=>$lw,
  -anchor=>'w',
  -bg=>'white')->pack(-anchor=>'w');

$mw->Label(-text=> 'Client Name')->pack(-anchor=>'w');
my $label3=$mw->Label(-relief=>'sunken',
  -textvariable=>\$client_name,
  -width=>$lw,
  -anchor=>'w',
  -bg=>'white')->pack(-anchor=>'w');

$mw->Label(-text=> 'Boot File')->pack(-anchor=>'w');
my $label4=$mw->Label(-relief=>'sunken',
  -textvariable=>\$boot_file,
  -width=>$lw,
  -anchor=>'w',
  -bg=>'white')->pack(-anchor=>'w');

$mw->Label(-text=> 'Installation File Path')->pack(-anchor=>'w');
my $label5=$mw->Label(-relief=>'sunken',
  -textvariable=>\$install_file_path,
  -width=>$lw,
  -anchor=>'w',
  -bg=>'white')->pack(-anchor=>'w');
}


Thanks.


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




Re: ActivePerl - how does one configure for HTML

2001-07-17 Thread Scott Buckley

> > WinNT comes with "Personal Web Server" (PWS) which is how I'm learning
Perl
> > CGI.  You can put your scripts in C:\Inetpub\wwwroot\cgi-bin.  You can
then
> > run them by going to:
> > your_homepage\cgi-bin\your_script.pl.  I'm not sure if Windows 98 comes
with
> > PWS.  Sorry I couldn't be of more help - just learning myself.
>
> Depending on what version of Windows NT you have, you may even have IIS as
> part of your system (I think you need the server version with SP 4 and
> higher).  There's also Apache, which can be built on NT and Win2K.
> Again, though, don't know what things Windows 98 will support.  I think
> Personal Web server may be the only thing.

I too had the same problem of tring to run CGI scripts under Windows 98. I
tried running them from the command line and they worked fine, but I wanted
to get a feel for them in the browser.
I thought I was doomed until I discovered the wonders of Apache. Go here
http://httpd.apache.org/docs/windows.html for instructions on using and
downloadin Apache for Win32 (You will also need the Microsoft Installer, but
the page contains information on getting it).
Instead of the normal shebang line, have "#!PERL" at the top of your script
and plop the script in C:\Program Files\Apache Group\Apache\cgi-bin\ (Or
what ever directory you installed Apache in), and you should get normal
output to the browser (Remember to include the MIME content line though).

Hope this helps.
-Cheers, Scott.



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




Re: removing white spaces

2001-07-17 Thread dave hoover

javier wrote:
> It sounds a bit stupid but I don't know the way to
> remove white spaces in a
> string.
> 
> $string = "No sé como quitar los putos spacios";
> and now?

$string =~ s/ //g;

Here's one way to do it.

=
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




Re: ActivePerl - how does one configure for HTML

2001-07-17 Thread Joel Divekar

Hi Scott

I was having sleepless nights because of the same problem I tried whatever 
I could, tried configuring PWS it didn't work  surely will check 
the link. One right solution can help many more lives

Thanks a lot

Regards

Joel

At 08:09 PM 7/17/2001 +1000, you wrote:
> > > WinNT comes with "Personal Web Server" (PWS) which is how I'm learning
>Perl
> > > CGI.  You can put your scripts in C:\Inetpub\wwwroot\cgi-bin.  You can
>then
> > > run them by going to:
> > > your_homepage\cgi-bin\your_script.pl.  I'm not sure if Windows 98 comes
>with
> > > PWS.  Sorry I couldn't be of more help - just learning myself.
> >
> > Depending on what version of Windows NT you have, you may even have IIS as
> > part of your system (I think you need the server version with SP 4 and
> > higher).  There's also Apache, which can be built on NT and Win2K.
> > Again, though, don't know what things Windows 98 will support.  I think
> > Personal Web server may be the only thing.
>
>I too had the same problem of tring to run CGI scripts under Windows 98. I
>tried running them from the command line and they worked fine, but I wanted
>to get a feel for them in the browser.
>I thought I was doomed until I discovered the wonders of Apache. Go here
>http://httpd.apache.org/docs/windows.html for instructions on using and
>downloadin Apache for Win32 (You will also need the Microsoft Installer, but
>the page contains information on getting it).
>Instead of the normal shebang line, have "#!PERL" at the top of your script
>and plop the script in C:\Program Files\Apache Group\Apache\cgi-bin\ (Or
>what ever directory you installed Apache in), and you should get normal
>output to the browser (Remember to include the MIME content line though).
>
>Hope this helps.
>-Cheers, Scott.


--
QuantumLink Communications, Bombay, India



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




Re: PARSING

2001-07-17 Thread Joel Divekar

Hi Rahul

Show what attempts you have done before asking for help ok ... how do you 
plan to grow. Anyway this is what you are looking for


$string ="rahul;john;hary;brian;raj;dolly;jim;";

my @a = split(/;/, $string);

foreach $item (@a)
{
 print "$item\n";
}

Regards

Joel

At 01:18 PM 7/17/2001 +0530, Rahul Garg wrote:
>Hello Everybody,
>
>$string ="rahul;john;hary;brian;raj;dolly;jim;
>
>What i want to do is parse the string and put different names in a 
>separate variable..How!
>
>Thanx in advance,
>Waiting for Reply


--
QuantumLink Communications, Bombay, India



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




Re: removing white spaces

2001-07-17 Thread Jason Ledbetter

On 17 Jul 2001, softhome wrote:

> $string = "No sé como quitar los putos spacios";
> and now?

I'm sure there's a more elegant solution, but here's what I would do:

$string = "Cuando bebo demasiada cerveza, mi nombre es 'Sue.'"
$string =~ s/ //g;
(or)
$string =~ s/\s//g;

The first would just gack the spaces, while the second would gack spaces, line 
returns, etc. The /g makes it global. Like I said, I'm sure there's a better way, but 
it's too early to think of one.

Would tr// be a better choice?

-- 

Jason Ledbetter
Data Conversion Specialist
Cadmus Professional Communications
[EMAIL PROTECTED]


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




page generation

2001-07-17 Thread IT Dept - Terry Honeyford

Hi 
Still trying to get to grips with a simple script, with no luck
the folders are created OK
but only the first 2 items of @pages get made the web page returns with a
blank page
to make matters worse doing a 'top' reveals that the process is still
running
and eating up CPU time!
this has got to be simple, but It's got me foxed

Can anyone help?

TIA

Terry



if ($Exname ne ""){
$Exname =~ s/ /""/gs;
$ExFoldername = $Exname."_Folder";  
if (!-e "/web/html/ExhibitionFolder/98/$ExFoldername") 
{ 
`mkdir /web/html/ExhibitionFolder/98/$ExFoldername`;#or die "couldnt
make folder $ExFoldername $!";
`mkdir /web/html/ExhibitionFolder/98/$ExFoldername/$Exname` ;#or die
"couldnt make folder $ExFoldername/$Exname $!";
`cp -rp $path/ExhibitionFolder/98/Templates/images
/web/html/ExhibitionFolder/98/$ExFoldername/$Exname/`;

#---
# if directories created OK then open html pages to alter
#---
foreach $NEWPAGE (@pages){
chomp $NEWPAGE;
open(PAGE, "<$path/ExhibitionFolder/98/Templates/$NEWPAGE")
or die("Cannot open template at 80- $!");
$npage  = join '', ;


close PAGE; 


  

  

while ($NEWPAGE eq "header.html")
{
$npage =~ s/#Exname#/$pexname/gs;
$npage =~ s/#dates#/$dates/gs;
$npage =~ s/#Venueadd#/$Venueadd/gs;
}
while ($NEWPAGE eq "contents.html")
{
$npage =~ s/#Exname#/$pexname/gs;
$npage =~ s/#dates#/$dates/gs;
$npage =~ s/#Venueadd#/$Venueadd/gs;
}

open(NEW,
">/web/html/ExhibitionFolder/98/$ExFoldername/$Exname/$NEWPAGE") or die
"can't open newpage at 100 - $!";
print (NEW "$npage");
close NEW;

}

}else{
$content = "file exists  no action taken
"; 
}
}


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




RE: Parsing of a File and SEARCH ...........HELP!!!!!!!!!!!!!

2001-07-17 Thread Brian

This should help you, the while will step through each line of the text
file, and you can do whatever you want using the magical $_ variable.
God I love perl.

open(F, ") {
do something with $_;
  }
close(F);

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> -Original Message-
> From: Rahul Garg [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, July 17, 2001 2:15 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Parsing of a File and SEARCH ...HELP!
> 
> 
> 
> 
> one more simpleQ...
> 
> After opening the file ,
> How to read a file line by line...sample code
> 
> 
> Thax in advance.
> waiting for replies.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> - Original Message -
> From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> To: Rahul Garg <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 16, 2001 6:10 PM
> Subject: Re: Parsing of a File and SEARCH ...HELP!
> 
> 
> > On Jul 16, Rahul Garg said:
> >
> > >1)I want to look out for a particular string in a file.
> > >   Actually there is only one strng in each line of a file.
> > >How to search for it.sample codeas 
> i am new to
> syntax of perl
> >
> > For just finding ONE string in ANOTHER string, the index() 
> function is all
> > you need.
> >
> >   my $pos = index("jeffrey", "fre");   # 3
> >   my $pos = index("jeffrey", "jeff");  # 0
> >   my $pos = index("jeffrey", "free");  # -1
> >
> > As you can see, the function returns -1 on failure.  Please 
> read the docs
> > for the function:
> >
> >   perldoc -f index
> >
> > >2)I want to look out for a particular part(match) in a 
> string in a file.
> > >   Actually there is only one string in each line of a file.
> >
> > You need to open the file, and go through it, line by line, 
> executing the
> > index function on the line.
> >
> >   while () {
> > if (index($_, $word) > -1) {
> >   # $word was found somewhere in $_
> > }
> >   }
> >
> > Learn how to work with files:
> >
> >   perldoc perlopentut
> >   perldoc -f open
> >
> > --
> > Jeff "japhy" Pinyan  [EMAIL PROTECTED]  
> http://www.pobox.com/~japhy/
> > I am Marillion, the wielder of 
> Ringril, known as Hesinaur, the Winter-Sun.
> > Are you a Monk?  http://www.perlmonks.com/ 
> http://forums.perlguru.com/
> > Perl Programmer at RiskMetrics 
> Group, Inc. http://www.riskmetrics.com/
> > Acacia Fraternity, Rensselaer Chapter. Brother #734
> > **  Manning Publications, Co, is publishing my Perl 
> Regex book  **
> >
> >
> > --
> > 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]




ps2pdf

2001-07-17 Thread Rizwan

Hi!
I need to download ps2odf.. I have searched a lot ..but with no success.
Somebody help me!


Rizwan

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




FW: Validation question

2001-07-17 Thread Customer Service


Thanks a bunch for everyone’s input; I didn’t have to wait long at all
to receive an answer from all of you knowledgeable people.  A few questions:
What smtp server software would you recommend I use to send email to
myself (localhost)?  I have win98se, apache, activestate_perl.
And, How do I use CGI.pm to parse a form’s output?  Do I just do:

#!c:/perl/bin/perl –w

use CGI.pm

# Then something like

print "Content-type: text/html\n\n";
print header;
foreach $key (sort keys(%formdata)) {
   print "The field named$key
   contained $formdata{$key}";
   }

# Does anyone have a nicely customizable form validation script I can
use instead of “reinventing” one?

Also, it seems that there are a number of programmers on this list who feel
passionate about validating scripts server-side.  Since I do my validation
using javascript, then send it to the server so that “formmail.pl” can chew
on it.  The example below has been modified to run on my machine for testing
purposes.  Normally, it is on the remote host.
##
http://127.0.0.1/cgi-bin/form_parse.pl"; name = "cattlemancustomForm">



###

So, if I use a server-side validation script, how do keep my email addr
hidden from clients, (refer to above example?

Thanks,
Nathan @ [EMAIL PROTECTED]





Re: ps2pdf

2001-07-17 Thread Abdulaziz Ghuloum

In article <01071714101300.07584@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote:
ps2pdf is part of the GhostScript suite.  Does this have anything to do
with perl?

Aziz,,,

> Hi!
> I need to download ps2odf.. I have searched a lot ..but with no success.
> Somebody help me!
> 
> 
> Rizwan

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




Re: Validation question

2001-07-17 Thread Pierre Smolarek

It is possible to install sendmail on windows, you could consider that.
Other then that, i have no major experience with smtp on win 9x :) use
windows 2000? There is an smtp part of it.

Pierre


- Original Message -
From: "Customer Service" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:22 PM
Subject: FW: Validation question


>
> Thanks a bunch for everyone's input; I didn't have to wait long at all
> to receive an answer from all of you knowledgeable people.  A few
questions:
> What smtp server software would you recommend I use to send email to
> myself (localhost)?  I have win98se, apache, activestate_perl.
> And, How do I use CGI.pm to parse a form's output?  Do I just do:
>
> #!c:/perl/bin/perl -w
>
> use CGI.pm
>
> # Then something like
>
> print "Content-type: text/html\n\n";
> print header;
> foreach $key (sort keys(%formdata)) {
>print "The field named$key
>contained $formdata{$key}";
>}
>
> # Does anyone have a nicely customizable form validation script I can
> use instead of "reinventing" one?
>
> Also, it seems that there are a number of programmers on this list who
feel
> passionate about validating scripts server-side.  Since I do my validation
> using javascript, then send it to the server so that "formmail.pl" can
chew
> on it.  The example below has been modified to run on my machine for
testing
> purposes.  Normally, it is on the remote host.
> ##
>  "http://127.0.0.1/cgi-bin/form_parse.pl"; name = "cattlemancustomForm">
>  type="hidden" name="recipient" value="[EMAIL PROTECTED]">
>  type="hidden"  name="subject" value="Cattleman form submittal">
>  type="hidden"  name="title" value="Info">
> ###
>
> So, if I use a server-side validation script, how do keep my email addr
> hidden from clients, (refer to above example?
>
> Thanks,
> Nathan @ [EMAIL PROTECTED]
> 
>
>


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




Re: Validation question

2001-07-17 Thread Pierre Smolarek

http://www.indigostar.com/sendmail.htm


- Original Message -
From: "Customer Service" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:22 PM
Subject: FW: Validation question


>
> Thanks a bunch for everyone's input; I didn't have to wait long at all
> to receive an answer from all of you knowledgeable people.  A few
questions:
> What smtp server software would you recommend I use to send email to
> myself (localhost)?  I have win98se, apache, activestate_perl.
> And, How do I use CGI.pm to parse a form's output?  Do I just do:
>
> #!c:/perl/bin/perl -w
>
> use CGI.pm
>
> # Then something like
>
> print "Content-type: text/html\n\n";
> print header;
> foreach $key (sort keys(%formdata)) {
>print "The field named$key
>contained $formdata{$key}";
>}
>
> # Does anyone have a nicely customizable form validation script I can
> use instead of "reinventing" one?
>
> Also, it seems that there are a number of programmers on this list who
feel
> passionate about validating scripts server-side.  Since I do my validation
> using javascript, then send it to the server so that "formmail.pl" can
chew
> on it.  The example below has been modified to run on my machine for
testing
> purposes.  Normally, it is on the remote host.
> ##
>  "http://127.0.0.1/cgi-bin/form_parse.pl"; name = "cattlemancustomForm">
>  type="hidden" name="recipient" value="[EMAIL PROTECTED]">
>  type="hidden"  name="subject" value="Cattleman form submittal">
>  type="hidden"  name="title" value="Info">
> ###
>
> So, if I use a server-side validation script, how do keep my email addr
> hidden from clients, (refer to above example?
>
> Thanks,
> Nathan @ [EMAIL PROTECTED]
> 
>
>


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




Re: FW: Validation question

2001-07-17 Thread Akshay Arora

to get the form data you can just use CGI's param('key') command

use CGI;
$cgi = CGI;
$value = $cgi->param('key');

as for Mail, there are lots of options. I've been partial towards
MIME::Lite, but I know others will give you more example. Look into the
Net package (Net::Mail perhaps?)

-Akshay

Customer Service wrote:
> 
> Thanks a bunch for everyone’s input; I didn’t have to wait long at all
> to receive an answer from all of you knowledgeable people.  A few questions:
> What smtp server software would you recommend I use to send email to
> myself (localhost)?  I have win98se, apache, activestate_perl.
> And, How do I use CGI.pm to parse a form’s output?  Do I just do:
> 
> #!c:/perl/bin/perl –w
> 
> use CGI.pm
> 
> # Then something like
> 
> print "Content-type: text/html\n\n";
> print header;
> foreach $key (sort keys(%formdata)) {
>print "The field named$key
>contained $formdata{$key}";
>}
> 
> # Does anyone have a nicely customizable form validation script I can
> use instead of “reinventing” one?
> 
> Also, it seems that there are a number of programmers on this list who feel
> passionate about validating scripts server-side.  Since I do my validation
> using javascript, then send it to the server so that “formmail.pl” can chew
> on it.  The example below has been modified to run on my machine for testing
> purposes.  Normally, it is on the remote host.
> ##
>  "http://127.0.0.1/cgi-bin/form_parse.pl"; name = "cattlemancustomForm">
>  type="hidden" name="recipient" value="[EMAIL PROTECTED]">
>  type="hidden"  name="subject" value="Cattleman form submittal">
>  type="hidden"  name="title" value="Info">
> ###
> 
> So, if I use a server-side validation script, how do keep my email addr
> hidden from clients, (refer to above example?
> 
> Thanks,
> Nathan @ [EMAIL PROTECTED]
> 

--
http://www.5vs1.com - A Pearl Jam Fan Site

"Only when the last tree is dead, the last river damned, and the last
field paved, will we realize that we can't eat money."

"Time is long and life is short, so begin to live while you still can."
-Eddie Vedder

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




Re: ps2pdf

2001-07-17 Thread Rizwan

The module is perl script... I think this relevent enough.

On Tuesday 17 July 2001 05:14 pm, you wrote:
> [This is an email copy of a Usenet post to "perl.beginners"]
>
> In article <01071714101300.07584@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote:
> ps2pdf is part of the GhostScript suite.  Does this have anything to do
> with perl?
>
> Aziz,,,
>
> > Hi!
> > I need to download ps2odf.. I have searched a lot ..but with no success.
> > Somebody help me!
> >
> >
> > Rizwan

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




Warnings

2001-07-17 Thread paul


So I am finally tightening up my code using strict and -w.

I have:


$reason2= @theline[$headers{"reason\:"}];
$s_port = @theline[$headers{"s_port"}];
if(($reason2 ne "unknown established TCP packet") and ($s_port ne 
"nameserver")) 
{
   blah
}



Produces the warning:

"Use of uninitialized value in string ne at logisys.pl line 139,  line 3"

Even though the initialise line is there.

Any ideas?

Paul.




Global WebMail -
  Delivered by Global Internet www.global.net.uk





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




Re: Warnings

2001-07-17 Thread Maxim Berlin

Hello paul,

Tuesday, July 17, 2001, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


pzcu> So I am finally tightening up my code using strict and -w.
[...]
pzcu> Produces the warning:

pzcu> "Use of uninitialized value in string ne at logisys.pl line 139,  line 3"

pzcu> Even though the initialise line is there.

pzcu> Any ideas?
please show full source;
your part has succesfully checked by my perl.

use strict;
my ($reason2, @theline, %headers, $s_port);
$reason2= @theline[$headers{"reason\:"}];
$s_port = @theline[$headers{"s_port"}];
if(($reason2 ne "unknown established TCP packet") and ($s_port ne "nameserver"))
{
}

D:\temp>perl -cw t.pl
t.pl syntax OK



Best wishes,
 Maximmailto:[EMAIL PROTECTED]



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




Re: Learning Perl (3rd Edition)

2001-07-17 Thread Francis Henry

Craig:

You might try bestbookbuys.com.

Good luck,
Francis

Craig Westerman wrote:

> Amazon and others are back ordered 3 to 5 weeks. Does any know of a online
> retailer that has them in stock?
>
> Thanks
>
> Craig ><>
> [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]




effect of while on filehandle

2001-07-17 Thread charles

1:#!/usr/bin/perl -w
2:
3:use strict;
4:
5:my $host;
6:
7:open FH, "lunarmedia";
8:
9:while () {
10:  $host = $_;
11:  if ( $host =~ /^host/ ) {
12:$host =~ s/^hostname\s(.*)/$1/;
13:chomp $host;
14:  }
15:}
16:open NFH, ">$host";
17:  print NFH ;
18:close NFH;
19:close FH;


this script is just a test of sorts for a snippet of code to go into a
larger script. my issue is that the print statement on line 17 doesnt seem
to work. the file referenced by $host in line 16 gets created, however
none of FH's contents are placed in NFH. do i need to re-open FH after the
while statement in order for this print to work? and if so, why is it
automagically being closed?

thanks -charles


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




RE: effect of while on filehandle

2001-07-17 Thread Mooney Christophe-CMOONEY1

After the while statement on line 9 is finished, the entire file has been
read and there is nothing left to read.  You either close or reopen, or a
better alternative might be to use the 'seek' function

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 8:49 AM
To: Perl Discuss
Subject: effect of while on filehandle


1:#!/usr/bin/perl -w
2:
3:use strict;
4:
5:my $host;
6:
7:open FH, "lunarmedia";
8:
9:while () {
10:  $host = $_;
11:  if ( $host =~ /^host/ ) {
12:$host =~ s/^hostname\s(.*)/$1/;
13:chomp $host;
14:  }
15:}
16:open NFH, ">$host";
17:  print NFH ;
18:close NFH;
19:close FH;


this script is just a test of sorts for a snippet of code to go into a
larger script. my issue is that the print statement on line 17 doesnt seem
to work. the file referenced by $host in line 16 gets created, however
none of FH's contents are placed in NFH. do i need to re-open FH after the
while statement in order for this print to work? and if so, why is it
automagically being closed?

thanks -charles


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




Array element replacement with array

2001-07-17 Thread Craig Moynes/Markham/IBM

This is a small test program I wrote to test the feasibility of what I want
to do.
Basically if an  element in the array exists as a package group in the
hash, the array element be replace with the elements of the package group.

A package group is a hash ( I think its actually a scalar reference to an
anonymous hash ) that does NOT contain the key 'lppname' .

Does anyone see any potential flaws with this solution ?
Any cleaner ways do go about the same thing ?

Cheers,


#!/usr/bin/perl -w
use strict;

my @array = qw(A B Y C D E);
my %hash;
$hash{A} = {
lppname => "A",
};
$hash{B} = {
lppname => "B",
};
$hash{C} = {
Q   => "1",
R   => "1",
S   => "1",
};
$hash{D} = {
lppname => "D",
};
$hash{E} = {
X   => "1",
Y   => "1",
Z   => "1",
};

my @newElements;
print "@array\n";
my $index = 0;
while ( $index <= $#array )
{
if ( not defined $hash{$array[$index]} )
{
print $array[$index]." does not exist.\n";
}
elsif ( not exists $hash{$array[$index]}->{lppname} )
{
print $array[$index]." is a package group.\n";
push @array, keys %{$hash{$array[$index]}};
splice( @array, $index, 1);
}
$index++;
}
print "@array\n";

-
Craig Moynes
[EMAIL PROTECTED]



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




RE: page generation

2001-07-17 Thread Ross, Jonathan C.

> Hi Still trying to get to grips with a simple script, with no luck the
> folders are created OK but only the first 2 items of @pages get made
> the web page returns with a blank page to make matters worse doing a
> 'top' reveals that the process is still running and eating up CPU
> time!

> if ($Exname ne ""){
> $Exname =~ s/ /""/gs;
> $ExFoldername = $Exname."_Folder";  
>   if (!-e "/web/html/ExhibitionFolder/98/$ExFoldername") 
>   { 
>   `mkdir /web/html/ExhibitionFolder/98/$ExFoldername`;
>   `mkdir /web/html/ExhibitionFolder/98/$ExFoldername/$Exname` ;
>   `cp -rp $path/ExhibitionFolder/98/Templates/images
> /web/html/ExhibitionFolder/98/$ExFoldername/$Exname/`;

Comment -- for clarity, you might want to use a temp variable, e.g.:

my $folder = "/web/html/ExhibitionFolder/98/$ExFoldername";
if (! -e $folder) {
`mkdir $folder`; # or die, etc...
`mkdir $folder/$Exname`;
}

> #---
> # if directories created OK then open html pages to alter
> #---
>   foreach $NEWPAGE (@pages){
>
>   chomp $NEWPAGE;
>   open(PAGE, "<$path/ExhibitionFolder/98/Templates/$NEWPAGE")
>or die("Cannot open template at 80- $!");
>   $npage  = join '', ;
>   close PAGE; 
>   
>   while ($NEWPAGE eq "header.html")
>   {
>   $npage =~ s/#Exname#/$pexname/gs;
>   $npage =~ s/#dates#/$dates/gs;
>   $npage =~ s/#Venueadd#/$Venueadd/gs;
>   }
>   while ($NEWPAGE eq "contents.html")
>   {
>   $npage =~ s/#Exname#/$pexname/gs;
>   $npage =~ s/#dates#/$dates/gs;
>   $npage =~ s/#Venueadd#/$Venueadd/gs;
>   }

My guess is you are trying to replace strings in HTML templates, but these
loops will spin forever, because the variable you are modifying ($npage) has
nothing to do with the loop variable ($NEWPAGE).  (It looks like you were
working on two solutions here: one which read the entire template into a
string, and one which worked on a line at a time.  You kept the file read
from the first solution and the loop from the second.)

I am uncertain what the conditions ($NEWPAGE eq "foo.html") are about, but
you
probably want something like this.  (Warning: not debugged.)

foreach $NEWPAGE (@pages)
{
chomp $NEWPAGE;
open(PAGEIN, "<$path/ExhibitionFolder/98/Templates/$NEWPAGE")
or die("Cannot open template: $!\n");
open(PAGEOUT, ">$folder/$Exname/$NEWPAGE")
or die("Cannot open page output: $!\n");

while () {
s/#Exname#/$pexname/g;
s/#dates#/$dates/g;
s/#Venueadd#/$Venueadd/g;
print PAGEOUT;
}

close PAGEIN;
close PAGEOUT;
}

Regards,
Jonathan


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




Activestate installation

2001-07-17 Thread debashis rana (JIC)

Hi,

I attempted to install activestate perl in my WinME system. While
installing, it asked me if I want to put the bin directory in the PATH. I
answered yes. But at the end, I dont get 'perl -v' working at the c:\
prompt. perl -v works ok if I change directory to c:\perl\bin. Sould I put
the path directory manually to my autoexec.bat file? Is there anything else
that I will have to configure to get activestate perl running. 

Will appreciate your response.

Cheers,
Debashis Rana

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




sprintf question

2001-07-17 Thread F.H

Hi,
Anybody know the right syntax to left justify a string with zeros using sprintf ot any 
other function?
$test = "mytest";
$test = sprintf "0%24s", $test;
print "test";

I am getting only one zero.

Thanks for your help.

I.S
__
Get your own FREE, personal Netscape Webmail account today at 
http://webmail.netscape.com/

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




Re: Macros concept?

2001-07-17 Thread smoot

> Rajanikanth Dandamudi <[EMAIL PROTECTED]> said:

>   Is there a concept of macros in perl, i.e.
> Is there some thing like preprocessor processing
> in perl. Thanks in advance.

Nto that I am aware of. I have preprocessed perl scripts with the m4 macro 
preprocessor, but you have to be careful to disable some of the builtin m4 
macros which clash with perl functions. e.g. shift.  

-- 
Smoot Carl-Mitchell
Consultant



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




Re: Macros concept?

2001-07-17 Thread Paul


--- [EMAIL PROTECTED] wrote:
> > Rajanikanth Dandamudi <[EMAIL PROTECTED]> said:
> 
> >   Is there a concept of macros in perl, i.e.
> > Is there some thing like preprocessor processing
> > in perl. Thanks in advance.
> 
> Nto that I am aware of. I have preprocessed perl scripts with the m4
> macro preprocessor, but you have to be careful to disable some of the
> builtin m4 macros which clash with perl functions. e.g. shift.  

c.f. perldoc perlrun for the -P option

-P 
   causes your script to be run through the C preprocessor before
   compilation by Perl. (Because both comments and cpp directives
   begin with the # character, you should avoid starting comments
   with any words recognized by the C preprocessor such as "if",
   "else", or "define".) 



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




Re: ps2pdf

2001-07-17 Thread Abdulaziz Ghuloum

Hello,
ps2pdf and pdf2ps are shell scripts that fire gs to do the actual
conversion.  Are we talking about the same thing or two things with the
same name?

Aziz,,,

In article <01071717292301.07584@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote:
> The module is perl script... I think this relevent enough.

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




Re: Warnings

2001-07-17 Thread Jeff 'japhy' Pinyan

On Jul 17, [EMAIL PROTECTED] said:

>   $reason2= @theline[$headers{"reason\:"}];
>   $s_port = @theline[$headers{"s_port"}];

You should be warning about using @ when you should be using $.

>   if(($reason2 ne "unknown established TCP packet") and ($s_port ne 
>"nameserver")) 

They might have been assigned values above, but those values are
undefined, thus the error message.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **


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




Re: sprintf question

2001-07-17 Thread Jeff 'japhy' Pinyan

On Jul 17, F.H said:

>$test = sprintf "0%24s", $test;
>
>I am getting only one zero.

Your 0 is misplaced.

  sprintf '%024s', $test;

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **


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




Regex giving me fits!! :-(

2001-07-17 Thread Gary Luther

I am having to parse dates out of lines where the date format varies considerably. 

Here is the statement that is contained in $look

  EFFECTIVE DATE:  07/12/01DAILY CUSTOMER ACCOUNT REPORT   
 RUN DATE:  07/13/01

There are two blanks (in this particular file in front of the EFFECTIVE. 
The DATE: 07/12/01 can appear in slightly varying formats from report to report. The 
possibilities are:

DATE: nn/nn/nn
DATE  nn/nn/nn
DATE : nn/nn/nn
DATE:  nn/nn/

and perhaps more that I have yet to discover. Here is the match statement I am using 
to parse out the date:

$look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;

What I expect in $1 is 07/12/01

The \W? is for the disappearing colon (:)

I have run several programs through that have a similar structure and they seem to 
work but this one fails for some reason.

So...Guru's I would appreciate your inciteful reflections and / or incantations as to 
why this is not working.

TIA


--
-
"They that can give up essential liberty 
   to obtain a little temporary safety 
   deserve neither liberty  nor safety."  

-- Benjamin Franklin 
-
RGary Luther
RR  RR   SAF
RR  RR UTABEGAS  2500 Broadway
RR RRHelena, MT 59602
 [EMAIL PROTECTED]
RR RR  ULE !!
RR  RR   Visit our website at
RR   RR  http://www.safmt.org




BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Gary Luther
TEL;WORK:0631
ORG:;Computer Center
TEL;PREF;FAX:(406) 444-0684
EMAIL;WORK;PREF;NGW:[EMAIL PROTECTED]
N:Luther;Gary
TITLE:Systems Administrator
END:VCARD




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


Re: Warnings

2001-07-17 Thread paul

In reply-to [EMAIL PROTECTED] on Tue Jul 17 16:24:55 2001
>On Jul 17, [EMAIL PROTECTED] said:
>
>>  $reason2= @theline[$headers{"reason\:"}];
>>  $s_port = @theline[$headers{"s_port"}];
>
>You should be warning about using @ when you should be using $.
>
>>  if(($reason2 ne "unknown established TCP packet") and ($s_port ne 
>"nameserver")) 
>
>They might have been assigned values above, but those values are
>undefined, thus the error message.
>

Ok, I didn't get a warning on the @theline[ but I changed it anyway.   Same problem.

$headers{"s_port"} definitely contains a value, lets say 12

@theline is generated from a split of a line from a delimited file.  Some of the 
fields are empty, so you get two delimiters without content between them.

$theline[12] may or may not contain a value, but would have been initialised during 
the split I would have thought.  In this instances it is much more likely that it 
contains data.

So what am I missing?







 



Global WebMail -
  Delivered by Global Internet www.global.net.uk





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




Re: sprintf question

2001-07-17 Thread Abdulaziz Ghuloum

Hello, 
   You can use something like:

print lj("Hello", 30, '*') . "\n";
#prints Hello*

sub lj{
return $_[0] . ($_[2]||' ') x ($_[1] - length $_[0]);
}

Aziz,,,


In article <[EMAIL PROTECTED]>, "F.H"
<[EMAIL PROTECTED]> wrote:

> Hi,
> Anybody know the right syntax to left justify a string with zeros using
> sprintf ot any other function? $test = "mytest";
> $test = sprintf "0%24s", $test;
> print "test";

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




Re: Parsing of a File and SEARCH ...........HELP!!!!!!!!!!!!!

2001-07-17 Thread Lynn Glessner

I see that someone has already answered, here is another example since you
are searching.
Since I am still new, writing it that way makes more sense, is more legible
to me :)

while ($line = ) {
#do something with that line, like a substitution
$line =~ s/dog/cat/;
}

does that help? The while loop will read each line until it reaches EOF.


- Original Message -
From: "Rahul Garg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 16, 2001 11:15 PM
Subject: Re: Parsing of a File and SEARCH ...HELP!


>
>
> one more simpleQ...
>
> After opening the file ,
> How to read a file line by line...sample code
>
>
> Thax in advance.
> waiting for replies.
>
>
>
>
>
>
>
>
>
>
>
> - Original Message -
> From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> To: Rahul Garg <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 16, 2001 6:10 PM
> Subject: Re: Parsing of a File and SEARCH ...HELP!
>
>
> > On Jul 16, Rahul Garg said:
> >
> > >1)I want to look out for a particular string in a file.
> > >   Actually there is only one strng in each line of a file.
> > >How to search for it.sample codeas i am new to
> syntax of perl
> >
> > For just finding ONE string in ANOTHER string, the index() function is
all
> > you need.
> >
> >   my $pos = index("jeffrey", "fre");   # 3
> >   my $pos = index("jeffrey", "jeff");  # 0
> >   my $pos = index("jeffrey", "free");  # -1
> >
> > As you can see, the function returns -1 on failure.  Please read the
docs
> > for the function:
> >
> >   perldoc -f index
> >
> > >2)I want to look out for a particular part(match) in a string in a
file.
> > >   Actually there is only one string in each line of a file.
> >
> > You need to open the file, and go through it, line by line, executing
the
> > index function on the line.
> >
> >   while () {
> > if (index($_, $word) > -1) {
> >   # $word was found somewhere in $_
> > }
> >   }
> >
> > Learn how to work with files:
> >
> >   perldoc perlopentut
> >   perldoc -f open
> >
> > --
> > Jeff "japhy" Pinyan  [EMAIL PROTECTED]
http://www.pobox.com/~japhy/
> > I am Marillion, the wielder of Ringril, known as Hesinaur, the
Winter-Sun.
> > Are you a Monk?  http://www.perlmonks.com/
http://forums.perlguru.com/
> > Perl Programmer at RiskMetrics Group, Inc.
http://www.riskmetrics.com/
> > Acacia Fraternity, Rensselaer Chapter. Brother #734
> > **  Manning Publications, Co, is publishing my Perl Regex book
**
> >
> >
> > --
> > 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: page generation

2001-07-17 Thread IT Dept - Terry Honeyford

Thanks for your suggestions Jonathan, that seems to stop the script from
looping
now there is another problem with it!!!
it falls over saying "can't open newpage at 74 - No such file or directory
at /web/cgi/AZcreate.pl line 74"
but the idea is that this file will be created when printing to PAGEOUT,
have I got it all wrong?
I Have marked the line in script below, I would be really gratfull for any
suggestions on how to cure this..

TIA
Terry



...
...foreach $NEWPAGE (@pages)
...{
... chomp $NEWPAGE;
... open(PAGEIN, "<$path/ExhibitionFolder/98/Templates/$NEWPAGE")
... or die("Cannot open template: $!\n");
... open(PAGEOUT, ">$folder/$Exname/$NEWPAGE") 
... or die("can't open newpage at 74 : $!\n"); this is line
74
...
... while () {
... s/#Exname#/$pexname/g;
... s/#dates#/$dates/g;
... s/#Venueadd#/$Venueadd/g;
... print PAGEOUT;
... }
...
... close PAGEIN;
... close PAGEOUT;
...}
...
...Regards,
...Jonathan
...

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




Re: Regex giving me fits!! :-(

2001-07-17 Thread David Wood

The ^ at the start indicates match from the start of a new line.
You don't need this. Try:-

$look =~ /\w{4}\:??\s+([\d\/]+)/;

Gary Luther wrote:
> 
> I am having to parse dates out of lines where the date format varies considerably.
> 
> Here is the statement that is contained in $look
> 
>   EFFECTIVE DATE:  07/12/01DAILY CUSTOMER ACCOUNT REPORT 
>   RUN DATE:  07/13/01
> 
> There are two blanks (in this particular file in front of the EFFECTIVE.
> The DATE: 07/12/01 can appear in slightly varying formats from report to report. The 
>possibilities are:
> 
> DATE: nn/nn/nn
> DATE  nn/nn/nn
> DATE : nn/nn/nn
> DATE:  nn/nn/
> 
> and perhaps more that I have yet to discover. Here is the match statement I am using 
>to parse out the date:
> 
> $look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;
> 
> What I expect in $1 is 07/12/01
> 
> The \W? is for the disappearing colon (:)
> 
> I have run several programs through that have a similar structure and they seem to 
>work but this one fails for some reason.
> 
> So...Guru's I would appreciate your inciteful reflections and / or incantations as 
>to why this is not working.
> 
> TIA
> 
> --
> -
> "They that can give up essential liberty
>to obtain a little temporary safety
>deserve neither liberty  nor safety."
> 
> -- Benjamin Franklin
> -
> RGary Luther
> RR  RR   SAF
> RR  RR UTABEGAS  2500 Broadway
> RR RRHelena, MT 59602
>  [EMAIL PROTECTED]
> RR RR  ULE !!
> RR  RR   Visit our website at
> RR   RR  http://www.safmt.org
> 
>   
> 
>Gary Luther.vcfName: Gary Luther.vcf
>   Type: Plain Text (text/plain)
> 
>   
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 


David Wood, Web Developer
[a] Clickmusic Ltd, 99c Talbot Road, London W11 2AT
[t] 020 7727 7500
[w] www.clickmusic.co.uk
"There are three types of people in the world; those who can count,
and those who can't."
 

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




Re: Regex giving me fits!! :-(

2001-07-17 Thread Luke Bakken

>   EFFECTIVE DATE:  07/12/01DAILY CUSTOMER ACCOUNT REPORT 
>   RUN DATE:  07/13/01
> DATE: nn/nn/nn
> DATE  nn/nn/nn
> DATE : nn/nn/nn
> DATE:  nn/nn/
>
> $look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;

First off, if you have literal slashes to match change your match
delimiter!!!  You won't have to escape the slashes then.

$look =~ m!  !


> What I expect in $1 is 07/12/01

this should work, tho i haven't tried it:

$look =~ m!DATE[ :]+(\d{2}/\d{2}\d{2,4})!;

Match DATE, match 1 or more spaces or colons, then match the date part and
remember it.  If you want to get both dates use the g modifier and assign
the match to a list:

my ($date1, $date2) = (look =~ m!\d{2}/\d{2}/\d{2,4}!g);

Luke


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




Re: Regex giving me fits!! :-(

2001-07-17 Thread Abdulaziz Ghuloum

It's working here!!

Aziz,,,
#!/usr/bin/perl -w
for $look(){
$look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;
print ++$i . "  $1\n";
}
__DATA__
DATE: 12/12/12
DATE  12/12/12
DATE : 12/12/12
DATE:  12/12/1212



In article <[EMAIL PROTECTED]>, "Gary Luther" <[EMAIL PROTECTED]>
wrote:

> I am having to parse dates out of lines where the date format varies
> considerably.
> 
> Here is the statement that is contained in $look
> 
>   EFFECTIVE DATE:  07/12/01DAILY CUSTOMER
>   ACCOUNT REPORTRUN DATE:  07/13/01
> 
> There are two blanks (in this particular file in front of the EFFECTIVE.
> The DATE: 07/12/01 can appear in slightly varying formats from report to
> report. The possibilities are:
> 
> DATE: nn/nn/nn
> DATE  nn/nn/nn
> DATE : nn/nn/nn
> DATE:  nn/nn/
> 
> and perhaps more that I have yet to discover. Here is the match
> statement I am using to parse out the date:
> 
> $look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;
> 
> What I expect in $1 is 07/12/01
> 
> The \W? is for the disappearing colon (:)
> 
> I have run several programs through that have a similar structure and
> they seem to work but this one fails for some reason.
> 
> So...Guru's I would appreciate your inciteful reflections and / or
> incantations as to why this is not working.
> 
> TIA
> 
> 
> --
> -
> "They that can give up essential liberty
>to obtain a little temporary safety
>deserve neither liberty  nor safety."
> 
> -- Benjamin Franklin
> -
> RGary Luther
> RR  RR   SAF
> RR  RR UTABEGAS  2500 Broadway
> RR RRHelena, MT 59602 
> [EMAIL PROTECTED] RR RR  ULE !!
> RR  RR   Visit our website at RR   RR 
> http://www.safmt.org
> 
> 
>

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




Redirection of STDERR

2001-07-17 Thread Roland Schoenbaechler

Hello

In a sub of my script I redirected STDERR in a file. How can I redirect the
STDERR back to the default (screen) for the following subs?

Thanks a lot for your help

Roland






*** PLEASE NOTE ***
This message, along with any attachments, may be confidential or legally
privileged.  It is intended only for the named person(s), who is/are the
only authorized recipients. If this message has reached you in error,
kindly destroy it without review and notify the sender immediately. Thank
you for your help.


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




while ... continue loops

2001-07-17 Thread Mooney Christophe-CMOONEY1

I have been programming perl for quite some time, but i have never used a
'continue' block.  It seems just as easy to put any code that one would
normally put in a continue right into the loop itself.  What is the purpose
of a continue block?  Is there a time where a continue might be prefered to
simply having one block for the whole loop?

Thanks!
christopher

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




Re: Regex giving me fits!! :-(

2001-07-17 Thread Luke Bakken

> this should work, tho i haven't tried it:
>
> $look =~ m!DATE[ :]+(\d{2}/\d{2}\d{2,4})!;

should read:

$look =~ m!DATE[ :]+(\d{2}/\d{2}/\d{2,4})!;
^

that's what i get for not trying it!


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




Re: while ... continue loops

2001-07-17 Thread Brett W. McCoy

On Tue, 17 Jul 2001, Mooney Christophe-CMOONEY1 wrote:

> I have been programming perl for quite some time, but i have never used a
> 'continue' block.  It seems just as easy to put any code that one would
> normally put in a continue right into the loop itself.  What is the purpose
> of a continue block?  Is there a time where a continue might be prefered to
> simply having one block for the whole loop?

The code in a continue block is run whenever going to the next iteration
of a loop.  This is to ensure certain things happen before the conditional
of the loop is re-evaluated.  It might be easier and more maintainable,
code wise, to have that block in one place rather than having it in
several places depending on how you might be forcing a new iteration (with
the next keyword, for instance).  The 'continue' block is like the third
part of the C-like for -- it always runs unless you completely break out
of the loop.

while($something) {

#do some stuff, open files, etc etc etc
..
if($somethingelse) { next }
else {
#do a bunch of other stuff

}
} continue {

$something--;
close SOMEFILE;
print stuff;
}

perldoc perlsyn has more details on this.

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

Totally illogical, there was no chance.
-- Spock, "The Galileo Seven", stardate 2822.3


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




Re: while ... continue loops

2001-07-17 Thread Will Cottay

As I recall, the Camel book says something like "the continue block
is not used often in practice" or something like that.

I've not used it either, but you'd use it if you had code in the loop
that interrupts the loop with a next.  The code after the continue 
gets executed before the condition is evaluated again.

-will

Mooney Christophe-Cmooney1 wrote:
> 
> I have been programming perl for quite some time, but i have never used a
> 'continue' block.  It seems just as easy to put any code that one would
> normally put in a continue right into the loop itself.  What is the purpose
> of a continue block?  Is there a time where a continue might be prefered to
> simply having one block for the whole loop?
> 
> Thanks!
> christopher

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




RE: page generation

2001-07-17 Thread Ross, Jonathan C.

> Thanks for your suggestions Jonathan, that seems to stop the script
> from looping now there is another problem with it!!!  it falls over
> saying "can't open newpage at 74 - No such file or directory at
> /web/cgi/AZcreate.pl line 74" but the idea is that this file will be
> created when printing to PAGEOUT, have I got it all wrong?  I Have
> marked the line in script below, I would be really gratfull for any
> suggestions on how to cure this..
> 
> ...
> ...   open(PAGEIN, "<$path/ExhibitionFolder/98/Templates/$NEWPAGE")
> ...   or die("Cannot open template: $!\n");
> ...   open(PAGEOUT, ">$folder/$Exname/$NEWPAGE") 
> ...   or die("can't open newpage at 74 : $!\n"); this is line
> 74

You probably haven't initialized $folder, or maybe the file specifies
a directory which doesn't exist.

To get a better idea of the problem (and as a general rule), always
include offending data in error messages, e.g.

my $infile = "$path/ExhibitionFolder/98/Templates/$NEWPAGE";
open(PAGEIN, "<$infile") or die("Can't read template $infile: $!\n");
my $outfile = "$folder/$Exname/$NEWPAGE";
open(PAGEOUT, ">$outfile") or die("Can't write $outfile: $!\n");

That should show you which filename can't be opened.

Regards,
Jonathan

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




Multi-unix "hop" logins

2001-07-17 Thread Robin Lavallee (LMC)


Hello,

I need to perform multiple logins in a hop 
scheme on Unix machines in order to retrieve a 
file. 

If I were to do this manually, I would have to do:
rlogin -l  

rlogin -l  


Then, either rcp or ftp the file back to the 
first machine. Then get back on the first machine 
and ftp it back  on the original machine (where my 
script resides). I CANNOT access the last machine without
accessing the intermediate one before.

What would be the best way to attack this problem ?
I've been thinking about using the Expect module, 
and IO::Telnet. Are there any cool CPAN module that 
already do this ?

I don't want this to be over-complicated by
having to parse a bunch of "made for human" shell
interactions...

Thanks !

-Robin

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




Re: Macros concept?

2001-07-17 Thread Michael Fowler

On Tue, Jul 17, 2001 at 08:04:39AM -0700, [EMAIL PROTECTED] wrote:
> > Rajanikanth Dandamudi <[EMAIL PROTECTED]> said:
> 
> >   Is there a concept of macros in perl, i.e.
> > Is there some thing like preprocessor processing
> > in perl. Thanks in advance.

(I don't have the original message, so I'm having to respond to someone's
response.)

What is it you want the feature for?  Perl implements constants with the
constant pragma, which is usually why people ask about the feature in Perl. 
See perldoc constant.


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

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




Re: Redirection of STDERR

2001-07-17 Thread Paul


--- Roland Schoenbaechler <[EMAIL PROTECTED]> wrote:
> In a sub of my script I redirected STDERR in a file. How can I
> redirect the STDERR back to the default (screen) for the following
> subs?

Use local(). It's not something to make a big habit of, but this is a
good place for it.

 sub func {
local *STDERR;
open STDERR, ">$file" or die $!;
# code here
 }  # STDERR gets "fixed" when the local() scope ends here

c.f. perldoc -f local

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




Problem with pattern matching...

2001-07-17 Thread Craig S Monroe

All,

I am trying to make sure that if feature 5 is selected, that it needs to
have a colon and a number after it.
I cannot seem to find the reference to not equaling a pattern match I was
testing for three things.

1. if $feature has a 5 in it
and
2. if $feature does have a 5 in it, make sure it has a colon and a number
after it.
and
3. that my $count is set to 0 as to only ask the user once.
Code is below:

$feature = ;
chomp($feature);
 if (!$feature) {
  $loop2 = 0;
 }
 elsif (($feature =~ /5/) && ($feature !=~ /5:\d+/) && ($count == 0)) {
  print "\nMake sure you enter a \":\" then the number of users when
selecting feature 5\n";
  sleep('3');
  $count = 1;
  $loop2 = 0;
 }
else {
 $loop2 = 1;
}

The middle check is the one I am having problems. I can't find a reference
to make =~ a not equal.

Thanks for any help...

Craig
[EMAIL PROTECTED]
Pager
Numeric: 1-877-895-3558
Email pager: [EMAIL PROTECTED]
--
You will never find time for anything.
If you want time, you must make it.

Charles Buxton


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




Re: Problem with pattern matching...

2001-07-17 Thread Brett W. McCoy

On Tue, 17 Jul 2001, Craig S Monroe wrote:

> The middle check is the one I am having problems. I can't find a reference
> to make =~ a not equal.

The operator you want is !~

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

Life is divided into the horrible and the miserable.
-- Woody Allen, "Annie Hall"


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




Re: Problem with pattern matching...

2001-07-17 Thread Craig S Monroe

Thanks! That did it!

Craig
[EMAIL PROTECTED]
Pager
Numeric: 1-877-895-3558
Email pager: [EMAIL PROTECTED]
--
You will never find time for anything.
If you want time, you must make it.

Charles Buxton

- Original Message -
From: "Brett W. McCoy" <[EMAIL PROTECTED]>
To: "Craig S Monroe" <[EMAIL PROTECTED]>
Cc: "Beginners@Perl (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:50 PM
Subject: Re: Problem with pattern matching...


On Tue, 17 Jul 2001, Craig S Monroe wrote:

> The middle check is the one I am having problems. I can't find a reference
> to make =~ a not equal.

The operator you want is !~

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

Life is divided into the horrible and the miserable.
-- Woody Allen, "Annie Hall"


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




if something equals nothing

2001-07-17 Thread Tyler Longren

How do I do:
if ($something == "") {
# do something
}

in perl?

Thanks,
Tyler



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




Re: while ... continue loops

2001-07-17 Thread Michael Fowler

On Tue, Jul 17, 2001 at 11:17:05AM -0500, Mooney Christophe-CMOONEY1 wrote:
> I have been programming perl for quite some time, but i have never used a
> 'continue' block.  It seems just as easy to put any code that one would
> normally put in a continue right into the loop itself.  What is the purpose
> of a continue block?  Is there a time where a continue might be prefered to
> simply having one block for the whole loop?

To expand a bit on Brett W. McCoy's fine explanation, I very rarely use
continue blocks, it's usually much easier to do it some other way.  That
being said, however, I did use a continue block in a project I'm working on
just now, and it made things much easier.

In pseudo-code:

while (1) {
unless (open cache file) {
if (file exists) {
print "cache file exists...";
next;
}
}

retrieve data;
print data to cache file;

} continue {
this md5sum = construct md5sum from cache file;
last if last md5sum equals this md5sum
}

Basically, I needed to perform a complex operation (the md5sum code) on the
file, but there had to be an early escape if the file already exists.  The
continue block solved the problem neatly.  It could have been solved by
moving blocks around and such, but this way the addition of a new next
will still get to the md5sum code.


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

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




RE: if something equals nothing

2001-07-17 Thread Mooney Christophe-CMOONEY1

Exactly like that, except using 'eq' instead of '=='.
A slightly easier way, though, would be to say

if (!$something) { ... blah blah ... }

Since $something will return false in a boolean context (if it is empty)

-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 12:56 PM
To: Perl Beginners
Subject: if something equals nothing


How do I do:
if ($something == "") {
# do something
}

in perl?

Thanks,
Tyler



-- 
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: if something equals nothing

2001-07-17 Thread Tyler Longren

That doesn't seem to work.  I want if a variable doesn't equal anything,
then do something.  Here's a piece:
if ($options{a} eq "" && $options{a} eq "") {
print "
Usage: log.pl [-d] -a -i [n]\n
-d   :  specify device.  If nothing, eth0 is used
-a*  :  specify alias number
-i*  :  specify ip number to assign to alias
-n   :  specify netmask.  If nothing, 255.255.255.0 is used
Options with a * are required!\n\n";
exit;
}

- Original Message -
From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 12:59 PM
Subject: RE: if something equals nothing


> Exactly like that, except using 'eq' instead of '=='.
> A slightly easier way, though, would be to say
>
> if (!$something) { ... blah blah ... }
>
> Since $something will return false in a boolean context (if it is empty)
>
> -Original Message-
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 12:56 PM
> To: Perl Beginners
> Subject: if something equals nothing
>
>
> How do I do:
> if ($something == "") {
> # do something
> }
>
> in perl?
>
> Thanks,
> Tyler
>
>
>
> --
> 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: if something equals nothing

2001-07-17 Thread Brett W. McCoy

On Tue, 17 Jul 2001, Tyler Longren wrote:

> How do I do:
> if ($something == "") {
> # do something
> }
>
> in perl?

You can do it that but use ne instead == (that's for numeric values only),
but since an empty string returns false in a boolean context, you can say:

if(!$something) {

  #...

}

or, if you want to make sure $something has a defined value:

if(!(defined($something)) {

  #...

}

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

Do not handicap your children by making their lives easy.
-- Robert Heinlein


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




RE: if something equals nothing

2001-07-17 Thread daniels tashi robert


It's worth mentioning that there are a few different kinds of nothings.
The ones I know that apply to ordinary (scalar) variables are
the number zero, the empty string, with or without a null character
to terminate it, boolean false, and undef, the value of variables that
don't exist yet.  A lot of the time they are implicitly converted back
and forth, but sometimes you need to know the difference:

if ($var == 0) {numerical zero}
if ($var eq "") {empty string}
if (!$var) {boolean false}
if (! defined($var) ) {undef}







On Tue, 17 Jul 2001, Mooney Christophe-CMOONEY1 wrote:

> Exactly like that, except using 'eq' instead of '=='.
> A slightly easier way, though, would be to say
>
> if (!$something) { ... blah blah ... }
>
> Since $something will return false in a boolean context (if it is empty)
>
> -Original Message-
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 12:56 PM
> To: Perl Beginners
> Subject: if something equals nothing
>
>
> How do I do:
> if ($something == "") {
> # do something
> }
>
> in perl?
>
> Thanks,
> Tyler
>
>
>
> --
> 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: if something equals nothing

2001-07-17 Thread Mooney Christophe-CMOONEY1

Is this the code you're trying to use?  Because if it is, then the problem
is that you're checking $options{a} twice, instead of checking $options{a}
and $options{i} ... ?

-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 1:05 PM
To: Mooney Christophe-CMOONEY1; Perl Beginners
Subject: Re: if something equals nothing


That doesn't seem to work.  I want if a variable doesn't equal anything,
then do something.  Here's a piece:
if ($options{a} eq "" && $options{a} eq "") {
print "
Usage: log.pl [-d] -a -i [n]\n
-d   :  specify device.  If nothing, eth0 is used
-a*  :  specify alias number
-i*  :  specify ip number to assign to alias
-n   :  specify netmask.  If nothing, 255.255.255.0 is used
Options with a * are required!\n\n";
exit;
}

- Original Message -
From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 12:59 PM
Subject: RE: if something equals nothing


> Exactly like that, except using 'eq' instead of '=='.
> A slightly easier way, though, would be to say
>
> if (!$something) { ... blah blah ... }
>
> Since $something will return false in a boolean context (if it is empty)
>
> -Original Message-
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 12:56 PM
> To: Perl Beginners
> Subject: if something equals nothing
>
>
> How do I do:
> if ($something == "") {
> # do something
> }
>
> in perl?
>
> Thanks,
> Tyler
>
>
>
> --
> 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: if something equals nothing

2001-07-17 Thread Tyler Longren

Sorry for not providing enough of the code.  Here's more that will help.

use strict;
use Getopt::Std;
getopts("d:a:i:n:", \my %options);
if (!defined $options{a} && !defined $options{i}) {
if ($options{a} eq "" && $options{i} eq "") {
print "
Usage: log.pl [-d] -a -i [n]\n
-d   :  specify device.  If nothing, eth0 is used
-a*  :  specify alias number
-i*  :  specify ip number to assign to alias
-n   :  specify netmask.  If nothing, 255.255.255.0 is used
Options with a * are required!\n\n";
exit;
}
}
else {
# do whatever

If the -i and -a flags aren't specified the usage gets printed.  I also want
to check to see if -i and -a have something behind them.  If they're
specified, but there's nothing behind them, the usage should be printed then
too.

Thanks everyone,
Tyler

- Original Message -
From: "daniels tashi robert" <[EMAIL PROTECTED]>
To: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
Cc: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:09 PM
Subject: RE: if something equals nothing


>
> It's worth mentioning that there are a few different kinds of nothings.
> The ones I know that apply to ordinary (scalar) variables are
> the number zero, the empty string, with or without a null character
> to terminate it, boolean false, and undef, the value of variables that
> don't exist yet.  A lot of the time they are implicitly converted back
> and forth, but sometimes you need to know the difference:
>
> if ($var == 0) {numerical zero}
> if ($var eq "") {empty string}
> if (!$var) {boolean false}
> if (! defined($var) ) {undef}



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




Re: if something equals nothing

2001-07-17 Thread Brett W. McCoy

On Tue, 17 Jul 2001, Tyler Longren wrote:

> That doesn't seem to work.  I want if a variable doesn't equal anything,
> then do something.  Here's a piece:
> if ($options{a} eq "" && $options{a} eq "") {

You are comparing the same thing here twice???

How about

if ( !defined($options{a}) && !defined($options{i}) ) {

  ...
}

Usually for usage messages, though, I do something like:

my $usage =<<"USAGE";
usage stuff
usage stuff
USAGE

my $someval = $ARGV[0] or die $usage;

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

You need no longer worry about the future.  This time tomorrow you'll be dead.


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




Re: if something equals nothing

2001-07-17 Thread Paul


--- Tyler Longren <[EMAIL PROTECTED]> wrote:
> That doesn't seem to work.  I want if a variable doesn't equal
> anything, then do something.  Here's a piece:
> if ($options{a} eq "" && $options{a} eq "") {
> print "
> Usage: log.pl [-d] -a -i [n]\n
> -d   :  specify device.  If nothing, eth0 is used
> -a*  :  specify alias number
> -i*  :  specify ip number to assign to alias
> -n   :  specify netmask.  If nothing, 255.255.255.0 is
> used
> Options with a * are required!\n\n";
> exit;
> }

Precedence problems. =o) c.f. perldoc perlop.

Also, did you realize you said $options{a} twice? 

In the meantime, try 

  unless ($options{a} and $options{i}) { die<<__END;

 Usage: log.pl [-d] -a -i [n]

-d   :  specify device.  If nothing, eth0 is used
-a*  :  specify alias number
-i*  :  specify ip number to assign to alias
-n   :  specify netmask. If nothing, 255.255.255.0 is used

Options with a * are required!

__END
  }


> - Original Message -
> From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
> To: "Perl Beginners" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 17, 2001 12:59 PM
> Subject: RE: if something equals nothing
> 
> 
> > Exactly like that, except using 'eq' instead of '=='.
> > A slightly easier way, though, would be to say
> >
> > if (!$something) { ... blah blah ... }
> >
> > Since $something will return false in a boolean context (if it is
> empty)
> >
> > -Original Message-
> > From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 17, 2001 12:56 PM
> > To: Perl Beginners
> > Subject: if something equals nothing
> >
> >
> > How do I do:
> > if ($something == "") {
> > # do something
> > }
> >
> > in perl?
> >
> > Thanks,
> > Tyler
> >
> >
> >
> > --
> > 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]
> 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




Re: if something equals nothing

2001-07-17 Thread Tyler Longren

no...it was supposed to be $options{a} and $options{i}... I accidentally put
a twice in the email
- Original Message -
From: "Brett W. McCoy" <[EMAIL PROTECTED]>
To: "Tyler Longren" <[EMAIL PROTECTED]>
Cc: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>; "Perl Beginners"
<[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:26 PM
Subject: Re: if something equals nothing


> On Tue, 17 Jul 2001, Tyler Longren wrote:
>
> > That doesn't seem to work.  I want if a variable doesn't equal anything,
> > then do something.  Here's a piece:
> > if ($options{a} eq "" && $options{a} eq "") {
>
> You are comparing the same thing here twice???
>
> How about
>
> if ( !defined($options{a}) && !defined($options{i}) ) {
>
>   ...
> }
>
> Usually for usage messages, though, I do something like:
>
> my $usage =<<"USAGE";
> usage stuff
> usage stuff
> USAGE
>
> my $someval = $ARGV[0] or die $usage;
>
> -- Brett
>http://www.chapelperilous.net/btfwk/
> 
> You need no longer worry about the future.  This time tomorrow you'll be
dead.
>
>
> --
> 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]




How Do I Implement an Array or Linked List of Pointers in Perl?

2001-07-17 Thread Chuck Morford

Hi All,
I'm a raw newbie to Perl, but have been coding in Turbo Pascal for many years.

As a way to learn Perl, I've decided to re-implement a text adventure framework that I 
wrote in TP
many years ago, that served as a Pascal training vehicle for me.

In Pascal, I used to create an array or linked list (depending on how much time I 
wanted to spend
coding) of pointers to dynamically allocated records...Then I could use the array or 
list to
traverse lists of objects (things, not OOP) in the game world, and read their 
properties and so
forth by dereferencing the pointers...

How would I do this in Perl?

I think I read somewhere that when I store a Reference in an Array it gets converted 
to a String
and can no longer be used as a Reference...Is that right?

And about Pascal's Record Type. Is there anything equivalent in Perl without getting 
into OOP?



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




RE: How can I avoid browser time outs?

2001-07-17 Thread Brian

I was involved in the writing of www.e-mol.com and we ran into this same
problem, only with a different situation.  E-mol.com allows you to check
your POP3 email from anywhere in the world.  Sounded easy enough.  But,
what if somebody has 75,000 messages?  Well, the browser would time out
waiting for our scripts to get the mail.  So, Brian (a different Brian,
not me) wrote a small javascript on the page that updated a process bar.
Then what he did was print a call to the JavaScript to the browser every
few seconds.  This gave the client something to look at, and it also let
them know how much progress was being made as well as how much was left.
Worked fantastic for us.

Now, I'm not saying this is or isn't the right way to do it, but it's
working great for us.  If you log onto e-mol.com you'll see the progress
bar.  If you do a view source after it moves across a bit, then scroll
down, you'll see the calls to the JS.  Hope this helps you out.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> Hi all,
> 
> I hope this isn't a goofy question ;-)  I have a simple CGI front end
> for processing Snort logs with Calamaris. It is currently set 
> up like this:
> 
> sub do_report
> {local ($command) = @_;
>   $| = 1;
>   print "Content-type: text/html \n\n";
>   system ("$command 2> /dev/null");
> } # end sub do_report
> 
> $command is something like:
> $command = "cat /my/log | /path/to/calamaris -options -to 
> -output -html -etc"
> 
> This works fine when processing smallish logs. However, as my 
> logs have
> grown, I frequently get browser time outs.  What I was 
> thinking is to start
> the log processing then send some sort or server push animation until
> Calamaris is done then push the resulting report.  Is this 
> the correct way
> to go about this?  If so, how?  If not, what is the "right" way?
> 
> Thanks to all for any input,
> -Bill
> 
> 
> -- 
> 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: if something equals nothing

2001-07-17 Thread Bradford Ritchie

Could you be more specific about what doesn't work?  I'm assuming you don't
get any errors or warnings, right?
I tried this code on my system and it works fine.  Even if $options{a} is
undefined ($options{a} eq "") should return true and send you into the block
with the print statement.

Is there any way that $options{a} could be getting set to 0?  This would not
work because eq looks at 0 as a string, and since it's not equal to the
empty string the expression returns false.

Running with -w and "use strict" could also give you some clues.

-- Brad

> That doesn't seem to work.  I want if a variable doesn't equal anything,
> then do something.  Here's a piece:
> if ($options{a} eq "" && $options{a} eq "") {
> print "
> Usage: log.pl [-d] -a -i [n]\n
> -d   :  specify device.  If nothing, eth0 is used
> -a*  :  specify alias number
> -i*  :  specify ip number to assign to alias
> -n   :  specify netmask.  If nothing, 255.255.255.0 is used
> Options with a * are required!\n\n";
> exit;
> }
>
> - Original Message -
> From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
> To: "Perl Beginners" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 17, 2001 12:59 PM
> Subject: RE: if something equals nothing
>
>
> > Exactly like that, except using 'eq' instead of '=='.
> > A slightly easier way, though, would be to say
> >
> > if (!$something) { ... blah blah ... }
> >
> > Since $something will return false in a boolean context (if it is empty)
> >
> > -Original Message-
> > From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 17, 2001 12:56 PM
> > To: Perl Beginners
> > Subject: if something equals nothing
> >
> >
> > How do I do:
> > if ($something == "") {
> > # do something
> > }
> >
> > in perl?
> >
> > Thanks,
> > Tyler
> >
> >
> >
> > --
> > 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: Redirection of STDERR

2001-07-17 Thread Brian

If you need it restored within the sub itself, you can also throw
scoping brackets around it.  i.e. do what Paul suggested, only:

Sub func {
  # Some code here
  {
open STDERR, ">$file" or die $!;
# Code for the new STDERR here
  }
  # STDERR is back to normal here
  # More code
}

Remember, scoping brackets are you friend.  :o)

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> 
> --- Roland Schoenbaechler <[EMAIL PROTECTED]> wrote:
> > In a sub of my script I redirected STDERR in a file. How can I
> > redirect the STDERR back to the default (screen) for the following
> > subs?
> 
> Use local(). It's not something to make a big habit of, but this is a
> good place for it.
> 
>  sub func {
> local *STDERR;
> open STDERR, ">$file" or die $!;
> # code here
>  }  # STDERR gets "fixed" when the local() scope ends here
> 
> c.f. perldoc -f local
> 
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.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: How Do I Implement an Array or Linked List of Pointers in Perl?

2001-07-17 Thread Brett W. McCoy

On Tue, 17 Jul 2001, Chuck Morford wrote:

> And about Pascal's Record Type. Is there anything equivalent in Perl
> without getting into OOP?

Linked lists are really not necessary in Perl since you can do cool things
with lists that you can't do in Pascal or C.  However, I think for what
you are doing, you want to create an array or a hash of references, and
no, they do not get converted to strings.  A reference IS already a
scalar, and is the only way to create complex data structures in Perl:

my $adventure = {
  players => { ranger => 'Aragorn',
   thief => 'Bilbo',
   halforc => 'Shagrat'
  },

  realms => [ 'Mordor', 'Eriador', 'Beleriand' ]
};

So now you have a hash reference containing a hash reference keyed by
'players' and an array reference keyed by 'realms'.

$new_ranger = $adventure->{players}->{ranger};  #gives 'Aragorn'
$new_realm = $adventure->{realms}->[1]; #gives 'Eriador'

BTW, _Mastering Algorithms with Perl_ from O'Reilly has several chapters
devoted to complex data structures, including linked lists.  If you want
to translate your typical Pascalish CompSci stuff to Perl, this is a good
book to start with.

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

Parts that positively cannot be assembled in improper order will be.



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




Re: foreach examples/usage

2001-07-17 Thread Rachel Coleman

On Tue, 17 Jul 2001, Evan Panagiotopoulos wrote:

> I have an array of X elements and I want to go from the first element
> (is it zero?) to the last. I have a variable containing the number of
> elements in the array. If the array has 22 elements does it go from 0
> to 21 or 1 to 22?

foreach doesn't need to know the number of elements - it just goes from
the first element to the last

e.g.

#!/usr/bin/perl -w
my @array = (1,2,3,4,5,6,7,8,9);

# explicit scalar variable
foreach my $item ( @array ) {
print "$item";
}
# newline for tidiness
print "\n";

# do it again using the implicit $_ variable
foreach ( @array ) {
print;
}
# newline for tidiness
print "\n";

This script prints out:
123456789
123456789


Best wishes,

Rachel Coleman



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




Re: Problems with ^M

2001-07-17 Thread Rachel Coleman

On Mon, 16 Jul 2001, System Administrator wrote:

> This is for newbies, right? Can anyone tell me why a s/^M//g won't get
> rid of the annoying ^M on the end of each line of an imported Paradox
> database?

I know you've had one solution to this problem already but as TMTOWTDI ...

^M is the carriage return character, used in windows but not Unix.  It can
be represented in Perl by \r.

So: s/\r//g should also work.

Best wishes,

Rachel Coleman



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




Re: How Do I Implement an Array or Linked List of Pointers in Perl?

2001-07-17 Thread Paul


--- Chuck Morford <[EMAIL PROTECTED]> wrote:
> I think I read somewhere that when I store a Reference in an Array it
> gets converted to a String and can no longer be used as a
> Reference...Is that right?

opps -- I misread this in my initial answer.
Using a reference in a string context will convert it to a string, at
least in that context. Just putting it into an array is fine.

Sorry for putting my foot in my mouth on that!

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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




how does one redirect both STDERR and STDOUT to $file?

2001-07-17 Thread Matt Lyon

so how does one redirect both STDERR and STDOUT to $file, do some stuff, and
then get stderr and stdout back and playing nice?

I'm trying:

# if $LogLogfile="YES"
if ( $LogLogfile eq "YES" ) {
print "Logging stuff to log file...\n";
# redirect stderr --> stdout.
open(STDERRBACKUP, ">&STDERR");
open(STDERR, ">&STDOUT") or die "Problem redirecting STDERR.";
# redirect stdout to file
open(STDOUTBACKUP, ">&STDOUT");
open(STDOUT, ">$PathLog") or die "Problem redirecting STDOUT.";
# execute the boatload of stuff we have to...
print "\n";
print $CommandLineString ;
print "\n";
system ( $CommandLineString ) ;
print
"###
##\n";
SetThingsRight();
# get stdout back
close (STDOUT);
open (STDOUT, ">&STDOUTBACKUP");
# get stderr back from stdout.
close (STDERR);
open(STDERR, ">&STDERRBACKUP");
}

which is probably unnecessarily messy and plumb doesn't work. it's giving:

Logging stuff to log file...
Uncaught exception from user code:
Problem redirecting STDOUT. at ./hierarchicalcommandlinetester.pl
line 119.

---

From: Brian [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 11:31 AM
To: [EMAIL PROTECTED]
Subject: RE: Redirection of STDERR


If you need it restored within the sub itself, you can also throw
scoping brackets around it.  i.e. do what Paul suggested, only:

Sub func {
  # Some code here
  {
open STDERR, ">$file" or die $!;
# Code for the new STDERR here
  }
  # STDERR is back to normal here
  # More code
}

Remember, scoping brackets are you friend.  :o)

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

>
> --- Roland Schoenbaechler <[EMAIL PROTECTED]> wrote:
> > In a sub of my script I redirected STDERR in a file. How can I
> > redirect the STDERR back to the default (screen) for the following
> > subs?
>
> Use local(). It's not something to make a big habit of, but this is a
> good place for it.
>
>  sub func {
> local *STDERR;
> open STDERR, ">$file" or die $!;
> # code here
>  }  # STDERR gets "fixed" when the local() scope ends here
>
> c.f. perldoc -f local
>
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.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]



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




Re: if something equals nothing

2001-07-17 Thread Jos I. Boumans

Try this:

unless( $options{a} && $options{b} ) { do_stuff }

if both of those 2 keys have a value in the hash, the && will return true,
and the do_stuff won't get exuted
you can also use

if( !$foo && !$bar ) or some construct like that, but i find that less
legible...

also, if you want to have it say that if EITHER is true, the statement
should be skipped, use || instead of &&

hope this helps,

Jos Boumans

> > > That doesn't seem to work.  I want if a variable doesn't equal
anything,
> > > then do something.  Here's a piece:
> > > if ($options{a} eq "" && $options{a} eq "") {


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




Script won't exec

2001-07-17 Thread Customer Service

To the Plethora Of Perl Programmers (P.O.P.P), I seek your guidance.
First of all, can you tell me what is wrong with this script other than
neglecting to “use strict”.  (I’m learning)
From the command prompt, it says:

Syntax error near  $ENV{'REQUEST_METHOD')
…Aborted due to compilation errors

I’m trying to parse a form I made on my win98 box w/ apache and activestate
perl.
Also, when I try to run the script from my submit button on the HTML form, I
get:

“The page cannot be found”

I thought that maybe the problem was in the httpd.conf file in apache, but I
have since read the Apache docs on server configuration and feel that I have
the permissions and related declarations all straightened out.
So my question is:  Is the problem with my script or what?
Also, is there a better way to parse forms?  I’ve been told to use CGI.pm,
but I don’t know how to “invoke” it. Any good docs to read on it?
Thanks for your help,
Nathan
www.tandrtrailer.com 
[EMAIL PROTECTED] 




META REFRESHES

2001-07-17 Thread SAWMaster

Can someone tell me why this isn't working on IE?

It works within Opera, I don't know about netscape yet.

print qq~http://mypage.html";>\n~;




RE: Redirection of STDERR

2001-07-17 Thread Brian

> You forgot to localize. =o)
>   local *STDERR;

Thanks for pointing it out, I completely forgot.  :o)  'tis bad practice
to answer in haste I guess.  Hehe.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.


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




RE: how does one redirect both STDERR and STDOUT to $file?

2001-07-17 Thread Brian

Wow, that is kind of fun to try and pick apart.  But, try this (untested
of course):

if($LogLogfile eq "YES") {
  print "Logging stuff to log file...\n";
  { # Used for scoping STDOUT and STDERR redirection
open(STDOUT, ">$PathLog") or die "Canoot redirect STDOUT: $!";
open(STDERR, ">&STDOUT") or die "Cannot redirect STDERR: $!";
# Code using the new STDOUT and STDERR
  } # After this STDOUT and STDERR will be back to default
}

This will point STDOUT to the file, STDERR to STDOUT - which in turn
will point it to the file as well.  :o)

I don't think (I'm not sure though) that your "backup" of the STDOUT and
STDERR will work, because you are redirecting STDERRBACKUP to STDERR,
and then redirecting STDERR to the file.  So I would think STDERRBACKUP
would also point to the file, but like I said I'm not sure of this.
Perhaps one of the experts on the list will be able to shed some light
on this topic.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> so how does one redirect both STDERR and STDOUT to $file, do 
> some stuff, and
> then get stderr and stdout back and playing nice?
> 
> I'm trying:
> 
> # if $LogLogfile="YES"
> if ( $LogLogfile eq "YES" ) {
> print "Logging stuff to log file...\n";
> # redirect stderr --> stdout.
> open(STDERRBACKUP, ">&STDERR");
> open(STDERR, ">&STDOUT") or die "Problem redirecting STDERR.";
> # redirect stdout to file
> open(STDOUTBACKUP, ">&STDOUT");
> open(STDOUT, ">$PathLog") or die "Problem redirecting 
> STDOUT.";
> # execute the boatload of stuff we have to...
> print "\n";
> print $CommandLineString ;
> print "\n";
> system ( $CommandLineString ) ;
> print
> "#
> ##
> ##\n";
> SetThingsRight();
> # get stdout back
> close (STDOUT);
> open (STDOUT, ">&STDOUTBACKUP");
> # get stderr back from stdout.
> close (STDERR);
> open(STDERR, ">&STDERRBACKUP");
> }
> 
> which is probably unnecessarily messy and plumb doesn't work. 
> it's giving:
> 
> Logging stuff to log file...
> Uncaught exception from user code:
> Problem redirecting STDOUT. at 
> ./hierarchicalcommandlinetester.pl
> line 119.
> 
> ---
> 
> From: Brian [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 11:31 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Redirection of STDERR
> 
> 
> If you need it restored within the sub itself, you can also throw
> scoping brackets around it.  i.e. do what Paul suggested, only:
> 
> Sub func {
>   # Some code here
>   {
> open STDERR, ">$file" or die $!;
> # Code for the new STDERR here
>   }
>   # STDERR is back to normal here
>   # More code
> }
> 
> Remember, scoping brackets are you friend.  :o)
> 
> Brian Johnson
> Partner/Systems Administrator/Programmer
> Source1Hosting.tv, LLC (www.source1hosting.tv)
> Source1Results.com, LLC (www.source1results.com)
> I may be insane, but remember - The only
> difference between an insane man and a
> genius is his jacket.
> 
> >
> > --- Roland Schoenbaechler <[EMAIL PROTECTED]> wrote:
> > > In a sub of my script I redirected STDERR in a file. How can I
> > > redirect the STDERR back to the default (screen) for the following
> > > subs?
> >
> > Use local(). It's not something to make a big habit of, but 
> this is a
> > good place for it.
> >
> >  sub func {
> > local *STDERR;
> > open STDERR, ">$file" or die $!;
> > # code here
> >  }  # STDERR gets "fixed" when the local() scope ends here
> >
> > c.f. perldoc -f local
> >
> > __
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.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]
> 
> 
> 
> -- 
> 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: Script won't exec

2001-07-17 Thread Brian

Post some code, somebody will be able to pick up on something perhaps
you missed.  :o)  Can't help without code.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> 
> To the Plethora Of Perl Programmers (P.O.P.P), I seek your guidance.
> First of all, can you tell me what is wrong with this script 
> other than
> neglecting to "use strict".  (I'm learning)
> From the command prompt, it says:
> 
> Syntax error near  $ENV{'REQUEST_METHOD')
> .Aborted due to compilation errors
> 
> I'm trying to parse a form I made on my win98 box w/ apache 
> and activestate
> perl.
> Also, when I try to run the script from my submit button on 
> the HTML form, I
> get:
> 
> "The page cannot be found"
> 
> I thought that maybe the problem was in the httpd.conf file 
> in apache, but I
> have since read the Apache docs on server configuration and 
> feel that I have
> the permissions and related declarations all straightened out.
> So my question is:  Is the problem with my script or what?
> Also, is there a better way to parse forms?  I've been told 
> to use CGI.pm,
> but I don't know how to "invoke" it. Any good docs to read on it?
> Thanks for your help,
> Nathan
> www.tandrtrailer.com 
> [EMAIL PROTECTED] 
> 
> 
> 


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




redirect STDOUT to a socket

2001-07-17 Thread Heiko Kundlacz
Title: redirect STDOUT to a socket






Hoi,


how can I redirect STDOUT to a socket?


Thanks


Heiko




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


Repost: Script won't exec

2001-07-17 Thread Customer Service

Sorry, forgot the code ;)

To the Plethora Of Perl Programmers (P.O.P.P), I seek your guidance.
First of all, can you tell me what is wrong with this script other than
neglecting to “use strict”.  (I’m learning)
From the command prompt, it says:

Syntax error near  $ENV{'REQUEST_METHOD')
…Aborted due to compilation errors

Script follows:
#!c:/perl/bin/perl -w

if ($ENV{'REQUEST_METHOD') eq 'GET')
{
  @pairs = split (/&/,
$ENV{'QUERY_STRING'});
}  elsif ($ENV{'REQUEST_METHOD'} eq
  'POST') {
  read (STDIN, $buffer,
$ENV{'CONTENT_LENGTH'});
  @pairs = split(/&/, $buffer);
} else {
  print "Content-type: text/html\n\n";
  print header;
  print "Use Post or Get";
}

foreach $pair (@pairs) {
  ($key, $value) = split (/=/, $pair);
  $key =~ tr/+/ /;
  $key =~ s/%([a-fA-F0-9] [a-fA-F0-9])/
pack("C", hex($1))/eg;
  $value =~ tr/+/ /;
  $value =~s/%[a-fA-F0-9] [a-fA-F0-9])/
pack("C", hex($1))/eg;

  $value =~s///g;

  if ($formdata{$key}) {
$formdata{$key} .= ", $value";
  } else {
$formdata{$key} = $value;
  }
}

print "Content-type: text/html\n\n";
print header;
foreach $key (sort keys(%formdata)) {
  print "The field named$key contained $formdata{$key}";
}


I’m trying to parse a form I made on my win98 box w/ apache and activestate
perl.

Also, when I try to run the script from my submit button on the HTML form, I
get:

“The page cannot be found”

I thought that maybe the problem was in the httpd.conf file in apache, but I
have since read the Apache docs on server configuration and feel that I have
the permissions and related declarations all straightened out.
So my question is:  Is the problem with my script or what?
Also, is there a better way to parse forms?  I’ve been told to use CGI.pm,
but I don’t know how to “invoke” it. Any good docs to read on it?
Thanks for your help,
Nathan
www.tandrtrailer.com 
[EMAIL PROTECTED] 




Re: Repost: Script won't exec

2001-07-17 Thread Lynn Glessner


> 
> if ($ENV{'REQUEST_METHOD') eq 'GET')

The left brace for 'REQUEST_METHOD' is curly



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




Re: Repost: Script won't exec

2001-07-17 Thread Jeff Yoak


It looks like you have a ')' where you want a '}' there.

Cheers,
Jeff

At 03:17 PM 7/17/01 -0600, Customer Service wrote:

>Syntax error near  $ENV{'REQUEST_METHOD')
>…Aborted due to compilation errors
>
> Script follows:
>#!c:/perl/bin/perl -w
>
>if ($ENV{'REQUEST_METHOD') eq 'GET')
> {
>   @pairs = split (/&/,
> $ENV{'QUERY_STRING'});
>}  elsif ($ENV{'REQUEST_METHOD'} eq
>   'POST') {
>   read (STDIN, $buffer,
> $ENV{'CONTENT_LENGTH'});
>   @pairs = split(/&/, $buffer);
>} else {
>   print "Content-type: text/html\n\n";
>   print header;
>   print "Use Post or Get";
>}
>
>foreach $pair (@pairs) {
>   ($key, $value) = split (/=/, $pair);
>   $key =~ tr/+/ /;
>   $key =~ s/%([a-fA-F0-9] [a-fA-F0-9])/
> pack("C", hex($1))/eg;
>   $value =~ tr/+/ /;
>   $value =~s/%[a-fA-F0-9] [a-fA-F0-9])/
> pack("C", hex($1))/eg;
>
>   $value =~s///g;
>
>   if ($formdata{$key}) {
> $formdata{$key} .= ", $value";
>   } else {
> $formdata{$key} = $value;
>   }
>}
>
>print "Content-type: text/html\n\n";
>print header;
>foreach $key (sort keys(%formdata)) {
>   print "The field named$key contained $formdata{$key}";
>}
>
>
>I’m trying to parse a form I made on my win98 box w/ apache and activestate
>perl.
>
>Also, when I try to run the script from my submit button on the HTML form, I
>get:
>
>“The page cannot be found”
>
>I thought that maybe the problem was in the httpd.conf file in apache, but I
>have since read the Apache docs on server configuration and feel that I have
>the permissions and related declarations all straightened out.
>So my question is:  Is the problem with my script or what?
>Also, is there a better way to parse forms?  I’ve been told to use CGI.pm,
>but I don’t know how to “invoke” it. Any good docs to read on it?
>Thanks for your help,
>Nathan
>www.tandrtrailer.com 
>[EMAIL PROTECTED] 



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




cleaning up forwarded, inline email messages with Perl?

2001-07-17 Thread Humberto Varela

following some threads on regex matching on this list, i was able to write some 
one-liners in Perl that cleaned up forwarded messages that i typically see in list 
emails.

so, you turn something like:

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

into:

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

into:

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

but, rather than peck out simplistic pattern-matching code ala sed or awk, i was 
wondering if some Perl tools exist already that help re-format inline messages.

hell, even sharing a personal perl script that cleans up messages would be appreciated.

my next project (while squeezing in my normal work routine, of course : P ) is to 
filter inline forwarded messages so that they not only remove angle brackets, and 
left-indent, but also have only one blank line between "paragraphs".

my embarrasingly simple problem is how to tell a snippet of pattern-matching perl code 
what a "paragraph" is...

anyhow, i guess i'm asking 3 questions:

1) is there some good message filtering Perl code flying around out there?
2) how to define a "paragraph" in Perl script (so as to act on the stuff _after_ a 
paragraph is encountered).
3) where is a near-comprehensive listing of pattern-matching code for Perl scripts on 
the web?  for example, i would never have figured out the '^M' filter to be 'cM' as 
one poster suggested, or even '\r' as someone else suggested.


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




Re: Repost: Script won't exec

2001-07-17 Thread Paul Johnson

On Tue, Jul 17, 2001 at 03:17:54PM -0600, Customer Service wrote:
> #!c:/perl/bin/perl -w
> 
> if ($ENV{'REQUEST_METHOD') eq 'GET')

   }

[You are using a fixed width font, aren't you?  The first } should be )]

But yes, you should be using CGI.pm.  "perldoc CGI" should show you the
docs, you can probably find then on search.cpan.org or put CGI.pm in
your text editor as a last resort.

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

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




RE: cleaning up forwarded, inline email messages with Perl?

2001-07-17 Thread Gross, Stephan

Text::Autoformat was featured in the last issue of The Perl Journal (which
is unfortunately not on-line at the moment).

For a third-party (and free!) tool, try eCleaner at
http://members.tripod.com/schin26/index.htm.


___
Stephan Gross   Loral Skynet 908-470-2388 [EMAIL PROTECTED]
 



-Original Message-
From: Humberto Varela [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 5:24 PM
To: [EMAIL PROTECTED]
Subject: cleaning up forwarded, inline email messages with Perl?


following some threads on regex matching on this list, i was able to write
some one-liners in Perl that cleaned up forwarded messages that i typically
see in list emails.

so, you turn something like:

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

into:

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

into:

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

but, rather than peck out simplistic pattern-matching code ala sed or awk, i
was wondering if some Perl tools exist already that help re-format inline
messages.

hell, even sharing a personal perl script that cleans up messages would be
appreciated.

my next project (while squeezing in my normal work routine, of course : P )
is to filter inline forwarded messages so that they not only remove angle
brackets, and left-indent, but also have only one blank line between
"paragraphs".

my embarrasingly simple problem is how to tell a snippet of pattern-matching
perl code what a "paragraph" is...

anyhow, i guess i'm asking 3 questions:

1) is there some good message filtering Perl code flying around out there?
2) how to define a "paragraph" in Perl script (so as to act on the stuff
_after_ a paragraph is encountered).
3) where is a near-comprehensive listing of pattern-matching code for Perl
scripts on the web?  for example, i would never have figured out the '^M'
filter to be 'cM' as one poster suggested, or even '\r' as someone else
suggested.


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




Database on file

2001-07-17 Thread Jared Chenkin

I'm kinda rusty on my perl..had to work in java for a while =(
How do you take a multidimensional hash such as $hash{$key1}{$key2}{$key3} and write it
to a database file without too much of a headache?  

Live Large,

Jared Chenkin
<[EMAIL PROTECTED]>
(AIM: DevNull24)
Networked Systems Administrator
Bronx Science Computing

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




Re: Database on file

2001-07-17 Thread Michael Fowler

On Tue, Jul 17, 2001 at 06:43:14PM -0400, Jared Chenkin wrote:
> I'm kinda rusty on my perl..had to work in java for a while =(
> How do you take a multidimensional hash such as $hash{$key1}{$key2}{$key3} and write 
>it
> to a database file without too much of a headache?  

use MLDBM qw(DB_File Storable);
use Fcntl qw(O_RDWR O_CREAT);

tie(%hash, "MLDBM", "file.db", O_RDWR|O_CREAT) || die("tie: $!");

Unfortunately, you have to change how you assign to the hash, from:

$hash{$key1}{$key2}{$key3} = "foo";

to
my $tmp = $hash{$key1};
$$tmp{$key2}{$key3} = "foo";
$hash{$key1} = $tmp;

Accesses don't need to change, though.


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

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




Re: META REFRESHES

2001-07-17 Thread Abdulaziz Ghuloum

Hello,
Just a question, why are you using a meta if you can pass the header
directly?  The meta AFAIK is used so that the server adds the appropriate
lines to the header before sending the document.  



For example, adding the previous line to your html file will cause the
server to send "Content-type: text/html; charset=windows-1256" instead of
the usual "Content-type: text/html".  

If however you're using CGI, the server will not add any appropriate
headers since you're responsible for supplying all the headers from your
script.  So, adding that last line to a cgi script will be useless.

Same probably applies for your line.  Just add the "Refresh: 5" header to
your script instead of using the meta.

Hope this helps,,,

Aziz,,,

In article <[EMAIL PROTECTED]>, "Sawmaster"
<[EMAIL PROTECTED]> wrote:

> Can someone tell me why this isn't working on IE?
> 
> It works within Opera, I don't know about netscape yet.
> 
> print qq~http://mypage.html";>\n~;
> 
>

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




Re: Script won't exec

2001-07-17 Thread Abdulaziz Ghuloum

Hello,

> Syntax error near  $ENV{'REQUEST_METHOD') Aborted due to compilation
 {}

Why do you have a left brace and a right bracket?

Hope this helps,,,


Aziz,,,

In article
<[EMAIL PROTECTED]>, "Customer
Service" <[EMAIL PROTECTED]> wrote:

> To the Plethora Of Perl Programmers (P.O.P.P), I seek your guidance.
> First of all, can you tell me what is wrong with this script other than
> neglecting to “use strict”.  (I’m learning)
> From the command prompt, it says:
> 
> Syntax error near  $ENV{'REQUEST_METHOD') …Aborted due to compilation
> errors
> 
> I’m trying to parse a form I made on my win98 box w/ apache and
> activestate perl.
> Also, when I try to run the script from my submit button on the HTML
> form, I get:
> 
> “The page cannot be found”
> 
> I thought that maybe the problem was in the httpd.conf file in apache,
> but I have since read the Apache docs on server configuration and feel
> that I have the permissions and related declarations all straightened
> out. So my question is:  Is the problem with my script or what? Also, is
> there a better way to parse forms?  I’ve been told to use CGI.pm, but I
> don’t know how to “invoke” it. Any good docs to read on it? Thanks for
> your help,
> Nathan
> www.tandrtrailer.com 
> [EMAIL PROTECTED]
> 
> 
>

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




Lame question

2001-07-17 Thread Felipe Figueiredo

Hi all,

how do I test if a variable caught from ARGV (just for an example) is a 
number, or string?

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




RE: Lame question

2001-07-17 Thread Wagner-David

if ( $ARGV[0] =~ /^\d+$/ ) {# Simple number
# If minus sign, decimal
point, etc, then would need to add
# Following checks for
negative number and decimal point
# $ARGV[0] =~ /^-*\d+.*\d*$/

   }elsif ( $ARGV[0] gt ' ' ) { # if looking for something specific
would add here.

   }

Wags ;)
-Original Message-
From: Felipe Figueiredo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 17:09
To: [EMAIL PROTECTED]
Subject: Lame question


Hi all,

how do I test if a variable caught from ARGV (just for an example) is a 
number, or string?

-- 
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: Lame question

2001-07-17 Thread Michael Fowler

On Tue, Jul 17, 2001 at 09:08:57PM -0300, Felipe Figueiredo wrote:
> how do I test if a variable caught from ARGV (just for an example) is a 
> number, or string?

perldoc -q 'is a number' or
http://www.perldoc.com/perl5.6/pod/perlfaq4.html#How%20do%20I%20determine%20whether%20a%20scalar%20is%20a%20number%2fwhole%2finteger%2ffloat%3f


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

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




2 digit numeric

2001-07-17 Thread Arvind Baldeo

 Hi,

I need to output my result as two digit numeric.

eg 
$curr = 00;
$hour =4;
$new=$curr * $hour;
print $new;

In the above eg, my result is $new equals to 4. I need it to be displayed as
04.
Or how to convert the digit 4 to string 04?


Rgds
Arvind

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




Re: Activestate installation

2001-07-17 Thread Scott Buckley

> Hi,
>
> I attempted to install activestate perl in my WinME system. While
> installing, it asked me if I want to put the bin directory in the PATH. I
> answered yes. But at the end, I dont get 'perl -v' working at the c:\
> prompt. perl -v works ok if I change directory to c:\perl\bin. Sould I put
> the path directory manually to my autoexec.bat file? Is there anything
else
> that I will have to configure to get activestate perl running.

Is it just 'perl -v'  or any perl switch?
If its any perl switch/command, then yes, you should try adding the path
manually to your autoexec.bat.

I don't use WinME, so the information could be wrong, but I've heard that
Microsoft was trying to hide things like the command line and editable
command files (autoexec.bat, config.sys, etc.), in an attempt to make it
more rigid, or stable, or something like that. Maybe that could be the cause
of you woes?

Also, why are you trying to run something like Activestate Perl on an OS
like WinME? WinME hasn't been around for a long time, and I would not
consider it very stable for running an application like Activestate Perl
(Any Windows OS isn't all that stable, but I digress...). Maybe you should
consider running something like 2000? Or, even better, help break a monopoly
by using Unix.

Hope my dribble can be of some use.
-Cheers, Scott.



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




Re: 2 digit numeric

2001-07-17 Thread iansmith

On Wed, 18 Jul 2001, Arvind Baldeo wrote:
> I need to output my result as two digit numeric.

Try: printf "%02d", $new;

Look up printf and sprintf in the perlfunc manpage.

--
Ian


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




RE: Dreaded Internal Server Error

2001-07-17 Thread Brian

First off, I wouldn't make the file owned by nobody and have permissions
of 755.  Somebody could find a hole in your code, write over the script,
and have it execute something nasty and not good.

Second, try this:
use CGI::Carp 'fatalsToBrowser';

If that doesn't work for ya (which it doesn't for me every once in a
while) then try this:

BEGIN {
 open STDERR, ">&STDOUT";
 $oldfh = select STDOUT;
 $|=1;
 select STDERR;
 $|=1;
 select $oldfh;
 print "Content-type: text/html\n\n";
}

These 2 things basically do the same thing, they print the error message
to the screen so you can further diagnose your problem.  :o)

If this doesn't work, try posting some code so we can see it.  Maybe one
of the many gurus will see something that you are missing.

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> 
> Hi,
> 
> I'm trying to get a cgi program working (I didn't write it) and I'm
> experiencing some mysterious problems.  First of I'll, I 
> should tell you
> that the error I get is the dreaded "Internal Server Error" 
> message.  I've
> also looked in the logs, and they're further explicated as follows:
> 
> [Tue Jul 17 00:42:16 2001] [error] (2)No such file or 
> directory: exec of
> /var/www/html/ebay/cgi-bin/spawn_server.cgi failed
> [Tue Jul 17 00:42:16 2001] [error] [client 64.231.11.99] 
> Premature end of
> script headers: /var/www/html/ebay/cgi-bin/spawn_server.cgi
> 
> Now for some details:
> 
> 1) I'm using Apache 1.3.20
> 
> 2) I'm using ScriptAlias to specify the cgi-bin directory
> 
> 3) I can execute a simple 'hello world' program in the same cgi-bin
> directory both from the shell, and through CGI.  The 
> permissions for all the
> files are 755.  The owner of the file is 'nobody', and the 
> group is 'root'.
> 
> 4) I've tried debugging the script by adding a print 
> statement, and I found
> that the program would execute from the shell, but not 
> through CGI.  The
> program expects a ton of parameters to be passed to it from 
> the browser, and
> when I'm executing it from the shell, the only sign that it 
> is working is
> the output from my print statement.
> 
> It almost seems as if CGI is actually intermittent.  I ran 
> the script as
> follows:
> 
> perl -cw spawn_server.cgi and the output of that indicated 
> that the code was
> ok.
> 
> I know that this error is very general, but any help pointing me in a
> direction for debugging it would be most appreciated.
> 
> Rob Yale
> 
> 
> -- 
> 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]




Splitting string using split()

2001-07-17 Thread Mike Miller


Gurus:

I have a string like this:

$s = '[EMAIL PROTECTED], "Blow, Joe" <[EMAIL PROTECTED]>,Joe Blow <[EMAIL PROTECTED]>'

And I want to be able to split it up.  Using split, like this:

my @addresses = split(/, ?/, $s);

But obviously this causes a problem because of the comma inside the
quotes.  I want three parts, and it splits it into four.  Is there
some module or nice way to have the commas inside quotes ignored?

Reply to [EMAIL PROTECTED] if possible as I'm only getting
the daily digest of this list.

Thanks,

-Mike

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




Truth and SQL

2001-07-17 Thread Daniel Falkenberg

Hi list,

Basically I want to be able to do an SQL query and if the query returns no
results I want my script to say Ok your query rerurned 0 results print this
message... "Sorry your seach returned no messages".

What is my best way of going about this? Would it work similar to this...

Do search 

if (!$sql_search) {
print "Sorry your result returned no matches"';
else {
print "here are the results";
 $sql_search;
}
}

Any suggestions will help imensly,

Regards,

df


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




RE: Splitting string using split()

2001-07-17 Thread Brian

This seems like more of a job for regexp than for split.  Is there any
reason not to use regexp in your particular case?

Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.

> 
> Gurus:
> 
> I have a string like this:
> 
> $s = '[EMAIL PROTECTED], "Blow, Joe" <[EMAIL PROTECTED]>,Joe Blow 
> <[EMAIL PROTECTED]>'
> 
> And I want to be able to split it up.  Using split, like this:
> 
> my @addresses = split(/, ?/, $s);
> 
> But obviously this causes a problem because of the comma inside the
> quotes.  I want three parts, and it splits it into four.  Is there
> some module or nice way to have the commas inside quotes ignored?
> 
> Reply to [EMAIL PROTECTED] if possible as I'm only getting
> the daily digest of this list.
> 
> Thanks,
> 
> -Mike
> 
> -- 
> 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   >