Re: Running Modules

2002-06-25 Thread David vd Geer Inhuur tbv IPlib


Hi,

Don't forget to close the FH :

close(DEMO_LOG);


Regs David
-

 
 Greetings All,
  
 I have the following code, from which I attempt to call the module
 “Test”
 #!/usr/local/bin/perl
 ###
 ### Program name:  demo.pl
 ### Created By:Theresa Mullin
  
 require cgi.lib;
  
 ### Include the CGI stuff
 use CGI qw(:standard);
  
 ### Include the database access stuff
 use DBI;
  
 ### Push location of user created packages onto @INC array
 push(@INC,/home/tmullin/perl/libs);  
  
 use Test;
  
 ### Force no buffering for output
 $| = 1;
  
  
 ### Parse the arguments sent in from the browser
 ReadParse();
  
 ### Open log file
 open DEMO_LOG, /home/tmullin/demo_log||die unable to open log file;
  
 print DEMO_LOG Begin processing...\n;
 print DEMO_LOG array INC:  @INC\n;
 print DEMO_LOG Database selected is:  $dbase\n;
  
  
  
 …Here is module Test:
  
 #!/usr/bin/perl
  
 ###  Program Name:  Test.pm
 ###  Created By:Theresa Mullin
 ###  Date:  5/20/02
  
 package Test;
  
 $dbase = TEST;
 print And to all a good night \n;  
  
 The code appears to execute, and no error messages are generated.
 However, the value of $dbase is never written to the log file.
 Any advice you can give would be helpful.
 Thanks,
 T.
  
  
 Theresa M. Mullin
 Programmer/Analyst
 Administrative Computing
 Northern Essex Community College
 100 Elliott Way
 Haverhill, MA  01830
 (978) 556-3757
 [EMAIL PROTECTED]
  
 
 --=_NextPart_000_0003_01C21B8B.A3BFB810--
 
 

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




Displaying Problems

2002-06-25 Thread Kyle Babich

For the following the syntax is correct but when I try to open it 
nothing displays, what should I change?

#!/usr/bin/perl -wT
use strict;
use CGI::Pretty qw/ :standard /;
$CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX = 512 * 1024;

print header ( text/html );

my $date = localtime;

my $c = param('c');
my $content = c;

if ($c eq h) {
   $content = qq{\n};
} elsif ($c eq eh) {
   $content = qq{\n};
} elsif ($c eq hd) {
   $content = qq{\n};
} elsif ($c eq p) {
   $content = qq{\n};
} elsif ($c eq c) {
   $content = qq{\n};
} elsif ($c eq su) {
   $content = qq{\n};
}

my @nav = (Home,E-Mail Hosting,Help 
Desk,Policies,Contact,Signup);

my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi?
c=p,
   index.cgi?c=c,index.cgi?c=su);

print start_html(
  -title = IMAP.cc E-Mail Hosting,
   -head  = Link( 
   { 
   -rel = stylesheet,
   -type = text/css,
   -href = style.css
   }
   ),
   ),
   body( -bgcolor = \#FF ),
   table({
   -width = 95\%,
   -cellspacing = 0,
   -cellpadding = 0,
   -border = 1,
   -bordercolor = \#00},
   tbody(
Tr(
td( {-width = 100\%},
   table({
-width = 100\%,
-cellspacing = 0,
-cellpadding = 1,
-border = 1,
-bordercolor = \#00
-align = center},
   tbody(
Tr(
td( {-width = 100\%,
-bgcolor = \#00,
-align = center},
   Font({
-face = Verdana, Arial, Times New Roman,
-size = 4,
-color = \#FF},
IMAP.cc
)
),),),),),),),),
end_html
-- 


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




Re: passing variables in POST

2002-06-25 Thread Marty Landman

At 06:06 AM 6/25/02 -0500, David T-G wrote:

If the variables are in the page to be in the form to be
sent back via POST, then the user can find them, period.

Try it yourself: set up something via POST and then surf to the page
and then view source or the equivalent in your browser (and if there
isn't an equivalent then find a browser, even if just for a moment,
that DOES have it) and look and see your data hanging right out there
for all to see.

David,

Sorry but I don't get what you mean here. When I have a page call a program 
with info from a form being posted then the program picks up the data and 
then creates whatever output web page is appropriate. The posted data comes 
in via STDIN so unlike a GET where the data is actually part of the URL, in 
a POST it isn't viewable from the browser.

If I'm all wrong about this please give a specific example... and sorry if 
I'm being thick. Also I'm not claiming that POST is safe as is, that's what 
SSL is for to encrypt the data between the server and client and vice 
versa. Only I don't get the exposure you're talking about. Didn't realize 
that STDIN was part of the browser's viewable source code.

Marty

--
SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml


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




Re: passing variables in POST

2002-06-25 Thread David T-G

Marty --

...and then Marty Landman said...
% 
% At 06:06 AM 6/25/02 -0500, David T-G wrote:
% 
% If the variables are in the page to be in the form to be
% sent back via POST, then the user can find them, period.
% 
% Try it yourself: set up something via POST and then surf to the page
% and then view source or the equivalent in your browser (and if there
% isn't an equivalent then find a browser, even if just for a moment,
% that DOES have it) and look and see your data hanging right out there
% for all to see.
% 
% David,
% 
% Sorry but I don't get what you mean here. When I have a page call a program 
% with info from a form being posted then the program picks up the data and 
% then creates whatever output web page is appropriate. The posted data comes 

Right.  That makes sense.  So you have something like

  page1   scriptpage2
  form   --  think...  -  some
var1process...output

right?


% in via STDIN so unlike a GET where the data is actually part of the URL, in 
% a POST it isn't viewable from the browser.

When you have page1 loaded and you're about to press the submit button
to send it, and your secret var1, off to the script, don't; instead,
view the page source and you will see the form structure and the hidden
(note that hidden simply means don't bother to try to display on the
page, not secretly encrypted or made to disappear so that nobody can
find it) variable right there.


% 
% If I'm all wrong about this please give a specific example... and sorry if 
% I'm being thick. Also I'm not claiming that POST is safe as is, that's what 

I trust that the example above will either illustrate the problem *or*
clarify any confusion; it's certainly possible that I'm misunderstanding
the process you propose.

Your turn to tell me if *I* am being thick :-)


% SSL is for to encrypt the data between the server and client and vice 
% versa. Only I don't get the exposure you're talking about. Didn't realize 
% that STDIN was part of the browser's viewable source code.

Well, the browser has to know what to send back to your script as STDIN,
no?  And if it knows what to send, then it must have that on the page
somewhere, no?  And if it's on the page somewhere then the user can see
it, no?


% 
% Marty
% 
% --
% SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml


HTH  HAND

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




msg05535/pgp0.pgp
Description: PGP signature


Re: passing variables in POST

2002-06-25 Thread Marty Landman

At 06:50 AM 6/25/02 -0500, David T-G wrote:

When you have page1 loaded and you're about to press the submit button
to send it, and your secret var1, off to the script, don't; instead,
view the page source and you will see the form structure and the hidden
(note that hidden simply means don't bother to try to display on the
page, not secretly encrypted or made to disappear so that nobody can
find it) variable right there.

Oops, sorry I didn't follow this thread from the beginning David or I 
would've understood your point; which is that hidden form fields aren't... 
and are certainly no place to put data that shouldn't be available over the 
web for site visitors to see.

Right?

Well, the browser has to know what to send back to your script as STDIN,
no?  And if it knows what to send, then it must have that on the page
somewhere, no?  And if it's on the page somewhere then the user can see
it, no?

Absolutely... so can a program for using LWP for example. I could even find 
it using the GRABURL Windows app from a  batch exec, then parse out the 
hidden form fields on my PC using Java or C++.

The proper way to handle this kind of requirement imo is to use a hidden 
form field with a key, and then have the server side pgm validate the 
HTTP_REFERER. So the key itself is of no value unless the authenticated 
referer coupled with the key tells the server pgm to access the secured 
info using that key.

But you already knew that. :)

Marty

--
SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml


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




Re: passing variables in POST

2002-06-25 Thread David T-G

Marty --

...and then Marty Landman said...
% 
% At 06:50 AM 6/25/02 -0500, David T-G wrote:
% 
...
% view the page source and you will see the form structure and the hidden
% (note that hidden simply means don't bother to try to display on the
% page, not secretly encrypted or made to disappear so that nobody can
% find it) variable right there.
% 
% Oops, sorry I didn't follow this thread from the beginning David or I 

I wondered about that...


% would've understood your point; which is that hidden form fields aren't 
% and are certainly no place to put data that shouldn't be available over the 
% web for site visitors to see.

Yep.


% 
% Right?

Absolutely.


% 
% Well, the browser has to know what to send back to your script as STDIN,
% no?  And if it knows what to send, then it must have that on the page
% somewhere, no?  And if it's on the page somewhere then the user can see
% it, no?
% 
% Absolutely... so can a program for using LWP for example. I could even find 
% it using the GRABURL Windows app from a  batch exec, then parse out the 
% hidden form fields on my PC using Java or C++.

Of course.  I just wanted to show the easy example, particularly since
it's my understanding that the goal is to keep the user much less some
intelligent hacker, from seeing this data -- and the user pretty much
only has 'view source' at his disposal, but that's more than enough in
this case.


% 
% The proper way to handle this kind of requirement imo is to use a hidden 
% form field with a key, and then have the server side pgm validate the 
% HTTP_REFERER. So the key itself is of no value unless the authenticated 
% referer coupled with the key tells the server pgm to access the secured 
% info using that key.

Sounds good to me.  I actually don't have enough info or experience to
design even a moderately secure system; that's why I'm following this
thread.  [My particular target application is a cookie-less clean-URL
SSL script framework; I want something robust and secure so that I can
run various applications, like a calendar or an anonymizer-style wrapper
or whatever, through this script *and* be different in two different
windows (maybe I want to talk to two hotmail accounts at once on the same
PC, for instance) and I don't want to have to turn on cookies (though
this script should handle them, if things were REALLY written elegantly)
on the PC, where I leave them and javascript off.]

As with most security and cryptography, though, some holes are easy to
spot and almost as easy to explain, so I jumped in the fray to clarify.


% 
% But you already knew that. :)

Well, yeah, but sometimes it takes a while for folks to believe it ;-)


% 
% Marty
% 
% --
% SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml


HAND

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




msg05537/pgp0.pgp
Description: PGP signature


Re: passing variables in POST

2002-06-25 Thread John Brooking

Marty,

  David's explaining it pretty well, but let me take
another crack at it. I was in your position about a
year ago and got royally (and publically) flamed on
the perl beginners list by a security admin for
deigning to give CGI advice without knowing this, so I
got what you might call a crash course!

  As David says, the place that you can see the
hidden variables is in the page where the form is,
before you submit it. It is true that once you submit
it, you don't see them go, and once you arrive at the
target script, they are not available. But they can be
discovered by looking at the page source before
submission.

  So what? The user can't change the page source,
right? Well, wrong. Anyone could save a copy of the
page to their own file system, modify the hidden
values there, and submit that modified page to your
server! Your server script may or may not be checking
the referer [sic] environment variable to ensure
that only submissions originating from your site are
valid. If it's not, this bogus and potentially
malevolent request would get right through!

  But wait, there's more! Even if your script *did*
check the referer, that's no protection either! An
experienced programmer can easily use Perl's LWP
module or its equivalent in some other language to
make the request with a faked referer variable. So
really, POST variables are no more secure than GET
variables, it just takes a little more doing to fake
them.

  Does this matter in your situation? If it's a
session id, it seems to me that either it's the
correct session id that you gave them, or it's
something else they made up, in which case it's
probably invalid and so your script will just ignore
it or throw an error. (It's theoretically possible I
suppose that they might guess a number that's someone
else's current session id, but that seems extremely
unlikely.) And if you're passing it to log them off,
even if they attempt to use it again, they'll be
logged off by then, so it won't work anymore anyway.
(But then, why does it even matter if it's hidden or
not?)

  So in the end, it's your decision. But it's
important that you understand it all so that you can
make an informed decision.

   By the way, I'm still not a security expert, so
don't take my word as the final one either!

- John

--- Marty Landman [EMAIL PROTECTED] wrote:
 At 06:06 AM 6/25/02 -0500, David T-G wrote:
 
 If the variables are in the page to be in the form
 to be
 sent back via POST, then the user can find them,
 period.
 
 Try it yourself: set up something via POST and then
 surf to the page
 and then view source or the equivalent in your
 browser (and if there
 isn't an equivalent then find a browser, even if
 just for a moment,
 that DOES have it) and look and see your data
 hanging right out there
 for all to see.
 
 David,
 
 Sorry but I don't get what you mean here. When I
 have a page call a program 
 with info from a form being posted then the program
 picks up the data and 
 then creates whatever output web page is
 appropriate. The posted data comes 
 in via STDIN so unlike a GET where the data is
 actually part of the URL, in 
 a POST it isn't viewable from the browser.


=
Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com

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

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




RE: Displaying Problems

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: Kyle Babich [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 24, 2002 4:09 PM
 To: [EMAIL PROTECTED]
 Subject: Displaying Problems
 
 
 For the following the syntax is correct but when I try to open it 
 nothing displays, what should I change?

There are some errors. The following patch shows what I had
to change to make it run:

3c3
 use CGI::Pretty qw/ :standard /;
---
 use CGI::Pretty qw/ :standard tbody /;
60c60
   -bordercolor = \#00
---
   -bordercolor = \#00,
67c67
Font({
---
font({

 
 #!/usr/bin/perl -wT
 use strict;
 use CGI::Pretty qw/ :standard /;
 $CGI::DISABLE_UPLOADS = 1;
 $CGI::POST_MAX = 512 * 1024;
 
 print header ( text/html );
 
 my $date = localtime;
 
 my $c = param('c');
 my $content = c;
 
 if ($c eq h) {
$content = qq{\n};
 } elsif ($c eq eh) {
$content = qq{\n};
 } elsif ($c eq hd) {
$content = qq{\n};
 } elsif ($c eq p) {
$content = qq{\n};
 } elsif ($c eq c) {
$content = qq{\n};
 } elsif ($c eq su) {
$content = qq{\n};
 }
 
 my @nav = (Home,E-Mail Hosting,Help 
 Desk,Policies,Contact,Signup);
 
 my @loc = 
 (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi?
 c=p,
index.cgi?c=c,index.cgi?c=su);
 
 print start_html(
   -title = IMAP.cc E-Mail Hosting,
-head  = Link( 
{ 
-rel = stylesheet,
-type = text/css,
-href = style.css
}
),
),
body( -bgcolor = \#FF ),
table({
-width = 95\%,
-cellspacing = 0,
-cellpadding = 0,
-border = 1,
-bordercolor = \#00},
tbody(
   Tr(
   td( {-width = 100\%},
table({
   -width = 100\%,
   -cellspacing = 0,
   -cellpadding = 1,
   -border = 1,
   -bordercolor = \#00
   -align = center},
tbody(
   Tr(
   td( {-width = 100\%,
   -bgcolor = \#00,
   -align = center},
Font({
   -face = Verdana, Arial, Times New Roman,
   -size = 4,
   -color = \#FF},
   IMAP.cc
   )
   ),),),),),),),),
 end_html

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




Re: AW: param problem

2002-06-25 Thread Felix Geerinckx

on Tue, 25 Jun 2002 13:10:05 GMT, [EMAIL PROTECTED]
(Theuerkorn Johannes) wrote: 

 Thanks, but this doesn´t work either, the problem with the #43 is
 that the cgi:param method takes everything after the  sign as the
 next variable. As the syntax for the param method is:
 http://server/script.pl?variable1=valuevariable2=value...etc 

It's not '#43' but '%2B':

#! perl -w
use strict;

use URI::Escape;
print uri_escape(+);  # prints %2B

-- 
felix

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




Re: Barcode with Perl

2002-06-25 Thread Geraint Jones

On Tuesday 25 June 2002 1:58 pm, Fred Sahakian wrote:
 Anyone know of a program that can create barcodes on the screen from
 entered numbers?

 thanks!
Found this on CPAN:
http://www.perl.com/CPAN-local/modules/by-module/Barcode/

-- 
Geraint Jones

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




Re: Displaying Problems

2002-06-25 Thread perl-dvd

Kyle,
Well, I'd start by printing an actual content type instead of depending on CGI.pm 
for that:
---
print content-type: text/html\n\n;
---
Second, I would condense your if to this
---
my $c = param('c');
my $content = $c;
$content = \n if ($c eq h or $c eq eh or $c eq hd or $c eq p or $c eq c or 
$c eq su);
---
Then I would HIGHLY recommend that you not depend on CGI.pm so heavily.  I would 
suggest you
print out your own html, then you can see exactly what it is displaying and know what 
to change.  If
you wanted to print it all in one clump, you could do it like this.
---
# the qq^ makes it use ^ as the quote.  Just make sure if you us a ^ inside that you 
escape it (like
this \^ )
print qq^
html
head
title$thetitle/title
/head
body bgcolor=#FF
!-- the rest of your html goes in here --
/body
/html
^;
---

Trust me on this one, it will save you so much headache if you will just print your 
own html.

Regards,
David


- Original Message -
From: Kyle Babich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 2:09 PM
Subject: Displaying Problems


For the following the syntax is correct but when I try to open it
nothing displays, what should I change?

#!/usr/bin/perl -wT
use strict;
use CGI::Pretty qw/ :standard /;
$CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX = 512 * 1024;

print header ( text/html );

my $date = localtime;

my $c = param('c');
my $content = c;

if ($c eq h) {
   $content = qq{\n};
} elsif ($c eq eh) {
   $content = qq{\n};
} elsif ($c eq hd) {
   $content = qq{\n};
} elsif ($c eq p) {
   $content = qq{\n};
} elsif ($c eq c) {
   $content = qq{\n};
} elsif ($c eq su) {
   $content = qq{\n};
}

my @nav = (Home,E-Mail Hosting,Help
Desk,Policies,Contact,Signup);

my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi?
c=p,
   index.cgi?c=c,index.cgi?c=su);

print start_html(
  -title = IMAP.cc E-Mail Hosting,
   -head  = Link(
   {
   -rel = stylesheet,
   -type = text/css,
   -href = style.css
   }
   ),
   ),
   body( -bgcolor = \#FF ),
   table({
   -width = 95\%,
   -cellspacing = 0,
   -cellpadding = 0,
   -border = 1,
   -bordercolor = \#00},
   tbody(
Tr(
td( {-width = 100\%},
   table({
-width = 100\%,
-cellspacing = 0,
-cellpadding = 1,
-border = 1,
-bordercolor = \#00
-align = center},
   tbody(
Tr(
td( {-width = 100\%,
-bgcolor = \#00,
-align = center},
   Font({
-face = Verdana, Arial, Times New Roman,
-size = 4,
-color = \#FF},
IMAP.cc
)
),),),),),),),),
end_html
--


--
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: Displaying Problems

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 10:26 AM
 To: Kyle Babich; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems
 
 
 Kyle,
 Well, I'd start by printing an actual content type 
 instead of depending on CGI.pm for that:
 ---
 print content-type: text/html\n\n;

Except that that's not RFC2616-compliant, while CGI.pm's output is.

Most browsers will accept this, but you still shouldn't generate it.

 ...
 Then I would HIGHLY recommend that you not depend on 
 CGI.pm so heavily.  I would suggest you
 print out your own html, then you can see exactly what it is 
 displaying and know what to change.

I fail to see how writing code with errors is somehow
CGI.pm's fault.

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




Re: Displaying Problems

2002-06-25 Thread perl-dvd

Bob,

 I fail to see how writing code with errors is somehow CGI.pm's fault
No its not.  But I'll tell you one thing, people who depend so heavily on CGI.pm 
generally have a
good understanding of how to use CGI.pm, but have less understanding of what is really 
going on.  Me
personally, I want to know what's really happening.  And once I get to that point, not 
only can I
become more efficient, but I can make better decisions for my own application.  You 
see, just like
sterio-typing can frequently be incorrect (because it uses blanket statements), CGI.pm 
is not the
most efficient and for that matter appropriate for many situations.

 Except that that's not RFC2616-compliant, while CGI.pm's output is
So what exactly is the RFC2616 compliant content type?

You know its funny, but it seems that so many who stick up for CGI.pm so strongly are 
quick to say
that CGI.pm is doing things right and that it does them better, but they seem to 
purposely avoid
giving the actual solution.

It seems to me that our way of life (freedom and prosperity) came about from people 
thinking for
them selves and from innovation, learning and continued drive to improve what was 
given us.
I do a little system admin on the side, and I've come to find that learning the actual 
conf files is
such a boon over simply using the GUI app.  So much understanding has come and it 
takes me to a more
advanced level.  Many times I can discover a problem, or have understanding of the 
underlying
problem when coming across things I don't expect.  In my mind programming is the same. 
 I want to
know what's going on, so I can make a wise and educated decision of how to approach it.

David


- Original Message -
From: Bob Showalter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, June 25, 2002 8:39 AM
Subject: RE: Displaying Problems


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 10:26 AM
 To: Kyle Babich; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems


 Kyle,
 Well, I'd start by printing an actual content type
 instead of depending on CGI.pm for that:
 ---
 print content-type: text/html\n\n;

Except that that's not RFC2616-compliant, while CGI.pm's output is.

Most browsers will accept this, but you still shouldn't generate it.

 ...
 Then I would HIGHLY recommend that you not depend on
 CGI.pm so heavily.  I would suggest you
 print out your own html, then you can see exactly what it is
 displaying and know what to change.

I fail to see how writing code with errors is somehow
CGI.pm's fault.



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




RE: Displaying Problems

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 11:12 AM
 To: Bob Showalter; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems
 
 
 Bob,
 
 ...
 So what exactly is the RFC2616 compliant content type?

cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2

 
 You know its funny, but it seems that so many who stick up 
 for CGI.pm so strongly are quick to say
 that CGI.pm is doing things right and that it does them 
 better, but they seem to purposely avoid
 giving the actual solution.

See above.

 
 It seems to me that our way of life (freedom and prosperity) 
 came about from people thinking for
 them selves and from innovation, learning and continued drive 
 to improve what was given us.
 I do a little system admin on the side, and I've come to find 
 that learning the actual conf files is
 such a boon over simply using the GUI app.  So much 
 understanding has come and it takes me to a more
 advanced level.  Many times I can discover a problem, or have 
 understanding of the underlying
 problem when coming across things I don't expect.  In my mind 
 programming is the same.  I want to
 know what's going on, so I can make a wise and educated 
 decision of how to approach it.

CGI.pm--a threat to our way of life! Down with the troglodytes! :)

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




Re: Fwd: passing variables in POST

2002-06-25 Thread Ovid

--- [EMAIL PROTECTED] wrote:
 what about a sesion id based on their IP? or soem relevent info like that?

Here's how I create session IDs:

  my $md5= new Digest::MD5;
  my $remote = $ENV{ REMOTE_ADDR } . $ENV{ REMOTE_PORT } . $self-{ _rand };
  my $id = $md5-md5_base64( time, $$, $remote );
  $id=~ tr|+/=|-_.|; # Make non-word characters URL-friendly
 
The Make ... URL-friendly part is in case I need to embed the session ID in a URL.  

As for the _rand on the end, that's a random number that I tack onto the end to 
ensure unique
ids are generated.

 may be a stupid way to do it.. but i track the count of how many users are 
 currently at my site by their IP/timestamp that is saved for 5 min. if 
 someone accesses the web site 5+ min after a timestamp those IP's are deleted 
 and the list is updated to only include IP hits within the last 5 min. so in 
 short it keeps a somewhat crappy count of how many are currently viewing 
 the site...

Actually, you don't want to track their IP.  Many people will connect with a different 
IP every
time, if they are on AOL or are have some corporate proxy server that assigns new IPs. 
 I just use
the IP for an initial seed.  If you recompute with the assumption that the IP is 
static, many
people will be kicked off.
 
As for how to enforce the 5 minute limit, I save a timestamp in a database and compare 
everything
to that.  Remember, when dealing with security, you can't trust *anything* outside of 
your box.

Cheers,
Curtis Ovid Poe

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

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

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




Re: passing variables in POST

2002-06-25 Thread Ovid


--- John Brooking [EMAIL PROTECTED] wrote:
 So
 really, POST variables are no more secure than GET
 variables, it just takes a little more doing to fake
 them.

Side note (without really reading the rest of the thread :)

The reason that many people think POST is more secure than GET is because POST data 
does not show
up on the Web server's access logs.  Thus, if someone is submitting password 
information via GET,
even over SSL, anyone with access to the access logs can see the password.  Here's how 
this might
look on Apache:

127.0.0.1 - - [31/Oct/2001:08:52:14 -0800] GET 
/cgi-bin/test.cgi?name=Ovidpassword=youwish
HTTP/1.1 200 633

Here's a typical post request, one which *did* have data sent:

127.0.0.1 - - [20/Nov/2001:17:07:43 -0800] POST /cgi-bin/test.cgi HTTP/1.1 200 462

Since POST data is read from STDIN, it's typically not ever stored on disk unless the 
programmer
handles that.

Cheers,
Curtis Ovid Poe

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

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

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




Re: Displaying Problems

2002-06-25 Thread perl-dvd

Bob,

 CGI.pm--a threat to our way of life! Down with the troglodytes! :)
Well, not exactly my point, but ok :)   Just kidding
I just think there are too many who close their minds to anything but CGI.pm, 
including potentially
more efficient customized solutions.

David


- Original Message -
From: Bob Showalter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, June 25, 2002 9:33 AM
Subject: RE: Displaying Problems


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 11:12 AM
 To: Bob Showalter; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems


 Bob,

 ...
 So what exactly is the RFC2616 compliant content type?

cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2


 You know its funny, but it seems that so many who stick up
 for CGI.pm so strongly are quick to say
 that CGI.pm is doing things right and that it does them
 better, but they seem to purposely avoid
 giving the actual solution.

See above.


 It seems to me that our way of life (freedom and prosperity)
 came about from people thinking for
 them selves and from innovation, learning and continued drive
 to improve what was given us.
 I do a little system admin on the side, and I've come to find
 that learning the actual conf files is
 such a boon over simply using the GUI app.  So much
 understanding has come and it takes me to a more
 advanced level.  Many times I can discover a problem, or have
 understanding of the underlying
 problem when coming across things I don't expect.  In my mind
 programming is the same.  I want to
 know what's going on, so I can make a wise and educated
 decision of how to approach it.

CGI.pm--a threat to our way of life! Down with the troglodytes! :)



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




Re: passing variables in POST

2002-06-25 Thread John Brooking

--- Marty Landman [EMAIL PROTECTED] wrote:
  ...
 check the referer, that's no protection either! An
 experienced programmer can easily use Perl's LWP
 module or its equivalent in some other language to
 make the request with a faked referer variable. So
 really, POST variables are no more secure than GET
 variables, it just takes a little more doing to
 fake
 them.
 
 Didn't realize this. What exactly is the right
 procedure then to safeguard 
 scripts such as formmailers from being hijacked?

--- Marty Landman [EMAIL PROTECTED] wrote:
 Didn't realize this. What exactly is the right
 procedure then to safeguard 
 scripts such as formmailers from being hijacked?

Not sure if there is a way. We had a big discussion a
few weeks back about a certain classic form mailer
script  (and let's not resurrect it please!), and from
what I could tell, one of the improvements made by the
recommended replacement was that it put a limit on the
number of simultaneous target addresses, to prevent
spamming. This makes me think there's really no way to
enforce who is calling you. But I don't know that for
sure.

Ovid's point a few messages ago that you shouldn't
trust anything outside your own box also seems
relevant.

Anyone with more security experience want to take a
crack at this? (Where's that guy who flamed me last
year when I need him?  :-)

- John


=
Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com

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

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




Re: Displaying Problems

2002-06-25 Thread kb

Well, I still can't get my page to display.

Quoting [EMAIL PROTECTED]:

 Ok, so here's the deal:
 
 Some HTTP/1.0 software has interpreted a Content-Type header without charset
 parameter incorrectly
 to mean recipient should guess. Senders wishing to defeat this behavior MAY
 include a charset
 parameter even when the charset is ISO-8859-1 and SHOULD do so when it is
 known that it will not
 confuse the recipient.
 
 By the way, I did not upper case the MAY and SHOULD, those were that way in
 the doc which means they
 were trying to emphasize them.  I'd have to say that MAY doesn't suggest that
 it is a requirement
 for the content-type to work properly.
 
 David
 
 
 
 - Original Message -
 From: Bob Showalter [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, June 25, 2002 9:33 AM
 Subject: RE: Displaying Problems
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, June 25, 2002 11:12 AM
  To: Bob Showalter; [EMAIL PROTECTED]
  Subject: Re: Displaying Problems
 
 
  Bob,
 
  ...
  So what exactly is the RFC2616 compliant content type?
 
 cf. ftp://ftp.isi.edu/in-notes/rfc2616.txt, section 2.2
 
 
  You know its funny, but it seems that so many who stick up
  for CGI.pm so strongly are quick to say
  that CGI.pm is doing things right and that it does them
  better, but they seem to purposely avoid
  giving the actual solution.
 
 See above.
 
 
  It seems to me that our way of life (freedom and prosperity)
  came about from people thinking for
  them selves and from innovation, learning and continued drive
  to improve what was given us.
  I do a little system admin on the side, and I've come to find
  that learning the actual conf files is
  such a boon over simply using the GUI app.  So much
  understanding has come and it takes me to a more
  advanced level.  Many times I can discover a problem, or have
  understanding of the underlying
  problem when coming across things I don't expect.  In my mind
  programming is the same.  I want to
  know what's going on, so I can make a wise and educated
  decision of how to approach it.
 
 CGI.pm--a threat to our way of life! Down with the troglodytes! :)
 
 --
 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]
 
 
 




-
This mail sent through IMP: http://horde.org/imp/

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




RE: Displaying Problems

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 12:47 PM
 To: Bob Showalter; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems
 
 
 Ok, so here's the deal:
 
 Some HTTP/1.0 software has interpreted a Content-Type header 
 without charset parameter incorrectly
 to mean recipient should guess. Senders wishing to defeat 
 this behavior MAY include a charset
 parameter even when the charset is ISO-8859-1 and SHOULD do 
 so when it is known that it will not
 confuse the recipient.
 
 By the way, I did not upper case the MAY and SHOULD, those 
 were that way in the doc which means they
 were trying to emphasize them.  I'd have to say that MAY 
 doesn't suggest that it is a requirement
 for the content-type to work properly.

This is the relevant paragraph from 2.2 that I was going for:

   HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
   protocol elements except the entity-body (see appendix 19.3 for
   tolerant applications). The end-of-line marker within an entity-body
   is defined by its associated media type, as described in section 3.7.

Appendix 19.3 (Tolerant Applications) says, in part:

   The line terminator for message-header fields is the sequence CRLF.
   However, we recommend that applications, when parsing such headers,
   recognize a single LF as a line terminator and ignore the leading CR.

But, section 3.7 says:

   When in canonical form, media subtypes of the text type use CRLF as
   the text line break. HTTP relaxes this requirement and allows the
   transport of text media with plain CR or LF alone representing a line
   break when it is done consistently for an entire entity-body. HTTP
   applications MUST accept CRLF, bare CR, and bare LF as being
   representative of a line break in text media received via HTTP. In
   addition, if the text is represented in a character set that does not
   use octets 13 and 10 for CR and LF respectively, as is the case for
   some multi-byte character sets, HTTP allows the use of whatever octet
   sequences are defined by that character set to represent the
   equivalent of CR and LF for line breaks. This flexibility regarding
   line breaks applies only to text media in the entity-body; a bare CR
   or LF MUST NOT be substituted for CRLF within any of the HTTP control
   structures (such as header fields and multipart boundaries).

Note especially the last sentence.

A nit-pick, to be sure. But little things like this cause programs
to break all the time. Like I said, most (maybe all?) clients will 
accept what you wrote, but why not stick to the standard? Or, save
all the trouble of grovelling through the RFC's and:

   print $q-header;

Cheers.

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




AW: param problem

2002-06-25 Thread Theuerkorn Johannes

Hi Joe,

just hab the same Problems with your Script as with cgi::param,...
Ok, I just played around a little bit, checked some books and came to this solution:

our %values;

sub parse_form {

my ($ENV,$daten,@fields,$name,$value);  
if ($ENV{'REQUEST_METHOD'} eq 'GET')
{$daten = $ENV{'QUERY_STRING'}
}
else
{read(STDIN,$daten,$ENV{'CONTENT_LENGTH'});
}

@fields = split (//,$daten);
foreach (@fields){
($name, $value) = split(/=/, $_);
$values {$name} = $value;
}
 } # End sub parse_form

Only thing I want to change now is the access to the Values. Seems to be nice like you 
do it, but I still couldn´t follow...
So I have to recall it like print $values{seriennummer};
Working on it... :-)

Greets Johannes

 -Ursprüngliche Nachricht-
 Von:  David vd Geer Inhuur tbv IPlib [SMTP:[EMAIL PROTECTED]]
 Gesendet am:  Dienstag, 25. Juni 2002 17:47
 An:   [EMAIL PROTECTED]
 Betreff:  param problem
 
 
 Johan,
 
 Somethings are going wrong here.
 Indeed the our should make the var global.
 
 Looking at your header it's obvious you use : name=valuename2=value2
 
 When you print $header, you will see that the first ? is not shown.
 What I did in my script was building my header like this :
 
 name1=value1?name2=value2? ...
 
 So what you have got to do right now is :
 
 @pairs = split(/\/, $head); # split vars using  as delimitor
 
 You see, change the question mark into a ampensant(). Now you will get you scalars
 just like you used to.
 
 our ${$name} = $value;
 
 Does nothing else then :
 
 our $serien = 10/rd30;
 
 It's just that it does it automated, so you can use : print Serienumber: $serien;
 To print it. give it a try within the sub-routine and outside. Just to make sure the
 our works.
 
 
 Regs David
  
  Our?! Never heard this bevore,... as you probably can think now i´am new to 
perl,.. :-) 
  
  So I guess our is the opposite to my? My is available only in the routine it is 
defined in (and the called subroutines) and our is also available for the main script 
or any other colling part even if it is defined in a subroutine?
  
  Still it´s not clear to me how to access my values,... :-)
  
  If i pass the parameters ?parameter1=value1parameter2=value2, i have to access 
the parametervalues like $$parameter1 and $$parameter2 alright?
  
  Johannes
  
   -Ursprüngliche Nachricht-
   Von:  David vd Geer Inhuur tbv IPlib [SMTP:[EMAIL PROTECTED]]
   Gesendet am:  Dienstag, 25. Juni 2002 17:26
   An:   [EMAIL PROTECTED]
   Betreff:  Re: AW: AW: AW: AW: param problem
   
   
   Make Sure you do the our ${$name} = $value;
   
   this will make the $name available throught the script.
   The rest I would pre-define in the sub-routine :
   
   sub parse_form {
   
 my ($buffer, $value, $name, .. ... .);
 ...
 ..
 our ${$name} = $value;
   
   }
   
   Good Luck.
   
   Regs David
   -
Ok, got some problems using strict but thats OK.one last Thing for today: 
where do i have to call the sub 
and how do I access the parameters later in the script?

greetings Johannes usually one named me Joe to,...
 -Urspr üngliche Nachricht-
 Von:  David vd Geer Inhuur tbv IPlib [SMTP:[EMAIL PROTECTED]]
 Gesendet am:  Dienstag, 25. Juni 2002 17:03
 An:   [EMAIL PROTECTED]
 Betreff:  Re: AW: AW: AW: param problem
 
 
 Yep, you'dd better do.
 This is always the first routine I load before I start to do anything.
 
 Regs David
  
  OK, I´m going to try it then,...
  Just thought one should know what to put in a script,... :-) But aren ´t 
we all just Zombies,... :-)
  Guess i have to do that in the beginning of the script?
  
  Johannes
   -Ursprüngliche Nachricht-
   Von:  David vd Geer Inhuur tbv IPlib 
[SMTP:[EMAIL PROTECTED]]
   Gesendet am:  Dienstag, 25. Juni 2002 16:30
   An:   [EMAIL PROTECTED]; 
[EMAIL PROTECTED]
   Cc:   [EMAIL PROTECTED]
   Betreff:  Re: AW: AW: param problem
   
   
   Hi Johan,
   
   Let's tell you a secret.
   I don't know what it means as well :)
   Well some part then. This is just typicaly something I always re-use and
   actualy never had the time to re-look at it.
   
   Don't worry about the length by the way. Just give it a try, it never 
failed for
   me. And maybe you might become one of the zombies (just like me), that 
now and
   than just steals code and re-uses it without understanding what it does 
:)
   
   Now let's at least give some info :
   
   my $head = $ENV{QUERY_STRING};  ## Just read 1 of the Enironment vars 
and put it 
into $head. In this case you request the 
query string.
You might want to use google.com, look at 

Re: Displaying Problems

2002-06-25 Thread Brian

Hmm, a perl syntax checks out, but the script seemingly dies when ran?  One 
thing I've found and don't yet fully understand, is it seems like when 
importing other modules the perl check doesn't seem to catch undeclared subs 
despite use strict- any ideas?

Either way, I digress- basic things but, A) I'd check the webserver logs- 
usually theres some info in there at least of what happened, B) and I'd try 
running the script via the terminal- it'll require a little bit of 
modification to it (aka, hardcode $c to a value for testing), but I've used 
it time and time again to find exactly how and where a script that has passed 
syntax checking is doing something that leads to its death...

On a seperate note- I'd tend to agree with the other poster- while the CGI 
module is indispensible, it seems like some parts of it are overkill- a base 
example would be existance of a paragraph method- a method that returns a 
'p'.
Either way, good luck with it.
~Brian


On Monday 24 June 2002 15:09, Kyle Babich wrote
 For the following the syntax is correct but when I try to open it 
 nothing displays, what should I change?

 #!/usr/bin/perl -wT
 use strict;
 use CGI::Pretty qw/ :standard /;
 $CGI::DISABLE_UPLOADS = 1;
 $CGI::POST_MAX = 512 * 1024;

 print header ( text/html );

 my $date = localtime;

 my $c = param('c');
 my $content = c;

 if ($c eq h) {
$content = qq{\n};
 } elsif ($c eq eh) {
$content = qq{\n};
 } elsif ($c eq hd) {
$content = qq{\n};
 } elsif ($c eq p) {
$content = qq{\n};
 } elsif ($c eq c) {
$content = qq{\n};
 } elsif ($c eq su) {
$content = qq{\n};
 }

 my @nav = (Home,E-Mail Hosting,Help
 Desk,Policies,Contact,Signup);

 my @loc = (index.cgi?c=h,index.cgi?c=eh,index.cgi?c=hd,index.cgi?
 c=p,
index.cgi?c=c,index.cgi?c=su);

 print start_html(
   -title = IMAP.cc E-Mail Hosting,
-head  = Link(
{
-rel = stylesheet,
-type = text/css,
-href = style.css
}
),
),
body( -bgcolor = \#FF ),
table({
-width = 95\%,
-cellspacing = 0,
-cellpadding = 0,
-border = 1,
-bordercolor = \#00},
tbody(
   Tr(
   td( {-width = 100\%},
table({
   -width = 100\%,
   -cellspacing = 0,
   -cellpadding = 1,
   -border = 1,
   -bordercolor = \#00
   -align = center},
tbody(
   Tr(
   td( {-width = 100\%,
   -bgcolor = \#00,
   -align = center},
Font({
   -face = Verdana, Arial, Times New Roman,
   -size = 4,
   -color = \#FF},
   IMAP.cc
   )
   ),),),),),),),),
 end_html


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




Re: Fwd: passing variables in POST

2002-06-25 Thread Hytham Shehab

   my $md5= new Digest::MD5;
   my $remote = $ENV{ REMOTE_ADDR } . $ENV{ REMOTE_PORT } . $self-{
_rand };
   my $id = $md5-md5_base64( time, $$, $remote );
   $id=~ tr|+/=|-_.|; # Make non-word characters URL-friendly

 The Make ... URL-friendly part is in case I need to embed the session ID
in a URL.

 As for the _rand on the end, that's a random number that I tack onto the
end to ensure unique
 ids are generated.

thanks very much Ovid, it was very nice of you, but can you complete your
favour and describe how to implement Apache::Session, i mean, whats the use
of that module if i could generate a session id with md5?



btw, whats the %self is?

--
Hytham Shehab


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




Using CGI.pm [WAS Re: Displaying Problems]

2002-06-25 Thread John Brooking

I tend to always use CGI.pm to get the parameters, but
I may or may not use it to output HTML. If it's simple
HTML, I will, because it's easier and safer, but if
it's complicated, like a lot of JavaScript in the
header, or for most form input controls, I just use
print statements, either normal ones for one or two
lines, or the END form for larger sections.

The other day I found myself using mostly one large
END statement, with variables embedded to insert the
results that I had calculated earlier. At some point,
I realized I was approaching the concept used by
HTML::Template, except that I had both code and
presentation in one source file rather than splitting
it. Different techniques for different situations.

- John


=
Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do. - They Might Be Giants, http://www.tmbg.com

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

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




Re: Displaying Problems

2002-06-25 Thread perl-dvd

Bob,
That's interesting.
You know, I work with about 5 other perl programmers, most of which do use CGI.pm, 
but none of
them use it for anything other that gathering input from the web.  I have also 
downloaded many
packages from CPAN, I would say a majority of them use CGI.pm, but very rarely do I 
see it used for
anything but gathering data.
I'm not suggesting we shouldn't follow the standard.  I am suggesting that this 
particular
standard will never be enforced, because if it was, I'd be willing to bet, it would 
break a great
percentage of perl scripts out there.  But yes, I agree with you that we should all 
try to follow
the specs pretty closely.
Anyway, personally, I don't use CGI.pm at all, and it would be a real shame if I 
began including
the whole thing just for that.  It would just seem smarter for me to begin using this  
print
Content-type: text/html${CRLF}${CRLF};  instead.
I created a lib for receiving data from GET, POST or shell.  I will be releasing 
it to CPAN
soon, and expect to get this sort of thing quite a bit.  That is good, because I want 
my lib to be
very efficient and proper.  The reason I wrote my own is because I like my variables 
in a easy to
use structure:
%hash = (
'a_name' = 'value',   # for single name value pairs
'b_name' = [multiple, values, for, this],   # for single name muli-value 
sets
'c_name' = {
 'original_name' = 'filename.jpg',
 'size' = '23554',
 'location' = 
'/tmp/fileupload/tmpfile-10028983-88.57.192.3-2783-298374-927837'
 } # for files
);
With this structure, I can get to everything very easily.  It didn't make much 
sense to use
CGI.pm to gather the data, smush it into a data structure, only to loop through all 
the data and
shove it into another structure.
I'm sure I'll get lots of hate mail from CGI.pm die hard's, but my other choice is 
to just not
post this at all.  What I hope for is several people telling me how to make it 
slightly more
efficient or compatible with other OS's (you see I've only had opportunity to test it 
on Linux and
Win2000, though I've been testing it on Linux for about 2 1/2 years).
Its pretty hard to make it more simple than:
use Form;
my %input = Form();

David



- Original Message -
From: Bob Showalter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, June 25, 2002 11:12 AM
Subject: RE: Displaying Problems


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 12:47 PM
 To: Bob Showalter; [EMAIL PROTECTED]
 Subject: Re: Displaying Problems


 Ok, so here's the deal:

 Some HTTP/1.0 software has interpreted a Content-Type header
 without charset parameter incorrectly
 to mean recipient should guess. Senders wishing to defeat
 this behavior MAY include a charset
 parameter even when the charset is ISO-8859-1 and SHOULD do
 so when it is known that it will not
 confuse the recipient.

 By the way, I did not upper case the MAY and SHOULD, those
 were that way in the doc which means they
 were trying to emphasize them.  I'd have to say that MAY
 doesn't suggest that it is a requirement
 for the content-type to work properly.

This is the relevant paragraph from 2.2 that I was going for:

   HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
   protocol elements except the entity-body (see appendix 19.3 for
   tolerant applications). The end-of-line marker within an entity-body
   is defined by its associated media type, as described in section 3.7.

Appendix 19.3 (Tolerant Applications) says, in part:

   The line terminator for message-header fields is the sequence CRLF.
   However, we recommend that applications, when parsing such headers,
   recognize a single LF as a line terminator and ignore the leading CR.

But, section 3.7 says:

   When in canonical form, media subtypes of the text type use CRLF as
   the text line break. HTTP relaxes this requirement and allows the
   transport of text media with plain CR or LF alone representing a line
   break when it is done consistently for an entire entity-body. HTTP
   applications MUST accept CRLF, bare CR, and bare LF as being
   representative of a line break in text media received via HTTP. In
   addition, if the text is represented in a character set that does not
   use octets 13 and 10 for CR and LF respectively, as is the case for
   some multi-byte character sets, HTTP allows the use of whatever octet
   sequences are defined by that character set to represent the
   equivalent of CR and LF for line breaks. This flexibility regarding
   line breaks applies only to text media in the entity-body; a bare CR
   or LF MUST NOT be substituted for CRLF within any of the HTTP control
   structures (such as header fields and multipart boundaries).

Note especially the last sentence.

A nit-pick, to be sure. But little things like this cause programs
to break all the time. Like I said, most (maybe 

Re: Fwd: passing variables in POST

2002-06-25 Thread Niko Gunadi

thanks very much Ovid, it was very nice of you, but can you complete your
favour and describe how to implement Apache::Session, i mean, whats the use
of that module if i could generate a session id with md5?

you actually can use CGI::Session, the front end of Apache::Session.
By using this module, you can easily save your variables to the session.
you also can choose which storage for your session (from file to mysql).

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




Re: Displaying Problems

2002-06-25 Thread Niko Gunadi

On Tue, Jun 25, 2002 at 12:10:34PM -0600, [EMAIL PROTECTED] wrote:
You know, I work with about 5 other perl programmers, most of which do use 
CGI.pm, but none of
them use it for anything other that gathering input from the web.  I have also 
downloaded many
packages from CPAN, I would say a majority of them use CGI.pm, but very rarely do I 
see it used for
anything but gathering data.

ah yes, I also use CGI.pm only to gather the input data as I'm afraid my
own method will break somewhere. :o
So, it's kinda of waste to use a big module for a simple task.
Instead of using CGI.pm to construct HTML, i'm using CGI::FastTemplate
which is more efficient and neater to use.

I created a lib for receiving data from GET, POST or shell.  I will be releasing 
it to CPAN
soon, and expect to get this sort of thing quite a bit.  That is good, because I want 
my lib to be
very efficient and proper.  The reason I wrote my own is because I like my variables 
in a easy to
use structure:

I'm looking forward to this module to replace my CGI.pm :)

With this structure, I can get to everything very easily.  It didn't make much 
sense to use
CGI.pm to gather the data, smush it into a data structure, only to loop through all 
the data and
shove it into another structure.

Yes, it's a pity

regards,
niko

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




Re: Fwd: passing variables in POST

2002-06-25 Thread Ovid

--- Niko Gunadi [EMAIL PROTECTED] wrote:
 thanks very much Ovid, it was very nice of you, but can you complete your
 favour and describe how to implement Apache::Session, i mean, whats the use
 of that module if i could generate a session id with md5?
 
 you actually can use CGI::Session, the front end of Apache::Session.
 By using this module, you can easily save your variables to the session.
 you also can choose which storage for your session (from file to mysql).

When I wrote a lot of our in-house session handling code, we used IIS and I was under 
the
impression that Apache::Session required Apache.  I'm told that this is not true, but 
I haven't
researched it.  Anyone know about this?

Cheers,
Curtis Ovid Poe

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

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

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




Re: Displaying Problems

2002-06-25 Thread Kyle Babich

Ok, I did like perldoc cgi said and changed it to this:

print start_html(
  -title = IMAP.cc,
   -head  = Link( 
   { 
   -rel = stylesheet,
   -type = text/css,
   -href = style.css,
   }
   ),
 -bgcolor = \#FF
   ),

It still won't work though.

- Original Message - 
From: Bob Showalter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, June 25, 2002 1:23 PM
Subject: RE: Displaying Problems


  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, June 25, 2002 1:05 PM
  To: [EMAIL PROTECTED]
  Subject: Re: Displaying Problems
  
  
  Well, I still can't get my page to display.
  
 
 Remove this line:
 
body( -bgcolor = \#Ff ),
 
 It's emitting a body/body sequence. start_html opens the
 body tag and end_html closes it, so you don't need this. bgcolor
 should be passed to start_html.
 
 Read the docs. perldoc CGI.
 
 -- 
 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: Fwd: passing variables in POST

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: Ovid [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 3:34 PM
 To: Niko Gunadi; Beginners cgi
 Subject: Re: Fwd: passing variables in POST
 
 
 I was under the
 impression that Apache::Session required Apache.  I'm told 
 that this is not true, but I haven't
 researched it.  Anyone know about this?

Apache::Session doesn't require Apache. It doesn't
touch the web server at all, so you could use it in
non-web server situations.

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




Re: Renaming files

2002-06-25 Thread Felix Geerinckx

on Tue, 25 Jun 2002 19:51:14 GMT, JoãO Paulo wrote:

 
 How can I quickly change the extension of a lot of files???
 
 something like   file into file.something ,JP.

perldoc -f rename
perldoc -f opendir
perldoc -f readdir

-- 
felix

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




Re: Renaming files

2002-06-25 Thread learn perl

use this:

you could use system commands if you are on winnt or w2k.

I normally just use

@filelist = `dir *.ext /b`;

foreach (@filelist){
@filename=split on the .
if last element of @filename is what you're looking for{
`rename $_ @filename[0].newext`
}
}

then you're done
hope this helps

Eric

On 25 Jun 2002, Felix Geerinckx wrote:

 on Tue, 25 Jun 2002 19:51:14 GMT, JoãO Paulo wrote:

 
  How can I quickly change the extension of a lot of files???
 
  something like   file into file.something ,JP.

 perldoc -f rename
 perldoc -f opendir
 perldoc -f readdir

 --
 felix

 --
 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: #!/usr/bin/perl - is there a macro for this?

2002-06-25 Thread Harry Putnam

Tor Hildrum [EMAIL PROTECTED] writes:

 snip

 It does save quite a bit of time if you write lots of scripts.
 Especially when you need a quicky to check something in a more
 complex one before adding it.

 This is where you would use your one-liners.
 I'm pretty sure most people here check syntax etc on a one-liner before they
 post a solution.

 perl -e '..' # I would think that is the 'default' time saver.

One liners have a way of turning into multiliners... thats where a
small quick script comes in.

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




Thanks

2002-06-25 Thread Richard Adams

Thanks, that's a neat trick - I hadn't realised you could still capture
things from within  a lookahead.

Richard

 On Jun 24, Richard Adams said:
 
 @peptides = $sequence =~ /(\w{4}S\w{4})/g;
 
 this works up to a point, but if there are 2 adjacent 'S' the 2nd one
 is not extracted, I guess because the regexp engine continues after the
 end of the previous match ie., it doesn't extract DFRSSSGHY above.
 
 Here's the trick for you:
 
 @peptides = $sequence =~ /(?=(\w{4}S\w{4}))/g;
 
 The (?=...) assertion looks ahead in the string for the pattern, without
 actually advancing in the string when it's done.  In this way, we capture
 something without advancing past it.

-- 


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




RE: if-statement and grep in one go

2002-06-25 Thread David vd Geer Inhuur tbv IPlib


Hello,

Thanks for the solution Bob.
Changed some stuff and have 2 questions open.

  my $line;
  my (%u, %g);
  open(FILE,  ${dir}/user.perm) or print Failed opening file $!;   ## 1
  while ($line = FILE) {  ## 2
  if ($line =~ /^user:/) {
 $u{$_} = 1 for split(/,/, substr($line, 6));   ## 3
  }
  if ($line =~ /^group:/) {
 $g{$_} = 1 for split(/,/, substr($line, 7));   ## 4
  }
  }
  close(FILE);

  print Invalid login; exit unless $u{$pwuser} || $g{$group}; ## 5

1) I don't like to die in my script as there are many files to read. And if I
   can't open the current file I just want to continue with the rest of the files
   So I always prefer printing.
2) while my $line (FILE) didn't work, just a notation error.
3) I don't need to split on spaces. The script that fills the user.perm is 
   designed to always : user: vdgeerd,and,other  ## Never mind.
   BUT, What do you do with the 1 ?? Changing it to $1 doesn't matter too.
   I keep empty places when doing a  foreach my $value(%u) { print $value; } 
   chomp %u; didn't work either.
4) Same as 3
5) I changed the  into || cause the user can have acces due to group or user 
   rights.
   BUT, how do I combine a printing error message and an exit within the unless ?
   Right now it always prints, and only exits when I have no permissions.
   
Thanks for all your previous help!!


Regs David
  
  
  
  Hi,
  
  I need some help on the following.
  In my script I show users some infodocs after they are 
  verified to be valid users.
  Users can have the permissions following the ruleset: 
  - user (all perm)
  - group (all perm), 
  - descr (Not allowed to actualy open this document).
  
  Now I do the following in my script :
  
  # -
   open(FILE,  ${dir}/user.perm);
   my @users = FILE;
   close FILE;
   chomp (@users);
  
   my @out = grep {/$pwuser/} @users;
   my @out1 = grep {/$group/} @users;
   if ((!(@out))  (!(@out1))) { print Sorry $pwuser you have 
  no acces to this IP-Block; exit; }
  # --
  
  But if a user with description access enters the complete 
  link right now,
  he can view the entire document.
  Anyway, How do I build in an if-statement in here ??
  I know I can change the foreach loop and build the if 
  statement within the loop,
  but isn't there something like :
  
  my @out = if (m/user:/) { grep {/$pwuser/} } @users;  ## This 
  doesn't work
  my @out1 = if (m/group:/) { grep {/$group/} } @users;  ## 
  This doesn't work
  
  an example of the file user.perm would be :
 
 I think you need to parse this file into some structures rather
 than using the simple regex approach. Even if you check only the
 user: line, your logic would allow user names like 'user', or 'v',
 or ',' or even ''.
 
 I would do something like this:
 
   my (%u, %g);
   open(FILE,  ${dir}/user.perm) or die $!;
   while my $line (FILE) {
   if ($line =~ /^user:/) {
  $u{$_} = 1 for split(/\s*,\s*/, substr($line, 5));
   }
   if ($line =~ /^group:/) {
  $g{$_} = 1 for split(/\s*,\s*/, substr($line, 6));
   }
   }
   close(FILE);
 
 Now you can check for a valid user/group like this:
 
print Invalid login unless $u{$user}  $g{$group};

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




Looping Control structures

2002-06-25 Thread Will Shiver

I have a file that I would like to read thru line by line and print somthing based on 
when the  value in  the first field postion stays the same. I would change the tag 
value amongst 3 different values.

Example file:
blue jay
blue bery
blue bird
red apple
red car
red man
purple people
green 
green 2
green 3
black one
black woman

The Program would
split on space
field position 1 would equal blue and it would then print 
blue box
blue box
blue box
red robo
red robo
red robo
purple rain
green box
green box
green box
black robo
black robo

Any help with this would be greatly appreciated

Will Shiver
[EMAIL PROTECTED]

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




Re: Sockets

2002-06-25 Thread Felix Geerinckx

  Basically, I need to know what I should specifically be
  looking 
 at...Thoughts?

Look at Lincoln Stein's excellent Network Programming with Perl

http://modperl.com:9000/perl_networking/

-- 
felix

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




Re: Looping Control structures

2002-06-25 Thread John W. Krahn

Will Shiver wrote:
 
 I have a file that I would like to read thru line by
 line and print somthing based on when the  value in
 the first field postion stays the same. I would change
 the tag value amongst 3 different values.
 
 Example file:
 blue jay
 blue bery
 blue bird
 red apple
 red car
 red man
 purple people
 green
 green 2
 green 3
 black one
 black woman
 
 The Program would
 split on space
 field position 1 would equal blue and it would then print
 blue box
 blue box
 blue box
 red robo
 red robo
 red robo
 purple rain
 green box
 green box
 green box
 black robo
 black robo


perl -lane'$a{$F[0]}++or$a=qw/box robo rain/[$b++%3];print$F[0] $a' yourfile.txt


John
-- 
use Perl;
program
fulfillment

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




RE: if-statement and grep in one go

2002-06-25 Thread Felix Geerinckx

on Tue, 25 Jun 2002 10:28:07 GMT, [EMAIL PROTECTED]
(David Vd Geer Inhuur Tbv Iplib) wrote: 

 Changed some stuff and have 2 questions open.

 [code snipped]

 1) I don't like to die in my script as there are many files to
read. And if I can't open the current file I just want to 
continue with the rest of the files So I always prefer printing.

It would be better to use 'warn' instead of print

  print Invalid login; exit unless $u{$pwuser} || $g{$group};

BUT, how do I combine a printing error message and an exit
within the unless ? Right now it always prints, and only exits
when I have no permissions. 

'unless' here is used as a statement modifier, which means it only 
works on the 'exit'. You want to use:

unless (...) { print; exit; }

-- 
felix

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




RE: if-statement and grep in one go

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: David vd Geer Inhuur tbv IPlib
 [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 6:28 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Subject: RE: if-statement and grep in one go
 
 
 
 Hello,
 
 Thanks for the solution Bob.
 Changed some stuff and have 2 questions open.
 
   my $line;
   my (%u, %g);
   open(FILE,  ${dir}/user.perm) or print Failed opening 
 file $!; ## 1
   while ($line = FILE) {
   ## 2
   if ($line =~ /^user:/) {
  $u{$_} = 1 for split(/,/, substr($line, 6)); 
   ## 3
   }
   if ($line =~ /^group:/) {
  $g{$_} = 1 for split(/,/, substr($line, 7)); 
   ## 4
   }
   }
   close(FILE);
 
   print Invalid login; exit unless $u{$pwuser} || 
 $g{$group};   ## 5

Somehow, I posted code other than that which I tested. Sorry about that.

For those that might be interested in such things, here is the exact code
I tested:

  #!/usr/bin/perl

  use Data::Dumper;

  my (%user, $group);
  while (my $line = DATA) {
if ($line =~ /^user:\s*(.*)$/) {
 $user{$_} = 1 for split(/\s*,\s*/, $1);
}
if ($line =~ /^group:\s*(.*)$/) {
 $group{$_} = 1 for split(/\s*,\s*/, $1);
}
  }

  print Data::Dumper::Dumper(\%user, \%group);

  __DATA__
  user: vdgeerd, tester
  group: none,
  descr: all,

I cut and pasted the sample input data you gave and put it
under a __DATA__ tag. This let me read it through the DATA
file handle. Data::Dumper was used to make sure the resulting
hashes came out to the structure I expected.

 
 1) I don't like to die in my script as there are many files 
 to read. And if I
can't open the current file I just want to continue with 
 the rest of the files
So I always prefer printing.

OK, no problem.

 2) while my $line (FILE) didn't work, just a notation error.

My goof, sorry.

 3) I don't need to split on spaces. The script that fills the 
 user.perm is 
designed to always : user: vdgeerd,and,other  ## Never mind.
BUT, What do you do with the 1 ?? Changing it to $1 
 doesn't matter too.

I don't do anything with it. It's the keys that matter, not the values.
1 is just a dummy value, since each key must have a corresponding
value.

I keep empty places when doing a  foreach my $value(%u) { 
 print $value; } 
chomp %u; didn't work either.
 4) Same as 3
 5) I changed the  into || cause the user can have acces due 
 to group or user 
rights.
BUT, how do I combine a printing error message and an exit 
 within the unless ?
Right now it always prints, and only exits when I have no 
 permissions.

The semicolon makes the exit a separate statement, so you need
a comma. However, the comma will be treated as part of the print
unless you use parens. So the answer is:

   print(Invalid login), exit unless $u{$pwuser} || $g{$group};


 Thanks for all your previous help!!

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




cgi:param problem

2002-06-25 Thread Theuerkorn Johannes

Hi there, 

i´ve got to pass a serial number to a perl.cgi. Doing it via the cgi:param funktion 
seems not to work.


use strict;
use CGI;
use DBI;
my $cgi_obj = new CGI;
my $seriennummer = $cgi_obj-param(seriennummer);

Passing http://server/script4.pl?seriennummer=CN+/P422

results in a variable seriennummer=CN/P422

As i want to use the variable seriennummer for an SQL Query later, this doesn´t work.

Any possibility passing the + to my cgi Script? (\+ doesn´t work, either '+' or +)

Johannes

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




RE: if-statement and grep in one go

2002-06-25 Thread Marco Antonio Valenzuela Escárcega

On Tue, 2002-06-25 at 03:28, David vd Geer Inhuur tbv IPlib wrote:
 
 Hello,
 
 Thanks for the solution Bob.
 Changed some stuff and have 2 questions open.
 
   my $line;
   my (%u, %g);
   open(FILE,  ${dir}/user.perm) or print Failed opening file $!; ## 1
   while ($line = FILE) {## 2
   if ($line =~ /^user:/) {
  $u{$_} = 1 for split(/,/, substr($line, 6)); ## 3
   }
   if ($line =~ /^group:/) {
  $g{$_} = 1 for split(/,/, substr($line, 7)); ## 4
   }
   }
   close(FILE);
 
   print Invalid login; exit unless $u{$pwuser} || $g{$group};   ## 5
 
 1) I don't like to die in my script as there are many files to read. And if I
can't open the current file I just want to continue with the rest of the files
So I always prefer printing.
 2) while my $line (FILE) didn't work, just a notation error.
 3) I don't need to split on spaces. The script that fills the user.perm is 
designed to always : user: vdgeerd,and,other  ## Never mind.
BUT, What do you do with the 1 ?? Changing it to $1 doesn't matter too.
I keep empty places when doing a  foreach my $value(%u) { print $value; } 
chomp %u; didn't work either.
 4) Same as 3
 5) I changed the  into || cause the user can have acces due to group or user 
rights.
BUT, how do I combine a printing error message and an exit within the unless ?

if you need to print an error message and exit, use die:
die 'Invalid login' unless $u{$pwuser} || $g{$group};



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




HElP ...me!

2002-06-25 Thread Baris Ozol

Hi everybody,

Hopefully some of you will help to solve my problem!!
I'm trying to parse a flat file formatted file. It's a PDB (Protein Data
Bank).

But I didn't find any script on internet and perl.com. 
If you'll help me, I will be happy and solve the problem..

Thank you.

Bryce



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




RE: HElP ...me!

2002-06-25 Thread Shishir K. Singh

Hi everybody,

Hopefully some of you will help to solve my problem!!
I'm trying to parse a flat file formatted file. It's a PDB (Protein Data
Bank).

But I didn't find any script on internet and perl.com. 
If you'll help me, I will be happy and solve the problem..

Thank you.

Bryce

Can You provide more details as to what is your file like, how do you want it to be 
parsed and what is your desired output ??



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




Pattern Matching

2002-06-25 Thread Akens, Anthony

I'm trying to find a way to match anything between two brackets []  The stuff in
between will have alpha, numeric, and symbols (including /  -  @ and spaces)

For instance

[akens@egh-org blah/blah/blah]

I need to match that entire string, including the []'s

Here's the ugly thing I've gotten so far to do it.  But I know there's a way to 
simplify
it and just match anything between the []'s.  Thanks for any advice.

\[[A-Za-z'-@]* \S+[A-Za-z'/]\]


Tony Akens

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




Re: Embedded Perl

2002-06-25 Thread Felix Geerinckx

on Tue, 25 Jun 2002 13:46:29 GMT, [EMAIL PROTECTED]
(Nigel Peck) wrote: 

 I'm interested to know what solutions people use/like for
 embedding Perl in HTML/XML documents to be processed by the web
 server (like PHP and ASP), for Apache. I like the fact that the
 syntax for PHP is ? ... ? (it complies with XML) and would like
 to be able to do it using my Perl skills instead of learning PHP.
 
 Is embperl the one to use?

You might be interested in Perrin Harkins' article Choosing a 
Templating System at

http://www.perl.com/pub/a/2001/08/21/templating.html

-- 
felix

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




RE: Embedded Perl

2002-06-25 Thread Brad Fike

For embedding I've tested Mason and Embperl and found that Embperl for less
complicated
and allowed for easier to read code (which is important when you are working
in a team).

But I have recently moved to HTML::Template. I really like the separation of
HTML and 
code that it allows and I also feel that it allows far more reusability
(another important
concept when working in a team)

 -Original Message-
 From: Nigel Peck [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 8:46 AM
 To:   [EMAIL PROTECTED]
 Subject:  Embedded Perl
 
 I'm interested to know what solutions people use/like for embedding Perl
 in HTML/XML documents to be processed by the web server (like PHP and
 ASP), for Apache. I like the fact that the syntax for PHP is ? ... ?
 (it complies with XML) and would like to be able to do it using my Perl
 skills instead of learning PHP.
 
 Is embperl the one to use?
 
 TIA
 Nigel
 
 
 ITM Business Solutions
 Unit 4
 Nine Trees Trading Estate
 Morthen Road
 Rotherham
 S66 9JG
 
 Reception
 Tel: 01709 703288
 Fax: 01709 701549
 
 Help Desk
 Tel:01709 530424
 Fax: 01709 702159
 
 CONFIDENTIALITY NOTICE: This message is intended only for the use of
 the individual or entity to which it is addressed, and may contain
 information that is privileged, confidential and exempt from disclosure
 under applicable law.
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


**
Notice:  The area code for the Wal-Mart Bentonville General 
Office in the US has changed from 501 to 479.  Please make
sure that you are dialing 479 when making calls to any 
General Office location.

**
This email and any files transmitted with it are confidential
and intended solely for the individual or entity to 
whom they are addressed.  If you have received this email
in error destroy it immediately.
**
 Wal-Mart Stores, Inc. Confidential
**


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




RE: Pattern Matching

2002-06-25 Thread Hanson, Robert

This will work...

/\[.*?\]/

The .*? means match any character any number of times... BUT be
non-greedy about it.  The ? is what makes it non-greedy, and that means
it will attempt to match as few characters as possible.  ...So in essence
this says match an open bracket up to the first closing bracket.  Without
the ? it would say match an open bracket up to the *last* closing
bracket.

Probably more explaination than you wanted, but I felt like sharing :)

Rob 

-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 25, 2002 9:50 AM
To: [EMAIL PROTECTED]
Subject: Pattern Matching


I'm trying to find a way to match anything between two brackets []  The
stuff in
between will have alpha, numeric, and symbols (including /  -  @ and spaces)

For instance

[akens@egh-org blah/blah/blah]

I need to match that entire string, including the []'s

Here's the ugly thing I've gotten so far to do it.  But I know there's a way
to simplify
it and just match anything between the []'s.  Thanks for any advice.

\[[A-Za-z'-@]* \S+[A-Za-z'/]\]


Tony Akens

-- 
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: Pattern Matching

2002-06-25 Thread Shishir K. Singh



I'm trying to find a way to match anything between two brackets []  The stuff in
between will have alpha, numeric, and symbols (including /  -  @ and spaces)

For instance

[akens@egh-org blah/blah/blah]

I need to match that entire string, including the []'s

Here's the ugly thing I've gotten so far to do it.  But I know there's a way to 
simplify
it and just match anything between the []'s.  Thanks for any advice.

\[[A-Za-z'-@]* \S+[A-Za-z'/]\]


$line = 'dfdf[akens@egh-org blah/blah/blah]dsfdsf';
$line =~ /(\[.*?\])/;

print $1, \n;


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




getting date from localtime

2002-06-25 Thread Johnson, Shaunn

Howdy:

I'm trying to do the following (which may have
been created already) in perl:

* create two variables

var1 = this will be sunday of current week always
var2 = this will be saturday of current week always

I'm not sure how I can use 'localtime' as a tool
for identifying var1 and var2.

I mean, I think I can work around this:

($mday, $mon, $year) = (localtime())[3 .. 5];

Which gives me day-of-month, month and year, but
how to used that as a focal point to get
that saturday and sunday of the current week
without some silly if-then-else loop.

Perhaps I am going about this the wrong way.
It seems like var1 and var2 will actually be
large formulas.

Suggestions?

-X



RE: Pattern Matching

2002-06-25 Thread Akens, Anthony

This will work...

 /\[.*?\]/

Does exactly what I needed

Probably more explaination than you wanted, but I felt like sharing :)

Explanations help me learn - maybe someday I'll be able to do these
on my own :)

Rob 

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




RE: getting date from localtime

2002-06-25 Thread Shishir K. Singh

Howdy:

I'm trying to do the following (which may have
been created already) in perl:

* create two variables

var1 = this will be sunday of current week always
var2 = this will be saturday of current week always

I'm not sure how I can use 'localtime' as a tool
for identifying var1 and var2.

I mean, I think I can work around this:

($mday, $mon, $year) = (localtime())[3 .. 5];

Which gives me day-of-month, month and year, but
how to used that as a focal point to get
that saturday and sunday of the current week
without some silly if-then-else loop.

Perhaps I am going about this the wrong way.
It seems like var1 and var2 will actually be
large formulas.

Suggestions?

perldoc -f localtime

element 6 gives the weekday..will that help ??

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




RE: getting date from localtime

2002-06-25 Thread Shishir K. Singh



Howdy:

I'm trying to do the following (which may have
been created already) in perl:

* create two variables

var1 = this will be sunday of current week always
var2 = this will be saturday of current week always

I'm not sure how I can use 'localtime' as a tool
for identifying var1 and var2.

I mean, I think I can work around this:

($mday, $mon, $year) = (localtime())[3 .. 5];

Which gives me day-of-month, month and year, but
how to used that as a focal point to get
that saturday and sunday of the current week
without some silly if-then-else loop.

Perhaps I am going about this the wrong way.
It seems like var1 and var2 will actually be
large formulas.

Suggestions?

perldoc -f localtime
element 6 gives the weekday..will that help ??
Oops..I meant index 6 and not element!!


-- 
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: Dear answerers - sorry

2002-06-25 Thread Richard Adams

Sorry to have incensed many of you with what was a genuine oversight in
omitting a subject.

Richard

 Jenda, et al --
 
 ...and then Jenda Krynicky said...
 % 
 ...
 % I would like to ask all the people who invest their time and answer
 % the questions in this list to ignore the posts whose authors were too
 % lazy to specify a meaningful subject.
 % 
 % If they do not get any reply, they might start wondering why and
 % maybe even come to the right conclusion.
 
 I'm inclined to doubt it, sad though that may be.
 
 I'm more in favor of a gentle flaming at the top of the reply; as an
 added bonus, since most of these yahoos also top-post that's where
 they'll first look for any answer.
 
 
 % 
 % Jenda
 
 
 HAND
 
 :-D

-- 
Dr Richard Adams
Chromosome Structure Group
Room 6.37, Swann Building
ICMB,
University of Edinburgh
Kings Buildings,
Mayfield Rd,
Edinburgh
EH9 3JR UK
Tel 44 131 650 7102
Fax 44 131 650 7028

Email [EMAIL PROTECTED]


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




RE: HElP ...me!

2002-06-25 Thread Kipp, James

Please reply to the list.
is this one record of the file or is this an entire file?
be sure and read the docs for doing this kind of thing:
perldoc -f open
--
basically you want to do something like this. this is enought to get you
started. you won't learn anything if i write it for you. 

open(F, yourfile) or die could not open: $!\n;
while (FH) {
s/^\s+//;  # strip leading spaces
$header = $_  if /HEADER/; # grab header line
$auth = $_  if /AUTHOR/; #grap author line
push (@atom, $_)  if /ATOM/; #push atom lines into an array
...
}

to further parse this and grab what you want like 'code', 'author name' ,
and the atom lines you want
perldoc -f split
perldoc -f substring
perldoc -f grep



 -Original Message-
 From: Baris Ozol [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 10:13 AM
 To: 'Kipp, James'
 Subject: RE: HElP ...me!
 
 
 
 Thanks for reply.. I put a small example of the file .. I just want to
 find header and write as 
 'this is an Oxygen Transport protein isolated at 08-DEC-97 
 and its code
 is 1A00'
  
 And I want to get author name. AS the format I showed you.
  
 And I want to get ATOM (1 by 1) like 'in the 3rd order Atom is C. it's
 located on VAL' and so on.
  
  
 HEADEROXYGEN TRANSPORT08-DEC-97   1A00
 TITLE HEMOGLOBIN (VAL BETA1 MET, TRP BETA37 TYR) MUTANT
 COMPNDMOL_ID: 1;
 EXPDTAX-RAY DIFFRACTION
 AUTHORJ.S.KAVANAUGH,A.ARNONE
 REVDAT   1   18-MAR-98 1A000
 JRNLREFTO BE PUBLISHED
 REMARK 900 1A0X, 1A0Y, 1A0Z, 1A01.
 DBREF  1A00 A1   141  SWSP01922   HBA_HUMAN1141
 SEQADV 1A00 MET B1  SWS  P02023VAL 1 ENGINEERED
 SEQRES   1 A  141  VAL LEU SER PRO ALA ASP LYS THR ASN VAL LYS ALA ALA
 SEQRES   2 A  141  TRP GLY LYS VAL GLY ALA HIS ALA GLY GLU TYR GLY ALA
 SEQRES   4 B  146  ARG PHE PHE GLU SER PHE GLY ASP LEU SER THR PRO ASP
 HELIX   32  32 LEU D   81  THR D   84  14
 HELIX   33  33 ALA D   86  ASP D   94  19
 HELIX   34  34 PRO D  100  GLU D  121  522
 HELIX   35  35 PRO D  124  ALA D  142  119
 LINKFE   HEM A 142 NE2 HIS A  87
 CRYST1   84.100  112.000   63.800  90.00  90.00  90.00 P 21 21 218
 ORIGX1  1.00  0.00  0.000.0
 ORIGX2  0.00  1.00  0.000.0
 ORIGX3  0.00  0.00  1.000.0
 SCALE1  0.011891  0.00  0.000.0
 SCALE2  0.00  0.008929  0.000.0
 SCALE3  0.00  0.00  0.0156740.0
 MTRIX1   1  0.950670 -0.050560  0.3060505.599281
 MTRIX2   1 -0.051200 -0.998670 -0.005940   90.786051
 MTRIX3   1  0.305940 -0.010020 -0.952000  -20.347951
 ATOM  1  N   VAL A   1 101.601  38.534  -1.962  1.00 53.29 N  
 ATOM   4514  OXT HIS D 146  74.219  58.700  -6.876  1.00 18.18 O  
 TER4515  HIS D 146 
 HETATM 4516 FE   HEM D 147  74.555  59.956  11.896  1.00 
 17.05 FE  
 HETATM 4517  CHA HEM D 147  73.915  63.268  12.452  1.00 21.37 C  
 HETATM 4518  CHB HEM D 147  71.553  59.151  13.248  1.00 17.90 C
 HETATM 4774  O   HOH   473  72.622  28.948  11.969  1.00 24.04 O  
 CONECT  650  648  649 1071
 CONECT 1071  650 1076 1087 1095
 MASTER  21704   350009 47704  180   46
 END
 
 -Original Message-
 From: Kipp, James [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, June 25, 2002 9:15 AM
 To: [EMAIL PROTECTED]
 Subject: RE: HElP ...me!
 
 can you tell us how the data is file is formatted currently? also and
 code
 you have done so far. and what you want to do with it?
 
  -Original Message-
  From: Baris Ozol [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, June 25, 2002 9:10 AM
  To: [EMAIL PROTECTED]
  Subject: HElP ...me!
  
  
  Hi everybody,
  
  Hopefully some of you will help to solve my problem!!
  I'm trying to parse a flat file formatted file. It's a PDB 
  (Protein Data
  Bank).
  
  But I didn't find any script on internet and perl.com. 
  If you'll help me, I will be happy and solve the problem..
  
  Thank you.
  
  Bryce
  
  
  
  -- 
  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: Looping Control structures

2002-06-25 Thread drieux


On Monday, June 24, 2002, at 05:10 , Will Shiver wrote:

 black robo

plan A:

my %kombo = (
blue= 'box',
red = 'robo',
purple  = 'rain',
green   = 'box',
black   = 'robo',
);

hence one would read with say

while(FH) {
s/^\s*//;   # strip leading white space
my ($key, $stuff) = split(' ');
print $key $kombo{$key}\n;
}

plan B:
my @type_of_Thing = qw/box robo rain/;
my %kombo_B = (
blue= 0,
red = 1,
purple  = 2,
green   = 0,
black   = 1,
);

hence one would read with say

while(FH) {
s/^\s*//;   # strip leading white space
my ($key, $stuff) = split(' ');
print $key $kombo{$key}\n;
}
$plan = C;

@type_of_Thing = qw/box robo rain/;
my %kombo_C = (
blue= $type_of_Thing[0],
red = $type_of_Thing[1],
purple  = $type_of_Thing[2],
green   = $type_of_Thing[0],
black   = $type_of_Thing[1],
);

hence you would use Plan A's Read

cf:

http://www.wetware.com/drieux/pbl/perlTrick/hashIndirection.txt

ciao
drieux

---


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




Re: getting date from localtime

2002-06-25 Thread drieux


On Tuesday, June 25, 2002, at 07:01 , Johnson, Shaunn wrote:

 ($mday, $mon, $year) = (localtime())[3 .. 5];


have you thought about the off set values of $wday?

my ($mday, $mon, $year,$wday) = (localtime())[3 .. 6];
$year += 1900;
my $k_mon = $mon + 1;

my @day_oh_week = qw/Sun Mon Tues Wens Thur Fri Sat/;

print $mday, $mon, $year,$wday\n;

print $day_oh_week[0] falls on , ($mday - $wday) , \n;
print $day_oh_week[6] falls on , ($mday + (6 - $wday)) , \n;

ciao
drieux

---


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




Weekly posting statistics - 25/2002

2002-06-25 Thread Felix Geerinckx

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

From Monday 2002-06-17 to Sunday 2002-06-23 there were 
559 articles posted (25956 lines) by 116 authors, giving an average 
4.82 articles per author, and an average article length of 46 lpa.
The average number of articles per day was 80.

There were 101 (18%) original articles, and 458 (82%) replies
(articles that started with 'RE:' in their subject line).

41 (35%) authors posted only one article.

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

 All/Ori Lines  lpa  Author

  58/82978   51  [EMAIL PROTECTED] (Drieux)
  30/51961   65  [EMAIL PROTECTED] (Shishir K. Singh)
  29/1 719   24  [EMAIL PROTECTED] (Felix Geerinckx)
  26/01322   50  [EMAIL PROTECTED] (John W. Krahn)
  17/1 525   30  [EMAIL PROTECTED] (James Kipp)
  16/0 597   37  [EMAIL PROTECTED] (Bob Showalter)
  15/8 766   51  [EMAIL PROTECTED] (A Taylor)
  14/0 518   37  [EMAIL PROTECTED] (Jeff 'Japhy' Pinyan)
  13/1 935   71  [EMAIL PROTECTED] (Shawn)
  13/0 776   59  [EMAIL PROTECTED] (Timothy Johnson)

-- 
felix

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




Re: Looping Control structures

2002-06-25 Thread bob ackerman


On Tuesday, June 25, 2002, at 04:59  AM, John W. Krahn wrote:

 Will Shiver wrote:

[...]

 perl -lane'$a{$F[0]}++or$a=qw/box robo rain/[$b++%3];print$F[0] $a' 
 yourfile.txt


 John

sure. almost obviously.
but...
i assume things like '$a' ,'$b', and '$F' come from those switches, so 
only question is...
where are those command line switches documented?
i would have thought 'perldoc perl' ... but, i didn't see it there, nor 
apparently in any other doc title it mentioned


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




Re: Looping Control structures

2002-06-25 Thread Felix Geerinckx

on Tue, 25 Jun 2002 16:45:31 GMT, Bob Ackerman wrote:

 where are those command line switches documented?
 i would have thought 'perldoc perl' ... but, i didn't see it there, nor 
 apparently in any other doc title it mentioned

perldoc perlrun
perlrun - how to execute the Perl interpreter

-- 
felix

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




Re: Looping Control structures

2002-06-25 Thread Jeff 'japhy' Pinyan

On Jun 25, bob ackerman said:

 perl -lane'$a{$F[0]}++or$a=qw/box robo rain/[$b++%3];print$F[0] $a' 
 yourfile.txt

i assume things like '$a' ,'$b', and '$F' come from those switches, so 
only question is...

@F comes from the -a switch used in conjunction with -n.  $a, %a, and $b
are just used.

where are those command line switches documented?
i would have thought 'perldoc perl' ... but, i didn't see it there, nor 
apparently in any other doc title it mentioned

Then you missed:

  perlrun   Perl execution and options

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


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




Useless use of a constant in void context

2002-06-25 Thread Gbio Qi


Hi, Here I have a program called 'emboss.pl', when I run it with perl5.6.1, it gives 
me the following error:

# /compbio/programs/perl-5.6.1/bin/perl5.6.1 emboss.pl
Useless use of a constant in void context at 
/compbio/programs/perl-5.6.1/lib/site_perl/5.6.1/EMBOSS/GUI.pm line 1752.
Content-type: text/html


Does anybody know where it is wrong? Actually I am using this script to make web page, 
If I can not run it correctly, I can not broswer it on the Web broswer.

Here is the emboss.pl:

# more emboss.pl
#!/compbio/programs/perl-5.6.1/bin/perl5.6.1

use CGI;
use EMBOSS::GUI;

my $cgi = new CGI;
print Content-type: text/html\n\n;
init('/compbio/programs/emboss/share/EMBOSS', '/compbio/programs/emboss/bin', 
'/db4/usr/local/www/html_files/html/EMBOSS', 'http://athena
..wistar.upenn.edu/EMBOSS', 'http://athena.wistar.upenn.edu/cgi-bin', 0);
for ($cgi-param(_action)) {
/^mmenu/and do { mmenu($cgi); last; };
/^input/and do { input($cgi); last; };
/^run/  and do { run($cgi); last; };
/^help/ and do { help($cgi); last; };
/^manual/   and do { manual($cgi); last; };
/^search/   and do { search($cgi); last; };
}
print \n;
# 


Thank you very much.

Grace



-
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup


Initializing CPAN

2002-06-25 Thread eric-perl

Hello, All:

Does CPAN use http? I'm using it on a machine that has all ports except
smtp/ssh/http/https blocked. (i.e., ports 22/25/80/443 are the only open
ports)

I've just started using the CPAN module for the first time and am having
some trouble during initialization: The process dies after it attempts to
use lynx to connect to ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz. (It 
tries other methods to connect using ftp first too, but then dies after 
it tries lynx.) (Yes - Lynx is installed and is in the user's path.)

-- 
Eric P.
Los Gatos, CA


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




Just started perl, but have run into a problem

2002-06-25 Thread Robert Warning

Hello Everyone!
Well after using php to help make a couple web pages I needed a
scripting language for client side apps. Since php is best left for web
development I decided to learn perl because php is based on perl and I
thought it would be a fairly easy undertaking to get a good grasp in
perl and it has been so far. My only problem is that when I put
#!/usr/bin/perl at the beginning of any of my programs it wont run. I
get an output from the shell that says /usr/bin/perl: bad interpreter:
Permission denied. I could only run the script if I typed in: perl
PATH_TO_SCRIPT.  Doing what any good linux user would do I checked the
permissions of the perl interpreter. The permissions were set so anyone
could execute it. Then I thought something was wrong with the
interpreter. So I reinstalled perl and it still didn't work. Truly
frustrated I took off the perl interpreter that came with my
distribution, installed Active Perl made a link for the interpreter to
/usr/bin/perl and tried again. Right now I'm stumped. Just in case
anyone wonders I did not write any of my scripts in windows so it would
read the script as /usr/bin/perl\r. Any help would be appreciated.




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




Re: Just started perl, but have run into a problem

2002-06-25 Thread David T-G

Robert --

...and then Robert Warning said...
% 
% Hello Everyone!

Hello!


% Well after using php to help make a couple web pages I needed a
% scripting language for client side apps. Since php is best left for web
% development I decided to learn perl because php is based on perl and I

Good plan :-)


% thought it would be a fairly easy undertaking to get a good grasp in
% perl and it has been so far. My only problem is that when I put
% #!/usr/bin/perl at the beginning of any of my programs it wont run. I

Interesting.


% get an output from the shell that says /usr/bin/perl: bad interpreter:
% Permission denied. I could only run the script if I typed in: perl
% PATH_TO_SCRIPT.  Doing what any good linux user would do I checked the

Well, that says there is a perl out there somewhere, then.  That's good.


% permissions of the perl interpreter. The permissions were set so anyone
% could execute it. Then I thought something was wrong with the

What do you get when you try

  which perl

at your shell prompt?

Use that instead of /usr/bin/perl in your shebang (#!) line and your
script should work just fine.  That first line isn't any perl magic; it
tells the OS how to process the file by pointing it to the interpreter
(in this case, perl, and specifically the perl in /usr/bin, which may or
may not be the one you find by running

  perl scriptname

at the command line).


HTH  HAND

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




msg26556/pgp0.pgp
Description: PGP signature


RE: Just started perl, but have run into a problem

2002-06-25 Thread Bob Showalter

 -Original Message-
 From: Robert Warning [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 25, 2002 2:45 PM
 To: [EMAIL PROTECTED]
 Subject: Just started perl, but have run into a problem
 
 
 Hello Everyone!
 Well after using php to help make a couple web pages 
 I needed a
 scripting language for client side apps. Since php is best 
 left for web
 development I decided to learn perl because php is based on perl and I
 thought it would be a fairly easy undertaking to get a good grasp in
 perl and it has been so far. My only problem is that when I put
 #!/usr/bin/perl at the beginning of any of my programs it wont run. I
 get an output from the shell that says /usr/bin/perl: bad interpreter:
 Permission denied. I could only run the script if I typed in: perl
 PATH_TO_SCRIPT.  Doing what any good linux user would do I checked the
 permissions of the perl interpreter. The permissions were set 
 so anyone
 could execute it. 

It's not the permissions of perl that are the problem, it's the permissions
of your script.

   chmod +x myscript

 Then I thought something was wrong with the
 interpreter. So I reinstalled perl and it still didn't work. Truly
 frustrated I took off the perl interpreter that came with my
 distribution, installed Active Perl made a link for the interpreter to
 /usr/bin/perl and tried again. Right now I'm stumped. Just in case
 anyone wonders I did not write any of my scripts in windows 
 so it would
 read the script as /usr/bin/perl\r. Any help would be appreciated.

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




RE: Initializing CPAN

2002-06-25 Thread eric-perl

On Tue, 25 Jun 2002, Fontenot, Paul wrote:
 Let it have 20 and 21 for ftp

I poked a hole in the firewall to accept all related/established packets
coming *from* ports 20  21 but that didn't work. I seem to recall that
ftp actually uses two different ports for the same dialogue. Can anyone 
refresh my memory on how ftp communicates?

-- 
Eric P.
Los Gatos, CA


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




Re: Useless use of a constant in void context

2002-06-25 Thread Paul Johnson

On Tue, Jun 25, 2002 at 11:07:01AM -0700, Gbio Qi wrote:
 
 Hi, Here I have a program called 'emboss.pl', when I run it with
 perl5.6.1, it gives me the following error:
 
 # /compbio/programs/perl-5.6.1/bin/perl5.6.1 emboss.pl
 Useless use of a constant in void context at 
/compbio/programs/perl-5.6.1/lib/site_perl/5.6.1/EMBOSS/GUI.pm line 1752.
 Content-type: text/html
 
 
 Does anybody know where it is wrong? Actually I am using this script
 to make web page, If I can not run it correctly, I can not broswer it
 on the Web broswer.
 
 Here is the emboss.pl:

The problem is not in emboss.pl, but in EMBOSS/GUI.pm as the error says.
Take a look there and see what you find.  It's a rather large module, so
if you need more help please just post an appropriate snippet.

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

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




cutting files ..!

2002-06-25 Thread Baris Ozol

I wrote a program to cut desired size of files but it is not working. I
added that script. If anyone help me, thank you..

Bryce

use POSIX;  # for ceil

# # # # # # # 

print Please type filename of the DNA sequence data : ;
$filename = STDIN;
chomp $filename;

open FILE, $filename;

@dna = FILE;

# # # # # # # 

print Pls enter max file size (KB): ;
$size = STDIN;
chomp $size;

# # # # # # # 

# $dna = join //, @dna;

# $dna =~ s/[\s\n]//g;

# $dna =~ s/[1]//g;

# @dna = split //, $dna;

# # # # # # # 

my $len = scalar @dna;

my $unit = ceil($len / ($size*1000));

# # # # # # # 

my $j = my $x = 0;

for ($x = 1; $x = $unit; $x++) { 

open (DNA, $x.txt) or die Cannot open $x.txt;

for ($j ; $j  (($size*$x*1000)); $j++) {

print DNA @dna[$j];

}

close (DNA);

}



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




Re: search-engine, searching for 2 words

2002-06-25 Thread Robert Thompson

 So in short :
 I want to match 2 words within .txt documents, if the document contains BOTH words 
I'dd like to print it.

I am assuming you mean strings, whereas a word would be surrounded by space 
ala: /\s$word\s/. To rephrase what you want a little, you want to track how many times 
string one is found in a file, track how many times string two is found in the same 
file, and keep the file only if both strings are found in the file.

while (INFILE) {
  if ($_ =~ /$string1/i) {
++$found{$file}{1};
  }

  if ($_ =~ /$string2/i) {
++$found{$file}{2};
  }
}

if ( ($found{$file}{1} = 1)  ($found{$file}{2} = 1) ) {
  push(@matches, $file);
}

Each filename must be unique, since they are used as the keys for the hash.


=-= Robert T.

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




Re: Debugging the debugger

2002-06-25 Thread Paul Johnson

On Mon, Jun 24, 2002 at 10:10:38PM -0700, Harry Putnam wrote:

 The documentation in TERM::Readline at ENVIRONMENT reads like maybe
 some kind of cut and paste editing went wrong or something.  It reads
 like gibberish.  The usage of the words `head' `tail' and `ornaments'
 is confusing to the point of being seemingly meaningless. 
 
 I suspect there was some sort of undetected editorial mishap
 there. or maybe a language translation problem.

Possibly both.  I'm not certain, but the wording may have come from a
rather brilliant Russian mathematician and Regular Expression expert.

The text is still there in the latest release candidate for Perl 5.8.0.
If anyone feels like saving the world, now would be a very good time to
do it.  In other words, documentation patches are still being accepted.

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

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




Re: Just started perl, but have run into a problem

2002-06-25 Thread Todd Wade

Robert Warning wrote:

 Hello Everyone!

Greetings

 ... My only problem is that when I put
 #!/usr/bin/perl at the beginning of any of my programs it wont run. I
 get an output from the shell that says /usr/bin/perl: bad interpreter:
 Permission denied. I could only run the script if I typed in: perl
 PATH_TO_SCRIPT

Sounds like the script isnt executeable by you.

Todd W


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




CPAN: install Bundle::CPAN

2002-06-25 Thread eric-perl

Hello, All:

This is my first time using the CPAN module.

While using CPAN to download/install a module, CPAN reported that I should
run 'install Bundle::CPAN' to get the latest stuff. When I entered 
'install Bundle::CPAN' it went about it's business getting and make'ing 
and started asking about where to install _all_kinds_of_stuff_...

What the heck is Bundle::CPAN? What is going on? It seems like it's 
installing a completely new version of Perl or something. (It wanted to 
know where my C compiler is and where it should install stuff!!!)

-- 
Eric P.
Los Gatos, CA


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




Re: Embedded Perl

2002-06-25 Thread Todd Wade

Nigel Peck wrote:

 I'm interested to know what solutions people use/like for embedding Perl
 in HTML/XML documents to be processed by the web server (like PHP and
 ASP), for Apache. I like the fact that the syntax for PHP is ? ... ?
 (it complies with XML) and would like to be able to do it using my Perl
 skills instead of learning PHP.
 
 Is embperl the one to use?
 

I suggest ASP or AxKit. both need a mod_perl enabled Apache.

AxKit is better, way better, as far as features go. But ASP is simple and 
straightforward and you said you are already familiar with it.

Todd W

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