Re: starting perl

2004-05-03 Thread fliptop
On Sun, 2 May 2004 at 15:00, Charlie davis opined:

Cd:But when I type what it says in the book I am getting an error
Cd:messagethat states that I have entered a bad command or filename what I
Cd:am entering is c:\ perl -w -e print \ Hello, World!\n\; And then I
Cd:get the error message.
Cd:
Cd:I must be doing something wrong but I can not figure out what  it is.

what is the error message?  posting that always helps us help you.

from a casual glance, i'd say the 1st escaping backslash should not have a 
space after it (you want to escape the double quote, not the space).


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: calculating election day

2004-02-05 Thread fliptop
On Tue, 3 Feb 2004 at 17:42, Chad A Gard opined:

CAG:I'm attempting to dynamically place an image into the user interface
CAG:of an intranet site to celebrate various holidays.  It's really not

this doesn't really have anything to do with cgi, but if you read the 
recipes for Date::Calc, you should be able to figure it out.

http://search.cpan.org/~stbey/Date-Calc-5.3/Calc.pod


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: cgi_lib'maxdata

2003-10-28 Thread fliptop
On Tue, 28 Oct 2003 at 10:52, [EMAIL PROTECTED] opined:

:On martedì 28 ottobre 2003, alle 10:15, SRef wrote:
: Why not try before you ask ?
:
:I though this mailing list was for beginners, and as I've started using
:CGI Perl just a week ago, I'm not still so able to send POST oversized
:for an hacking attack, to try my scripts. I searched the net for the
:informations I asked about, but wasn't able to find any more than what I
:wrote in my mail. So thnaks for your hint, I tried anything I was able
:to try, then I asked the mailing list for an help.

if you're a perl cgi beginner, you should be using the CGI.pm module.

http://search.cpan.org/~lds/CGI.pm-3.00/

read the documentation about the $CGI::POST_MAX variable.  it's used to 
limit the amount of data that can be posted.


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



Re: POSIX 'strftime' and time zones

2003-10-01 Thread fliptop
On Tue, 30 Sep 2003 at 23:57, David Gilden opined:

DG:How can I add two hours to offset for central time?

try date::calc

http://search.cpan.org/~stbey/Date-Calc-5.3/

you'll probably want to use the Add_Delta_Days() function.


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



Re: Still Not sure if I agree with myself.

2003-09-12 Thread fliptop
On Thu, 11 Sep 2003 at 14:13, drieux opined:

[snip]
d:  sub should { defined($REQ_PARAMS-{$_[0]}); }
d:  
d:  sub doDaemon {
d:  
d:  }
d:  sub kickDaemon { $me=shift; $me-doDaemon(@_); }
d:  # the synonym trick...
d:
d:Which still gives me a HASH to manage, plus the actual Sub.

true, but you can use the hash for more than just a way to determine if a
called method exists.  for an example, take a look at my form checker
tutorial:

http://www.peacecomputers.com/form_checker/

you'll see the %REQ_PARAMS hash lists each parameter it expects to receive
for every action, and also provides some basic criteria that each
parameter must pass to be considered acceptable.


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



Re: Still Not sure if I agree with myself.

2003-09-11 Thread fliptop
On Mon, 8 Sep 2003 at 15:36, drieux opined:

drieux - since no one has responded, i'll take a stab at some of the 
issues you bring up.

d:One of my first question is - why the 'closure' eg:
d:
d:{
d:  package FOO;
d:  
d:}
d:
d:Or is that simply to make 'clear' that outside of
d:the Closure it is still package 'main'???

from 'programming perl, 3rd edition', page 260:

closure gives us a way to set values used in a subroutine when you define 
it, not just when you call it

so while i can see a reason for using closure like this:

{
  my %REQ_PARAMS = {
action1 = { # some specifications for action1 },
action2 = { # some specifications for action2 },
etc
  };

  sub req_params {
return $REQ_PARAMS{shift-action};
  }
}

i'm not sure what the benefit of putting the whole damn package inside a 
closure is.  perhaps someone else can provide a reason or example of its 
benefits?

d:Which leads me to my second set of question,
d:
d:  as a general habit I tend to make 'private-ish' methods
d:  with the _ prefix such as
d:
d:  sub _some_private_method {  }
d:
d:is there some 'general access' mechanism by which one can
d:ask for the LIST of all methods that an 'object' CanDo???

not that i know of.

d:Or should one have a 'register_of_parser_methods' approach
d:that one can query?

i would guess most people probably list the available (public) methods in
the pod documentation.


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



Re: Still Not sure if I agree with myself.

2003-09-11 Thread fliptop
On Thu, 11 Sep 2003 at 07:55, drieux opined:

d:simply because
d:
d:  $obj-can($do);
d:
d:does not mean
d:
d:  $obj-should($do);
d:
d:The problem I am looking for in my should() method
d:is a programatic way to solve Which Method to invoke
d:the correct sub to deal with a query string. I have
d:a tough enough time keeping my code in line as it is,
d:I really do not want it to be reading POD when it should
d:be working and generating HTML 8-)

the way i do it is to assign an action to each form.  each action has 
associated parameters.  the form sends the action in an input 
type=hidden tag.

d:
d:My traditional trick is of the form
d:  
d:  my $qs = make_hash_of_query_string($request);
d:  my $actions = {}; # the hash of subs
d:  my $callForm = $qs-{'callForm'} || 'main_display'; # get the callForm 
d:parameter
d:
d:  my $page = (defined($action-{'callForm'}) ? # is it defined
d:  $action-{'callForm'}-($qs) :
d:  main_display($qs);
d:
d:Which of course requires me to maintain the Hash of $actions
d:so that I 'register' by hand, each of the Subs that SHOULD
d:be used in the cgi code. A problem that I do not escape
d:if I have to maintain a similar list of which 'callForms'
d:are legitimate tokens to be returned from the browser.

another way is to check the list of acceptable 'actions' in the module
constructor, then if you pass an action method that's not defined, return
an error.  for example:

package Foo;
use Carp;

{
  my %REQ_PARAMS = (
action1 = { # criteria for action 1 },
action2 = { # criteria for action 2 },
etc...
  );

  sub req_params {
return $REQ_PARAMS{shift-action};
  }
}

sub new {
  my ($class, %args) = @_;

  croak missing action arg unless defined $args{action};

  my $self = bless {
_ACTION = $args{action}
  }, $class;

  croak method $args{action} not found unless $self-req_params;

  return $self;
}

sub action { shift-{_ACTION} }


then in your script:

#!/usr/bin/perl -w

use Foo;

my $f1 = Foo-new( action = 'action2' ); # works ok
my $f2 = Foo-new( action = 'action6' ); # shits the bed



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



Re: Counter triggered on download

2003-08-26 Thread fliptop
On Sun, 24 Aug 2003 at 03:04, zsdc opined:

z:fliptop wrote:
z:
z: merrill - i'm a little late on this thread, and the other suggestions are
z: valid, but here's one way to serve up files w/o using a direct link by
z: taking advantage of CGI.pm's header() function:
z: 
z: my $cgi = new CGI;
z: print $cgi-header('application/pdf');
z:
z:Actually, it's the same as just:
z:
z:   print Content-Type: application/pdf\n\n;
z:
z:CGI.pm is great but it's an overkill for just printing HTTP Content-Type 
z:header.

that is true, however i cut the code out of a script i had handy.  the
params are passed in as such:

/cgi-bin/mime.cgi?filename=whatevermime_type=application%02Fpdf

so the full file looked something like this:


use CGI;

my $cgi = new CGI;
my $filename = $cgi-param('filename');
my $mime_type = $cgi-param('mime_type');

print $cgi-header($mime_type);

open OUT, $filename;
my $buffer;

while (my $read = read(OUT, $buffer, 4096)) {
  print $buffer;
}

close OUT;




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



Re: Counter triggered on download

2003-08-26 Thread fliptop
On Tue, 26 Aug 2003 at 00:31, Octavian Rasnita opined:

OR:This is a pretty good method, but it is not so good because the
OR:visitors won't be able to use a Download manager to download the file.
OR:Or better said, they won't be able to resume the download.

true, however the original poster asked how to increment a counter when a
file is downloaded.  they did not pose the question of how to do it *and*
allow the user to use download manager or resume the download if it became
interrupted.

OR:I am not sure, I will be testing this soon, but maybe a solution for
OR:this problem could be specifying the Content-length of this file as a
OR:HTTP header.
OR:
OR:This way the browsers and the download managers will be able to send
OR:the Range HTTP header and the web server will accept it.

be sure to share your results.


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



Re: Counter triggered on download

2003-08-23 Thread fliptop
On Wed, 20 Aug 2003 at 13:29, Merrill Oakes opined:

MO:I have a link to a PDF file on a web page.  I want to count how many 
MO:times that someone clicks on the link (i.e. downloads the PDF).  The 
MO:easy way (at least for me) would be to make them go to a download page 
MO:first, and I could put a counter in the page, BUT this requires an extra 
MO:step for the user.
MO:
MO:SO, is there any way to:#1. monitor how many a times a file has been 
MO:downloaded, or maybe #2. have them click on a link (that is really a cgi 
MO:script, that then increments the counter then starts the download/open 
MO:of the PDF?  Of course this last method will disable the ability to do a 
MO:shift-click to download the doc.

merrill - i'm a little late on this thread, and the other suggestions are
valid, but here's one way to serve up files w/o using a direct link by
taking advantage of CGI.pm's header() function:

my $cgi = new CGI;

print $cgi-header('application/pdf');

open OUT, '/path/to/some/pdf/file';
my $buffer;

while (my $read = read(OUT, $buffer, 4096)) {
  print $buffer;
}

close OUT;

# insert code here to increment the counter


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



Re: Why executable?

2003-08-14 Thread fliptop
On Mon, 11 Aug 2003 at 22:36, Octavian Rasnita opined:

[snip]
OR:I've tried chmodding the perl script to 755, and I've tried running it
OR:with:
OR:
OR:$ script.pl
OR:
OR:...but it didn't want to run, telling me that there is no command
OR:script.pl, even though the script has a shebang line in it.

you may want to try it again by specifying './script.pl' because if the 
directory '.' is not in your PATH, it won't find the file.


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



Re: File uploading

2003-07-18 Thread fliptop
On Fri, 18 Jul 2003 at 12:03, Mike Harrison opined:

MH:I have a perl program that allows a user to upload a file (either .jpg or
MH:.gif) to the server, and returns a message if it exceeds a specified size
MH:(in my case 100kB).  Currently (and don't laugh - I am new to perl), I go
MH:through the motions of uploading the file in 1024-byte blocks (in binary
MH:mode), and increment a counter with each block.  If the counter exceeds 100
MH:(i.e. greater than 100kB), then it exits the loop, displays a warning
MH:message and deletes the file.
MH: 
MH:I am sure there would have to be an easier and more efficient way of doing
MH:this - that is, somehow finding out how large the file is without having to
MH:download it first.
MH: 
MH:Does perl have a module that can check the size of the file?  And for that
MH:matter, its type (.jpg, .gif etc.)?

hi mike - CGI provides a way to indicate if an form post exceeds a
pre-determined size limit.  it's the $CGI::POST_MAX variable, and if you
wanted to limit uploads to 100kbytes (for example), you'd do something
like this:

use CGI;
$CGI::POST_MAX = 100 * 1024;

my $cgi = new CGI;

if ($cgi-cgi_error) {
  # alert the user their post exceeded the limit
  exit();
}

you can find out more information by reading

perldoc CGI


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



Re: File uploading

2003-07-18 Thread fliptop
On Fri, 18 Jul 2003 at 23:46, Mike opined:

M:What if I now want to upload 2 files.  The first can be up to 100k in size
M:and the second up to 80k in size?  That is pretty much the way I have it set
M:up at the moment...
M:
M:Or should I admit defeat at this stage and allow 2 files to be uploaded that
M:have a combined size of 180k maximum?

since $CGI::POST_MAX examines the overall size of the entire post, there
wouldn't be a way to use it to determine sizes of multiple files
individually.  in this case, you'd have to split the uploads into 2 forms,
or use one of the other methods that were suggested to examine each file 
on its own.


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



Re: multipart form data

2003-07-16 Thread fliptop
On Tue, 15 Jul 2003 at 17:30, Anshuman Kanwar opined:

[snip]
AK:So it sees the filename but not the data itself. Problem is that I want to
AK:save the Jpg pictures in some other files and the
AK:BOTZSERIAL=00:02:D3:00:01:01 type info in some other file, but I am not
AK:seeing the binary (jpg) data at all. How do I extract the .jpg files from
AK:this POST?

you need to use upload() instead of param() to read the image.  please
read perldoc CGI for more information and examples.


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



RE: Problems getting a simple form to work.

2003-04-04 Thread fliptop
On Fri, 4 Apr 2003 at 16:29, Mike Butler opined:

MB:Thanks, Andrew. I added CGI::Carp qw(fatalsToBrowser); to the script. That's
MB:a big help. The error message that I get now is:
MB:Software error:
MB:Undefined subroutine main::param called at simpleform.cgi line 6.
MB:
MB:Line 6 is my $username = param('username');
MB:
MB:Any idea why param is undefined?

you should reread the docs for CGI:

 use CGI;
 $q = new CGI;
 print $q-header;
 print $q-param('username');

 etc.

OR

 use CGI qw/:standard/;
 print header;
 print param('username');

 etc.

when you import the standard functions into your namespace, you don't need 
to create the CGI object.  you *can't* do this:

 use CGI;
 print header;
 print param('username');

which i think is what you were originally trying to do.

perldoc CGI

or, if you don't have access to a shell try

http://search.cpan.org/author/LDS/CGI.pm-2.91/CGI.pm



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



Re: Net::LDAP.pm

2003-03-11 Thread fliptop
On Tue, 11 Mar 2003 at 11:49, Susan Aurand opined:

SA:Hello, Can anyone tell me why I am receiving an error can't locate
SA:Net/LDAP.pm in @ INC (@INC includes /usr/lib/perl5/5.6.1 etc, etc etc,
SA:etc.

is net::ldap installed?



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



Re: CGI.pm strange results

2003-03-04 Thread fliptop
On Tue, 4 Mar 2003 at 08:12, Todd W opined:

TW:my( $string ) = you ordered $q-param('quantity') foobars\n;
TW:
TW:The quoting mechanism knows nothing about evaluating expressions. That's
TW:what concatenation is for:
TW:
TW:my( $string ) = you ordered  . $q-param('quantity') .  foobars\n;

or sprintf:

my $string = sprintf you ordered %d foobars, $q-param('quantity');


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



Re: Learning Perl

2003-02-28 Thread fliptop
On 28 Feb 2003 at 05:31, Randal L. Schwartz opined:

RLS: WilliamGunther == WilliamGunther  [EMAIL PROTECTED] writes:
RLS:
RLS:WilliamGunther I think Programming Perl is good for learning. There
RLS:WilliamGunther is a book also called Learning Perl from O'Reilly, but
RLS:WilliamGunther really I don't feel there is a suitable enough reason
RLS:WilliamGunther to pay a lot of money for it, especially since you
RLS:WilliamGunther have Programing Perl already.
RLS:
RLS:There are some who would disagree here. :)
RLS:
RLS:Buy a copy of Learning Perl.  If it's the money you're concerned
RLS:about, borrow a copy, or buy a copy and resell it.  We worked hard to
RLS:design Learning Perl to be the best book to spend your first 30-40
RLS:hours while learning the language, no matter where you will be using
RLS:Perl eventually.

i have to agree with randal here - programming perl is a reference
textbook, and probably isn't the best choice to help you learn how to
write perl programs in a step-by-step fashion.  learning perl, otoh, was
written specifically for this purpose, and toward that end is a much
better resource.

i recently donated my copy of learning perl to my local library, so that
could be another option for you to obtain it without paying (if desired).


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



Re: MySQL won't GRANT ALL ON cookbook.* ... ERROR 1044

2003-02-24 Thread fliptop
On Sun, 23 Feb 2003 at 20:09, Ed Sickafus opined:

ES:Server: Linux (RedHat 7.2) Apache 1.3.x
ES:I'm trying to run an introductory exercise out of MySQL Cookbook by Paul
ES:DeBois
ES:Accessing MySQL from a PC via PuTTY to ISP's UNIX
ES:I can get to the mysql prompt but no further.
[snip]

since your question has nothing to do with cgi, it would be better asked
on the dbi mailing list:

http://www.perl.com/pub/a/language/info/mailing-lists.html#db

or perhaps one of the mysql mailing lists:

http://www.mysql.com/documentation/lists.html


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



RE: php like behavior for my perl CGI

2003-02-20 Thread fliptop
On Thu, 20 Feb 2003 at 09:41, Peter Kappus opined:

[snip]
PK:Quite ingenious.  While I'm sure I'll regret it later (and curse your good
PK:name as I'm wishing I'd taken the time to learn Mason or HTML::Template)
PK:this seems like a great quick fix for the time being.  And it never hurts to
PK:learn a few new tricks!

mason and html::template are (imho) not similar.  mason is a mechanism for
embedding perl in your html (similar to the way php works), while
html::template is a way to dynamically stuff scalars and arrays into
static html files.

based on your original question, mason is probably more close to what your 
looking for as a php replacement than html::template is.

of course, you could probably use mason to call a cgi that outputs an
html::template, but i digress.


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




Re: Ping Results

2003-01-30 Thread fliptop
On Thu, 30 Jan 2003 at 08:33, Mike Blezien opined:

MB:trying to put together a simple 'ping' display via the browser... and
MB:not having any luck... how does one get the results of a ping to diplay
MB:the results properly ??

http://search.cpan.org/author/BBB/Net-Ping-2.28/lib/Net/Ping.pm

don't reinvent the wheel.


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




[OT] RE: Search database problem.

2003-01-18 Thread fliptop
On Sat, 18 Jan 2003 at 17:45, Hughes, Andrew opined:

[reply cc'd to list]

HA:DBD::mysql::db do failed: Duplicate entry '[EMAIL PROTECTED]' for
HA:key 2 at nCSSW.pl line 787.
HA:
HA:I know that you tried to point me in the right direction with the code
HA:snippet that you suggested.  However, as I am relatively new to all this, I
HA:cannot seem to make use of the error and perform decisions in the script
HA:based on it.

[snip]

HA:Can anyone offer any suggestions on where I can find info on how to retreive
HA:a database error message and make decisions on it in this context?

wrap your execute() inside an eval, then examine $@.  see below:

HA:eval {
HA:  $sth-execute('[EMAIL PROTECTED]');
HA:};
HA:
HA:if ($@) {
HA:  warn error - probably a violation of the unique constraint;
HA:  # return something to the user
HA:}
HA:else {
HA:  $dbh-commit;
HA:}

btw, this subject is off-topic for this list.  if you are still having
problems, you probably should post your questions to a more appropriate
list.  perhaps perusing http://dbi.perl.org/ will yield a better forum for
your questions.


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




RE: cgi.pm generate html vs. print EndOfHTML;

2003-01-17 Thread fliptop
On Thu, 16 Jan 2003 at 16:32, Hughes, Andrew opined:

HA:I am pointing to the results.tmpl file which is in the same folder as the
HA:the .pl script.  I found another test script on the web on another website,
HA:and I have the same problem -- the tags are not replaced with the
HA:information in the script.  Could it be a permission issues on the .tmpl
HA:file or the .pl file?

you need to point to the perl script, not the template file.


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




RE: cgi.pm generate html vs. print EndOfHTML;

2003-01-17 Thread fliptop
On Fri, 17 Jan 2003 at 14:29, Hughes, Andrew opined:

HA:My problem had to do with the content header.  I also did not realize that
HA:you are supposed to point the .pl file in the browser.  Rookie mistakes!
HA:
HA:As far as the TMPL_VAR tags, all of the tutorials that I have seen look
HA:like this TMPL_VAR NAME=SECRET_MESSAGE -- as opposed to TMPL_VAR
HA:SECRET_MESSAGE.

it can be done either way:

#!/usr/bin/perl -w

use strict;
use HTML::Template;

my %data = (
  ONE = 'one',
  TWO = ' /two'
);

my $template = HTML::Template-new(filename = 'onetwo.tmpl');
$template-param(%data);
print Content-type:  text/html\n\n;
print $template-output;


if 'onetwo.tmpl' contains either the following:

TMPL_VAR ESCAPE=HTML ONE
TMPL_VAR ESCAPE=URL TWO

or this:

TMPL_VAR ESCAPE=HTML NAME=ONE
TMPL_VAR ESCAPE=URL NAME=TWO


the output is always:

Content-type:  text/html

amp;one
%20%2Ftwo


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




Re: Search database problem.

2003-01-17 Thread fliptop
On Fri, 17 Jan 2003 at 17:10, Hughes, Andrew opined:

[snip]
HA:The goal is that before I submit a form submission to the database, I want
HA:to make sure that someone with the same email address has not already
HA:submitted it.  If the count(*) brings up anything greater than 0 then the
HA:users has already submitted an entry and receives the Duplicate Entry
[snip]

why don't you put a unique index on the email field?  that will prevent 
duplicate records and save you a lot of overhead using perl to check for 
uniqueness.

then, when you go to insert a new record, wrap it in an eval {}.  if $@ 
contains something after the insert attempt, it's probably because the 
unique index constraint was violated.

for example:

my $sth = $dbh-prepare('insert into (foo) values(?)');

eval {
  $sth-execute('[EMAIL PROTECTED]');
};

if ($@) {
  warn error - probably a violation of the unique constraint;
  # return something to the user
}
else {
  $dbh-commit;
}


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




RE: cgi.pm generate html vs. print EndOfHTML;

2003-01-16 Thread fliptop
On Thu, 16 Jan 2003 at 11:49, Hughes, Andrew opined:

HA:Thanks for the feedback.  Before I get started on the html::template
HA:tutorial, I wanted to try a quick sample page using html::template.
HA:However, when I try it, I cannot get the tag in the html to process.  Could
HA:someone take a look and let me know what you think I am doing incorrectly?
HA:
HA:my $template = HTML::Template-new(filename = 'results.tmpl');
HA:$template-param(SECRET_MESSAGE = $bar);

you should probably

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

here.

HA:print $template-output;
HA:
HA:
HA:
HA:This is the .tmpl file:
HA:
HA:!-- results.tmpl --
HA:html
HA:head
HA:titleUntitled Document/title
HA:meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
HA:/head
HA:
HA:body bgcolor=#FF text=#00
HA:h1Hello TMPL_VAR NAME=SECRET_MESSAGE/h1
HA:
HA:/body
HA:/html
HA:
HA:
HA:
HA:When I view the source of results I see the tag TMPL_VAR
HA:NAME=SECRET_MESSAGE where I expect to see World.

are you pointing to the perl script with your browser (and not the
template file)?



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




Re: Retriving a file using cgi posted from a html form

2003-01-15 Thread fliptop
On Wed, 15 Jan 2003 at 22:32, LRMK opined:

L:how do I retrieve  save files that has been posted from a Html form to
L:my cgi script.

have you read 'perldoc CGI'?

L:please send a piece of example code

from 'perldoc CGI' (for a plain text file):

 $fh = $query-upload('uploaded_file');
while ($fh) {
  print;
}


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




Re: Retriving a file using cgi posted from a html form

2003-01-15 Thread fliptop
On Wed, 15 Jan 2003 at 22:32, LRMK opined:

L:how do I retrieve  save files that has been posted from a Html form to
L:my cgi script.

have you read 'perldoc CGI'?

L:please send a piece of example code

from 'perldoc CGI' (for a plain text file):

 $fh = $query-upload('uploaded_file');
while ($fh) {
  print;
}


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




RE: how to print mysql table to text file backup with perl

2003-01-07 Thread fliptop
On Mon, 6 Jan 2003 at 20:44, Hughes, Andrew opined:

HA:That makes a lot of sense.  If I strip out the pipes, tabs, hard returns
HA:etc. going into the database table, do you think that I should be okay not
HA:using the module?

why waste your time?

the csv modules already on cpan do it all for you.  don't reinvent the 
wheel.


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




RE: how to print mysql table to text file backup with perl

2003-01-06 Thread fliptop
On Mon, 6 Jan 2003 at 15:11, Hughes, Andrew opined:

HA:my $filename = out.txt;
HA:open(OUTFILE,$filename);
HA: $stmt = qq { select * from 2002brochurecontest };
HA: $sth = $dbh-prepare ($stmt);
HA: $sth-execute ();
HA: $count = 0;
HA: while (my $row = $sth-fetchrow_hashref())
HA:{
HA:print OUTFILE
HA:$row-{id}|$row-{t}|$row-{f_name}|$row-{l_name}|$row-{w_phone}|$row-{w
HA:_phone_ext}|$row-{division}|$row-{email}|$row
HA:-{eclub}|$row-{country}|$row-{brochure}|$row-{purchase}\n;
HA: }
HA:$sth-finish();
HA:close(OUTFILE);

that's fine, but what if your data contains pipes?  you should look into 
one of the csv modules on cpan.  here's one i've used in the past with 
good success:

http://search.cpan.org/author/JWIED/Text-CSV_XS-0.23/CSV_XS.pm

by default, it uses a comma, but you can specify any character to use as 
the delimiter.


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




Re: Confusion on @array vs $array[] vs $array

2002-12-19 Thread fliptop
On Wed, 18 Dec 2002 at 13:49, kevin christopher opined:

kc:Hope this doesn't further belabor the issue, but just to put my 
kc:two cents in, Perl syntactic rules for prefixing $, @, % are 
kc:very consistent, IMHO: You just need to keep in mind the types of 
kc:the values/data types ultimately being expressed, and it should 
kc:become clearer. $ always prefixes scalars or references, @ 
kc:always prefixes lists, and % always prefixes associative arrays 
kc:(a.k.a hashes).
kc:
kc:@array is a list
kc:$array[n] is a scalar/reference 
kc:%hash is a hash
kc:$hash{'key'} is a scalar/reference
kc:@$ref dereferences a reference to an array, accessing the array In 
kc:this case, print $ref; would give you a reference scalar, 
kc:something like ARRAY(0x4E3FB1C); print @$ref; would output the 
kc:actual array list.
kc:
kc:Also try @hash{keys %hash}, which returns a list of the hash's 
kc:values.

i hope everyone realizes that all this will be changed in perl 6.  here's
a snippet from a slideshow by damian conway from the summer 2001:

Access through...Perl 5  Perl 6
Array variable $foo[$idx]  @foo[$idx]
Array slice@foo[@idxs] @foo[@idxs]
Hash variable  $foo{$key}  %foo{$key}
Hash slice @foo{@keys} %foo{@keys}
Scalar variable$foo$foo
Array reference$foo-[$idx]$foo.[$n]
Hash reference $foo-{$key}$foo.{$key}
Code reference $foo-(@args)   $foo.(@args)

the complete slideshow can be found here as a pdf document:

http://dev.perl.org/perl6/talks/Perl6-Notes-200108.v2.pdf

it was also reported in the p6p digest from august 5-11, 2001:

http://www.perl.com/pub/a/2001/08/p6pdigest/20010811.html


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




Re: Perl 6 (was: Re: Confusion on @array vs $array[] vs $array)

2002-12-19 Thread fliptop
[reply cc'd to list]

On Thu, 19 Dec 2002 at 06:23, Rob Richardson opined:

RR:What is the advantage of these changes?  
RR:When is Perl 6 due out?
RR:Do those links you provided describe all the differences we will see in
RR:Perl 6?

i'm no authority on perl 6, so i can't answer any of your questions.  to
keep up with what's happening, your best bet is to subscribe to one of the
perl 6 mailing lists.  you may want to start here:

http://www.perl.org/support/mailing_lists.html


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




Re: Installing CGI.pm in RedHat 8.0.

2002-12-10 Thread fliptop
On Tue, 10 Dec 2002 at 06:51, Admin-Stress opined:

A:I dont know why, in my OTHER RedHat 8.0 installation, I cant find
A:CGI.pm. I did install perl5.8.0.
A:
A:Anyone know how to install it? I looked in cpan, it seems it's default
A:perl module. And I cant find any installer for it.
A:
A:Is it OK if I just copy CGI.pm from cpan? into 
A:
A:/usr/lib/perl5/5.8.0/CGI.pm
A:
A:but, what is /usr/lib/perl5/5.8.0/CGI ? Because I saw in my other redhat
A:8.0 box there are two files :
[snip]

rpm -qa | grep CGI


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




Re: cgi session

2002-12-05 Thread fliptop
On Thu, 5 Dec 2002 at 10:39, Admin-Stress opined:

[snip]
A:I just want to make a 'secure site' that need username and password. So, the first 
page of my site
A:would be fill in you username and password, for example, it will be placed here :
A:
A:   http://www.mydomain.com/login.html
A:
A:After that, I will call /cgi-bin/checkpasswd.pl, if OK then user will be transfered 
to another
A:page, e.g.: 
A:
A:   http://www.mydomain.com/welcome.html
A:
A:My question, how can I make sure that ONLY ppl passed checkpasswd.pl can see that 
welcome.html
A:(and the rest of page). It should be about checking 'session' or some other trick 
... 
[snip]

can't you use an .htaccess file?


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




Re: 5.005_03 vs. 5.8

2002-12-03 Thread fliptop
On Mon, 2 Dec 2002 at 21:28, Scot Robnett opined:

SR:I am working with a university on a web project which entails setting up a
SR:new server. We're going with Red Hat Linux on Dell hardware (RAID 5
SR:configuration), but I am not sure which version of Perl to recommend. I am
SR:very used to 5.005_03, but 5.8 is the current release.
SR:
SR:Do I have a large learning curve associated with going the 5.8 route as
SR:opposed to 5.005_03?
SR:
SR:If I want to port scripts, will they need to be rewritten?
SR:
SR:Are there significant benefits to using 5.8?
SR:
SR:On one hand, I want to keep up with the Joneses and take advantage of the
SR:most available power, but on the other hand, I'm used to one flavor and you
SR:know what they say about fixing things that ain't broke.
SR:
SR:Opinions, comments, suggestions?

if you're using redhat linux, i'd recommend using whatever rpm they have.  
for rh7.3, the current perl is 5.6.1.  for rh8, it's 5.8.0.

i've been using rh7.3 with the stock rpm's for perl, mod_perl and apache 
for some time now without any problems.  and the mod_perl is compiled in 
as a dso, something that was problematic before.

a good place to learn about the new features of the latest perl release is 
on perl.com:

http://www.perl.com/pub/a/language/info/software.html


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




Re: Checking for existance for data in a column

2002-12-03 Thread fliptop
On Tue, 3 Dec 2002 at 09:36, T. Murlidharan Nair opined:

TMN:any calculations on them obviously.  How do I check whether
TMN:the column contains data, once I have retrived all the  data
TMN:using fetchrow_hashref().

you probably should ask on a dbi list.

http://www.isc.org/services/public/lists/dbi-lists.html


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




Re: clarification scrolling list (code incl)

2002-11-24 Thread fliptop
On Sun, 24 Nov 2002 at 09:40, Ramon Hildreth opined:

RH:Hi,
RH:This is a clarification of a previous question about a scrolling list.
RH:here is my code:
RH:--
RH:city name, scrollinglist( -name=city,
RH: -override='1',
RH: -values=@cities,
RH: -multiple='1',

you need to reread the documentation.  type

perldoc CGI

and go to the section titled CREATING A SCROLLING LIST.  you're not 
calling the correct method, and you're supposed to pass an array ref.


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




Re: multiple selection

2002-11-23 Thread fliptop
On Fri, 22 Nov 2002 at 15:56, Mike(mickako)Blezien opined:

M:   @lists = split(/ /,param('list'));

from perldoc CGI:

FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER:

   @values = $query-param('foo');

 -or-

   $value = $query-param('foo');



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




Re: libwww example / tutorial

2002-11-23 Thread fliptop
On Sat, 23 Nov 2002 at 05:07, Admin-Stress opined:

A:   if ($res-is_success) {
A:  print $res-content;
A:   } else {
A:  print Error:  . $res-status_line . \n;
A:   }
A:
A:What is the variable type of $res-content ? is it Array? Because it
A:just dumped the output (multiple lines), I need to parse line by line.

you can find out by

print ref $res-content;



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




Re: Non-caching META-tags

2002-11-21 Thread fliptop
On Wed, 20 Nov 2002 at 13:58, Michael Kelly opined:

MK:On Wed, Nov 20, 2002 at 02:02:05PM +, Nick Malden wrote:
MK:
MK:CGI.pm doesn't support http-equiv meta-tags, according to the documentation.
MK:What about something as simple as:

what?  snippet from perldoc CGI:

To create an HTTP-EQUIV type of meta tag, use -head, described below.



And here's how to create an HTTP-EQUIV meta tag:

print start_html(-head=meta({-http_equiv = 'Content-Type',
  -content= 'text/html'}))


the error associated with the original post's code was due to the fact 
that the syntax was not correct.  the solution that CGI.pm provides means 
that, even if the syntax is corrected, it still won't work.  use the -head 
method described in the CGI docs.


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




Re: Non-caching META-tags

2002-11-21 Thread fliptop
On Thu, 21 Nov 2002 at 08:09, Michael Kelly opined:

MK:On Thu, Nov 21, 2002 at 07:19:37AM -0500, fliptop wrote:
MK: On Wed, 20 Nov 2002 at 13:58, Michael Kelly opined:
MK: 
MK: MK:On Wed, Nov 20, 2002 at 02:02:05PM +, Nick Malden wrote:
MK: MK:
MK: MK:CGI.pm doesn't support http-equiv meta-tags, according to the documentation.
MK: MK:What about something as simple as:
MK: 
MK: what?  snippet from perldoc CGI:
MK: 
MK: To create an HTTP-EQUIV type of meta tag, use -head, described below.
MK:
MK:Hrm, I must have an old version (2.56). From perldoc CGI, line 1013:
MK:
MK: There is no support for the HTTP-EQUIV type of META tag.
MK:
MK:Looks like I need to update. Sorry for the misinformation!

yeah - the latest version is 2.89, released october 16th.

http://search.cpan.org/author/LDS/CGI.pm-2.89/


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




Re: Non-caching META-tags

2002-11-20 Thread fliptop
On Wed, 20 Nov 2002 at 14:02, Nick Malden opined:

NM:print $q-header,
NM:  $q-start_html(-title='My new page',
NM:-meta={'http-equiv'='Cache-Control' 
'content'='no-cache,must-revalidate'})
NM:-meta={'http-equiv'='Pragma: no-cache'});
NM:
NM:but this gives 
NM:
NM:String found where operator expected at test.pl line 20, near
NM:'Cache-Control' 'content'

are you missing a comma and a greater than sign there?

-meta={'http-equiv'='Cache-Control',
 ^ 
'content'='no-cache,...' }
  ^


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




Re: auto execute cgi

2002-11-01 Thread fliptop
On Fri, 1 Nov 2002 at 07:04, Admin-Stress opined:

A:Maybe this is not so related with perl it self, but still ...
A:
A:Is there any way to 'auto execute cgi' ? I meant, I have to trigger
A:something (like updating database via perl) just after user viewed the
A:html.

perhaps a server side include would do the trick?


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




Re: my $q = shift and another

2002-10-29 Thread fliptop
On Tue, 29 Oct 2002 at 15:57, Jimmy George opined:

JG:And how come my use of -wT in the opening line results in a
JG:
JG:'Too late for Taint mode now' message?
JG:
JG:Again the cgi programming book uses it every where except for the
JG:security chapter but my Mac debugger will not accept it at all!

http://www.mail-archive.com/beginners-cgi;perl.org/msg01484.html


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




Re: perl cgi security

2002-10-28 Thread fliptop
On Sun, 27 Oct 2002 at 14:10, Admin-Stress opined:

A:Is it possible to VIEW the source code of a perl cgi from a website?

sure, if your httpd server is improperly configured.

A:For example, I wrote a perl cgi like this
A:http://www.myweb.com/cgi-bin/addcustomer.pl
A:
A:The purpose of that script is to add new customer into my MySQL database.
A:
A:So, is it possible that some one can download that script? Like using
A:'web site downloader' or 'dump' or any other method?
A:
A:If yes (possible), is there any way to prevent this? or to hide the cgi
A:source code?

perldoc -q 'hide the source'


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




Re: Perl MSGraph

2002-10-28 Thread fliptop
On Mon, 28 Oct 2002 at 10:26, T. Murlidharan Nair opined:

TMN:I must confess this is not a Perl CGI question, but,since we have some 

then you should probably ask it on a non-cgi list.  try one of these:

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


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




Re: using includes or exec to call a CGI

2002-10-25 Thread fliptop
On Fri, 25 Oct 2002 at 12:11, Al Hospers opined:

have you looked at apache's documentation for mod_include?

http://httpd.apache.org/docs/mod/mod_include.html

AH:the cgi works fine when called in the browser as a url, here:
AH:
AH:http://66.186.192.77/cgi-bin/quotes/quotemaster.cgi?
AH:
AH:but when I embed it in the HTML it won't display. if I look at the 
AH:source
AH:that comes back I see something like:
AH:
AH:div align=center class=quotesHeaderQuotes From the Edge/div
AH:font color=#FF size=1 face=Arial
AH:[an error occurred while processing this directive]
AH:/font

what is put in the httpd error log when this occurs?  that information 
could be valuable.

AH:here are the two methods I have tried:
AH:
AH:1) as a include in a shtml file:
AH:
AH:div align=centerQuotes From the Edge/div
AH:font color=#FF size=1 face=Arial
AH:!--#include
AH:virtual=http://66.186.192.77/cgi-bin/quotes/quotemaster.cgi--
AH:/font

from the mod_include documentation:

Note that the comment terminator (--) should be preceded by whitespace 
to ensure that it isn't considered part of an SSI token.

AH:2) as an exec in an shtml file
AH:
AH:div align=centerQuotes From the Edge/div
AH:font color=#FF size=1 face=Arial
AH:!--#exec cgi=http://66.186.192.77/cgi-bin/quotes/quotemaster.cgi?--
AH:/font

from the mod_include documentation:

The include virtual element should be used in preference to exec cgi. 
In particular, if you need to pass additional arguments to a CGI program, 
using the query string, this cannot be done with exec cgi, but can be done 
with include virtual, as shown here:
!--#include virtual=/cgi-bin/example.cgi?argument=value --


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




Re: [CGI ERR] Global symbol requires explicit package name ...

2002-10-18 Thread fliptop
On Wed, 16 Oct 2002 at 19:33, Colby opined:

[snip]
C:Global symbol  requires explicit package name at ./myscript.cgi line
C:60, 70, 90, 108
[snip]
C:I've gone over the code with a fine-tooth comb as it were, checked for
C:the usual (missing semi-colons, right parenthesis/curly braces, etc
C:...) and found nothing amiss.  I haven't run the script through the
C:Perl debugger yet and I am not able to do so on the web hosting
C:company's server because they don't allow telnet/SSH.

how long is the code?  it would help if we could take a gander at it.

perhaps you could try another small test script and see if it does the 
same thing (if your original script is too long)?


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




Re: css in cgi generated page

2002-10-11 Thread fliptop

On Thu, 10 Oct 2002 at 22:01, Ian Watt opined:

IW:is there some special trick to linking a style sheet to your page when 
IW:the page is generated by a cgi script?
IW:I have this sub routine that prints the header of a html page:
IW:  sub write_html_header
IW:  {
IW:print Content-type: text/html\n\nhtml\n head\n;
IW:print   link rel='stylesheet' href='mystyle.css' /\n;
IW:print   title$_[0]/title\n;
IW:print /head\nbody\n;
IW:  }
IW:When I run this in a browser it displays the page normally except the 
IW:style sheet isn't applied to the page at all.  It just shows the 
IW:default colors.  I also tried it with the attributes type='text/css' 
IW:and media='screen' but nothing seems to work.  I've tried it in 
[snip]

assuming your mystyle.css file is in your document root, try this:

print   link rel='stylesheet' type='text/css' href='/mystyle.css'\n;

because if you're trying to print this from a file in your cgi-bin, then 
listing the href='mystyle.css' means 'look for the file 
cgi-bin/mystyle.css', and you probably have it in your document root.  
including the leading slash will tell the webserver to look there instead.

also, i'm not sure why you have the extra '/' in there, but perhaps that 
is causing problems also.



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




Re: CGI problem

2002-10-03 Thread fliptop

On Thu, 3 Oct 2002 at 08:52, zentara opined:

z:On Thu, 03 Oct 2002 07:34:13 -0400, [EMAIL PROTECTED] (Zentara)
z:wrote:
z:
z:Oops, keep forgetting the header. :-)  The following will
z:send the form variables back to the browser.
z:
z:###
z:#!/usr/bin/perl 
z:use warnings;
z:use strict;
z:use CGI;
z:my $cgi=new CGI;
z:
z:print Content-type: text/html\n\n;
z:
z:my %in = $cgi-Vars();
z:foreach my $key (keys %in){
z:   print $key\t$in{$key}\n;
z:   }

but, of course, you'll want to html escape anything posted to a form
before it's sent back to the browser.  read this for more info on why:

http://www.perl.com/pub/a/2002/02/20/css.html


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




Re: How to run a process in background?

2002-09-30 Thread fliptop

On Sun, 29 Sep 2002 at 16:40, Octavian Rasnita opined:

OR:Can you give me some hints about how I should use the fork, to run the
OR:process in background?

have you read

perldoc -f fork

yet?  if so, what part of that do you not understand?



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




Re: Barcode scanner CGI

2002-09-25 Thread fliptop

On Wed, 25 Sep 2002 at 10:00, Geraint Jones opined:

GJ:On Tuesday 24 September 2002 3:41 pm, fliptop wrote:
GJ: On Tue, 24 Sep 2002 at 13:24, Geraint Jones opined:
GJ:
GJ: GJ:I'm trying to get the output from a barcode scanner into my CGI script.
GJ: What I GJ:would like to see is the barcode going straight into a text box
GJ: in my GJ:browser. I am using Device::SerialPort to read the output which
GJ: works fine as GJ:a normal Perl script, but I don't know how to allow Perl
GJ: CGI scripts to GJ:access my /dev/ttyS1 port. Any help on this matter would
GJ: be greatly GJ:appreciated.
GJ:
GJ: you may have a permission problem.  does the user your webserver runs as
GJ: have permission to read from /dev/ttyS1?
GJ:
GJ:Probably not. How do I go about permitting Apache to see ttyS1?

you just use chown like any regular file or directory.  if your webserver 
runs as nobody, for example, you'd type (as root):

chown nobody:uucp /dev/ttyS1

and that will give nobody access to read from the ttyS1 port.  of course, 
i'm assuming your ports are owned by uucp.


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




Re: Barcode scanner CGI

2002-09-24 Thread fliptop

On Tue, 24 Sep 2002 at 13:24, Geraint Jones opined:

GJ:I'm trying to get the output from a barcode scanner into my CGI script. What I 
GJ:would like to see is the barcode going straight into a text box in my 
GJ:browser. I am using Device::SerialPort to read the output which works fine as 
GJ:a normal Perl script, but I don't know how to allow Perl CGI scripts to 
GJ:access my /dev/ttyS1 port. Any help on this matter would be greatly 
GJ:appreciated.

you may have a permission problem.  does the user your webserver runs as
have permission to read from /dev/ttyS1?


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




Re: Creating thumbnails (Newbie Question)...

2002-09-19 Thread fliptop

On Wed, 18 Sep 2002 at 20:28, Octavian Rasnita opined:

OR:But is it a way, (maybe module?) that allow creating a thumbnail on the fly?
OR:
OR:For example:
OR:I want to put more big images in a folder and if someone visits my page,
OR:they will see a table with thumbnails created on the fly and inserted in the
OR:HTML page, and ... those thumbs made as links to the bigger pictures.
OR:
OR:The script should get the image, create a smaller one automaticly (with a
OR:lower size) and print it on the screen as image/jpg ... etc.
OR:
OR:Is it possible?

octavian - please remember to post your messages to the list so everyone 
can benefit from the questions and answers.

to answer your question - did you investigate the perl module i listed?  
it's called Image::Magick::Thumbnail, and it does exactly what you 
describe.  Please see below:

OR:- Original Message -
OR:From: fliptop [EMAIL PROTECTED]
OR:To: Yuen, Alex [EMAIL PROTECTED]
OR:Cc: 'Perl Beginners - CGI' [EMAIL PROTECTED]
OR:Sent: Wednesday, September 18, 2002 5:52 PM
OR:Subject: Re: Creating thumbnails (Newbie Question)...
OR:
OR:
OR:On Wed, 18 Sep 2002 at 09:56, Yuen, Alex opined:
OR:
OR:YA:I was wondering if it is possible to write a CGI (Perl) program to make a
OR:YA:thumbnail page for my website.
OR:YA:
OR:YA:If so, how would I start and use for doing this?
OR:
OR:if you question is how to create a thumbnail from a regular image, then
OR:you could use ImageMagick.
OR:
OR:http://www.imagemagick.org
OR:http://search.cpan.org/author/LGODDARD/Image-Magick-Thumbnail-0.01/
OR:


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




Re: sort

2002-09-19 Thread fliptop

On Wed, 18 Sep 2002 at 20:43, Daniel Hurtado Brenner opined:

DHB:For example:
DHB:If i have a flat data base myfile.txt with this info:
DHB:
DHB:1|name|address|
DHB:2|name two|address two|
DHB:3|name three|address three|
DHB:4|name four|address four|
DHB:. (etc, etc)
DHB:
DHB:If i execute:
DHB:
DHB: open(IN,$myfile.txt);
DHB: while(IN){
DHB:  @file=split(/\|/,$_);
DHB:If ($file[0] ne ){
DHB:print $field[0] | $field[1] | $field[2];
DHB:}
DHB:}
DHB:close (IN);
DHB:
DHB:THE RESULTS IS:
DHB:
DHB:1|name|address|
DHB:2|name two|address two|
DHB:3|name three|address three|
DHB:4|name four|address four|
DHB:
DHB:OK. BUT HOW I CAN DO FOR THIS RESULTS BE:
DHB:4|name four|address four|
DHB:3|name three|address three|
DHB:2|name two|address two|
DHB:1|name|address|

perldoc -q sort
perldoc -f sort


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




Re: GPL - how does it work

2002-09-19 Thread fliptop

On Thu, 19 Sep 2002 at 08:20, Alex Agerholm opined:

AA:I am writing a CGI application/script in Perl which I am going to sell
AA:This application uses a few Perl modules (CGI.pm, Session.pm) which is
AA:covered by the GPL.
AA:How am I going to handle that, when I do not want to release my application
AA:under GPL ?
AA:
AA:In other words how can you use Perl modules under GPL in commercial
AA:applications without making your application public ?

you should ask a lawyer.

perldoc -q 'hide the source'



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




Re: Creating thumbnails (Newbie Question)...

2002-09-18 Thread fliptop

On Wed, 18 Sep 2002 at 09:56, Yuen, Alex opined:

YA:I was wondering if it is possible to write a CGI (Perl) program to make a
YA:thumbnail page for my website.
YA:
YA:If so, how would I start and use for doing this?

if you question is how to create a thumbnail from a regular image, then 
you could use ImageMagick.

http://www.imagemagick.org
http://search.cpan.org/author/LGODDARD/Image-Magick-Thumbnail-0.01/




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




Re: Indexing multiple records for potential updates

2002-09-10 Thread fliptop

On Mon, 9 Sep 2002 at 22:08, Maureen E Fischer opined:

MEF:I'm working on a Perl CGI program that must update
MEF:A mysql database.  The user enters key information that
MEF:Is used to display zero to many records.  Then the user
MEF:Can update or delete any number of records displayed.
MEF:I sucessfully displayed multiple records and have output
MEF:Them such that they can be modified.  I'm not sure 
MEF:Though when I submit the screen how I go through the
MEF:Multiple records.  I can't seem to find any examples in
MEF:The books that I have.  I output the multiple records using
MEF:A while and fetchrow_array.  I don't have any code to show
MEF:Because I am at a loss as to how to start.  Perhaps I can 
MEF:Just get the entire screen into one big field that I can

if you set up your form so that each record has the same input params, 
then they should be submitted in order and you can treat each one as an 
array.  for example (untested, and using limited html):

Name: input type=text name=name
Address: input type=text name=address
Phone: input type=text name=phone
input type=hidden name=id value=1
br
Name: input type=text name=name
Address: input type=text name=address
Phone: input type=text name=phone
input type=hidden name=id value=2


# and in your cgi:

my $dbh = put your db handle code here;
my $q = new CGI;
my @ids = $q-param('id');
my @names = $q-param('name');
my @addresses = $q-param('address');
my @phone = $q-param('phone');
my $sth = $dbh-prepare('update table set name=?, address=?, phone=?
 where id=?');

for (my $i = 0; $i  scalar(@ids); $i++) {
  $sth-execute($names[$i], $addresses[$i], $phone[$i], $ids[$i]);
}

$sth-finish();
$dbh-disconnect;


of course, you'll need to do some validation to make sure values were 
submitted and are acceptable.  otherwise, scalar(@ids) may not be the 
same as scalar(@addresses) or scalar(@phone) or scalar(@names).  you'll 
probably want to check to make sure each value exists before trying to 
update it.


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




Re: Monitor a POP3 account

2002-09-03 Thread fliptop

On Tue, 3 Sep 2002 at 11:05, Mike(mickako)Blezien opined:

M:Need to come up with a script to monitor a special POP3 account that will be
M:used to tigger another script.. was hoping someone could direct me or supply an
M:example of how to retreive an email from a POP account.
M:
M:Basically this will automatically monitor the POP account via a cron job,.. no
M:problems there, but what is the best way to retrieve the email, via Perl, so the
M:other script can be triggered... hope this is clear ;)

use procmail to pipe the email to a perl script, then use mail::audit to 
process the message.  the instructions for doing this come with the 
documentation for mail::audit.  you don't need to use a cron job if you 
use procmail.

http://search.cpan.org/author/SIMON/Mail-Audit-2.1/


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




Re: How to protect Perl code

2002-09-02 Thread fliptop

On Mon, 2 Sep 2002 at 20:33, Alex Agerholm opined:

AA:Can anyone give me a good way to protect my Perl code. I am writing a
AA:CGI application in Perl that I am going to sell - therefore I would
AA:like to protect my code in such a way that it is not that easy to copy
AA:the code and reuse/resell/distribute it. Does anyone have a good
AA:sugestion howto do this ?

a google search on 'hiding perl code' gave me almost 25,000 hits.  this 
topic has been discussed to death on several perl lists.



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




Re: Password protection without the use of .htaccess

2002-09-02 Thread fliptop

On Mon, 2 Sep 2002 at 20:33, Alex Agerholm opined:

AA:Can anyone direct me to some good source code example, on how to password
AA:protect some CGI scripts.
AA:As I want the solution to be portable, I do not want to use .htaccess.
AA:I would prefer som code to make a login page and verify the username and
AA:password against a SQL database, then set a cookie with an ID of the logged
AA:in user. And on all protected scripts simply call a check function that
AA:lookup the ID in the SQL database to see if it is legal and if not redirects
AA:to the login page.

if you're running mod_perl, there's apache::authticket.  it does exactly 
what you want.

http://search.cpan.org/author/MSCHOUT/Apache-AuthTicket-0.31/



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




Re: Analyzing a form

2002-09-02 Thread fliptop

On Mon, 2 Sep 2002 at 06:20, Soheil Shaghaghi opined:

[snip]
SS:Now, here is what I am trying to get after the data is analyzed:
SS:All I want is to display a page that says Passed, or Failed with a message.
SS:
SS:Below is what I have so far:
SS:As you can see it's not completed yet, but I am not sure if I am doing it
SS:correctly and if there is another (better or easier way), and I am also
SS:confusing myself!

i wrote the form checker tutorial for this very purpose.

http://www.peacecomputers.com/form_checker/



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




Re: encryption

2002-08-30 Thread fliptop

On Fri, 30 Aug 2002 at 10:32, Jimmy George opined:

JG:Is there any way of encrypting a credit card number etc. so that it can
JG:not be seen when being transmitted from desktop to server? The user
JG:needs to see what they type to make sure it is correct - so how do we
JG:get cgi to encrypt that at the user end before transmission.
JG:
JG:I have read some books about it but all we appear to be able to do is to
JG:encrypt the received raw number before storing it so that the file it is
JG:kept in cannot be opened and read. Is that the limit right now?
JG:
JG:Any ideas or places to look?

you could use FreezeThaw and store all the info associated with the credit
card (number, exp date, address, name, etc) as a string.

http://search.cpan.org/author/ILYAZ/FreezeThaw-0.43/FreezeThaw.pm

or, you can use one of the Crypt:: modules.

http://search.cpan.org/search?mode=allquery=encrypt


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




Re: Application Design for User Authentication

2002-08-28 Thread fliptop

On 28 Aug 2002 at 11:57, Gfoo opined:

G:I'm creating a web appication in Perl (and CGI).
G:I' ve written code that is used to create and read sessions (by using 
G:cookies or GET http method) which are used after authenticating user logins 
G:in a database. 
G:The code for handing transitions and state is about 60 lines of code. I 
G:already have made it modular, but I'm still searching for an elegant way to 
G:use this code on every script.
G:I have several pages (.pl scripts) that must be viewable only by logged in 
G:users. 
G:Do I need to put the same code on every page (and have the 'actual' script 
G:code in an if branch of the authentication code)?
G:I also have thought that I can create something like a dispatcher, which 
G:checks if the user is authenticated and then call the actual .pl script (or 
G:modules subroutines) from there.
G:How can someone avoid code repetition on all scripts that require 
G:authentication? Can I avoid having a big if ... statement to handle all 
G:cases? It would be nice, if only 1 to 5 lines of code were required on each 
G:script. Is there any suggested way of handling this situation?

can you use mod_perl?

intercepting the authentication step with mod_perl is very easy and will 
accomplish exactly what you want to do.


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




Re: Application Design for User Authentication

2002-08-28 Thread fliptop

On Wed, 28 Aug 2002 at 15:46, Oleksiy Rudenko opined:

OR:Where could I as a beginner read more about mod_perl? Sources in plain 
OR:English appreciated.
OR:Thanx.

perl.apache.org is a good place to start.


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




Re: apache::*, simple question.

2002-08-20 Thread fliptop

On Tue, 20 Aug 2002 at 21:35, Hytham Shehab opined:

HS:hi guys,
HS:is it a must to use mod_perl to access all/some apache::* modules?, i
HS:mean, if i run normal perl and cgi scripts, i won't be able to access apache
HS:modules?

it's not necessary to use mod_perl.

for example, apache::dbi happily maintains persistent db handles for plain
cgi programs.


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




RE: apache::*, simple question.

2002-08-20 Thread fliptop

On Tue, 20 Aug 2002 at 16:51, Bob Showalter opined:

BS:You're joking, right? Apache::DBI is completely useless under mod_cgi.

when i use it with ordinary cgi programs and postgresql (on linux) i
always see a pool of connections that remain active until httpd is
restarted or the child process(es) that handled the request(s) reaches the
maxrequests limit and dies.  i never said anything about mod_cgi.

i was under the impression the original question was 'do i need to write 
handlers in mod_perl to take advantage of the apache::* modules'.

maybe i'm mistaken.


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




RE: Online installer

2002-08-18 Thread fliptop

On Sun, 18 Aug 2002 at 01:13, Soheil Shaghaghi opined:

SS:Thanks Jim :)
SS:I've actually seen such scripts on the web, so I know it's possible.
SS:One thing that is not the job of this script is to actually look for server
SS:details. These should be determined by the user.
SS:
SS:Basically, the user is required to enter certain information in the form,
SS:like the path to Perl, sendmail,..
SS:Then the program changes the necessary variables and begins the
SS:installation.
SS:I think it would become more clear to everyone if I show you an example:
SS:This is something close to what I am looking for:
SS:http://www.stepweb.com/installer/install.html

you should look into packaging your app up so it can be installed with 
MakeFile, in the same way that any CPAN module is installed.

if i'm not mistaken, drieux recently posted a tutorial on creating a 
MakeFile.  care to post that url again, drieux?


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




Re: mysql problem

2002-08-15 Thread fliptop

On Thu, 15 Aug 2002 at 16:37, Jim Lundeen opined:

JL:ok, i just setup a new server (redhat 7.3) and my guy says that the
JL:dbd/dbi stuff is configured for perl-to-mysql connectivity, but i get
JL:the following error message in my error log each time i try to run a
JL:script from either the command line or via the browser:
JL:
JL:---
JL:install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC

is the DBD::mysql module installed?  it seems not.


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




Re: Checking Form data

2002-07-31 Thread fliptop

Kipp, James wrote:

 What is the best way to validate form data. I have a form which the user
 enters dates like '08/01/2002'. What is the best way to make sure this
 format is entered. Should i use javascript here or regex?


i had some free time, so i decided to finish up some thoughts i have 
regarding validating form data.  i've developed a simple module to 
perform basic validation and shown how to implement it.  it's all 
available here:

http://www.peacecomputers.com/form_checker/

please send any errata or general comments directly to me, not the list.

many thanks to Eric Moore ([EMAIL PROTECTED]) for his help and 
patience during development.

please note that this module doesn't really answer the question posed by 
the original poster, namely 'how do i validate a date?'  imho, i'd do 
that like this (for slash-delimited dates only):

use strict;
use Date::Calc qw(check_date);

my @date = qw( 08/02/2002
7/3/2003
13/3/2006
09/33/2002
al/df/ioji
09/14/66
);

for my $date (@date) {
   my ($month, $day, $year) = split /, $date;

   if (check_date($year,$month,$day)) { print $date is kosher\n; }
   else { print $date is uncool\n; }
}

OUTPUT

08/02/2002 is kosher
7/3/2003 is kosher
13/3/2006 is uncool
09/33/2002 is uncool
Argument ioji isn't numeric in subroutine entry at try1.pl line 17.
Argument al isn't numeric in subroutine entry at try1.pl line 17.
Argument df isn't numeric in subroutine entry at try1.pl line 17.
al/df/ioji is uncool
09/14/66 is kosher


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




Re: regular expression

2002-07-27 Thread fliptop

GsuLinuX wrote:
 
  I wanna check the information typed in the form field whether if it
  is in date format or not . Like : check it if it is in format
  day/mount/year , in format like ab/cd/ef or ab/cd/efgh  ab must
  be valid like between 1-31 cd must be valid between 1-12 or must
  be a string that exist in an array that i define, for exemple A[12] ef
   must be valid like between 00-99 or efgh between 1900-2010
 
  In second part i wanna get the month in a variable, i mean cd to a
   variable , cd can be either a numeric value or a string

you should look into using Date::Calc.  it has many functions for 
checking a date's validity, extracting parts, etc.

http://search.cpan.org/search?dist=Date-Calc


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




Re: Finding the country

2002-07-24 Thread fliptop

Scot Robnett wrote:

 I'm assuming your best bet would be to find the IP using the first line of a
 ping or traceroute and regex-ing out the extraneous stuff, then using
 'whois -a' (which does an ARIN search) and extracting the 4th line to get
 the country.
 
 Anybody have any easier/faster ideas?


use this lookup hash.  this list is available at

http://www.iana.org/assignments/ipv4-address-space


 my %IPS = (
 '0'   = 'IANA - Reserved',
 '1'   = 'IANA - Reserved',
 '2'   = 'IANA - Reserved',
 '3'   = 'General Electric Company',
 '4'   = 'Bolt Beranek and Newman Inc.',
 '5'   = 'IANA - Reserved',
 '6'   = 'Army Information Systems Center',
 '7'   = 'IANA - Reserved',
 '8'   = 'Bolt Beranek and Newman Inc.',
 '9'   = 'IBM',
 '10'  = 'IANA - Private Use',
 '11'  = 'DoD Intel Information Systems',
 '12'  = 'ATT Bell Laboratories',
 '13'  = 'Xerox Corporation',
 '14'  = 'IANA - Public Data Network',
 '15'  = 'Hewlett-Packard Company',
 '16'  = 'Digital Equipment Corporation',
 '17'  = 'Apple Computer Inc.',
 '18'  = 'MIT',
 '19'  = 'Ford Motor Company',
 '20'  = 'Computer Sciences Corporation',
 '21'  = 'DDN-RVN',
 '22'  = 'Defense Information Systems Agency',
 '23'  = 'IANA - Reserved',
 '24'  = 'ARIN - Cable Block',
 '25'  = 'Royal Signals and Radar Establishment',
 '26'  = 'Defense Information Systems Agency',
 '27'  = 'IANA - Reserved',
 '28'  = 'DSI-North',
 '29'  = 'Defense Information Systems Agency',
 '30'  = 'Defense Information Systems Agency',
 '31'  = 'IANA - Reserved',
 '32'  = 'Norsk Informasjonsteknologi',
 '33'  = 'DLA Systems Automation Center',
 '34'  = 'Halliburton Company',
 '35'  = 'MERIT Computer Network',
 '36'  = 'IANA - Reserved',
 '37'  = 'IANA - Reserved',
 '38'  = 'Performance Systems International',
 '39'  = 'IANA - Reserved',
 '40'  = 'Eli Lily and Company',
 '41'  = 'IANA - Reserved',
 '42'  = 'IANA - Reserved',
 '43'  = 'Japan Inet',
 '44'  = 'Amateur Radio Digital Communications',
 '45'  = 'Interop Show Network',
 '46'  = 'Bolt Beranek and Newman Inc.',
 '47'  = 'Bell-Northern Research',
 '48'  = 'Prudential Securities Inc.',
 '49'  = 'Joint Technical Command',
 '50'  = 'Joint Technical Command',
 '51'  = 'Deparment of Social Security of UK',
 '52'  = 'E.I. duPont de Nemours and Co., Inc.',
 '53'  = 'Cap Debis CCS',
 '54'  = 'Merck and Co., Inc.',
 '55'  = 'Boeing Computer Services',
 '56'  = 'U.S. Postal Service',
 '57'  = 'SITA',
 '58'  = 'IANA - Reserved',
 '59'  = 'IANA - Reserved',
 '60'  = 'IANA - Reserved',
 '61'  = 'APNIC - Pacific Rim',
 '62'  = 'RIPE NCC - Europe',
 '63'  = 'ARIN',
 '64'  = 'ARIN',
 '65'  = 'ARIN',
 '66'  = 'ARIN',
 '67'  = 'ARIN',
 '68'  = 'ARIN',
 '69'  = 'IANA - Reserved',
 '70'  = 'IANA - Reserved',
 '71'  = 'IANA - Reserved',
 '72'  = 'IANA - Reserved',
 '73'  = 'IANA - Reserved',
 '74'  = 'IANA - Reserved',
 '75'  = 'IANA - Reserved',
 '76'  = 'IANA - Reserved',
 '77'  = 'IANA - Reserved',
 '78'  = 'IANA - Reserved',
 '79'  = 'IANA - Reserved',
 '80'  = 'RIPE NCC',
 '81'  = 'RIPE NCC',
 '82'  = 'IANA - Reserved',
 '83'  = 'IANA - Reserved',
 '84'  = 'IANA - Reserved',
 '85'  = 'IANA - Reserved',
 '86'  = 'IANA - Reserved',
 '87'  = 'IANA - Reserved',
 '88'  = 'IANA - Reserved',
 '89'  = 'IANA - Reserved',
 '90'  = 'IANA - Reserved',
 '91'  = 'IANA - Reserved',
 '92'  = 'IANA - Reserved',
 '93'  = 'IANA - Reserved',
 '94'  = 'IANA - Reserved',
 '95'  = 'IANA - Reserved',
 '96'  = 'IANA - Reserved',
 '97'  = 'IANA - Reserved',
 '98'  = 'IANA - Reserved',
 '99'  = 'IANA - Reserved',
 '100' = 'IANA - Reserved',
 '101' = 'IANA - Reserved',
 '102' = 'IANA - Reserved',
 '103' = 'IANA - Reserved',
 '104' = 'IANA - Reserved',
 '105' = 'IANA - Reserved',
 '106' = 'IANA - Reserved',
 '107' = 'IANA - Reserved',
 '108' = 'IANA - Reserved',
 '109' = 'IANA - Reserved',
 '110' = 'IANA - Reserved',
 '111' = 'IANA - Reserved',
 '112' = 'IANA - Reserved',
 '113' = 'IANA - Reserved',
 '114' = 'IANA - Reserved',
 '115' = 'IANA - Reserved',
 '116' = 'IANA - Reserved',
 '117' = 'IANA - Reserved',
 '118' = 'IANA - Reserved',
 

Re: Buffer output?

2002-07-22 Thread fliptop

Octavian Rasnita wrote:

 
 I've seen the following line in more Perl scripts and even in some Perl
 books, but it wasn't very well explained.
 
 $|=1;   ## Don't buffer output
 
 What does it mean to buffer output?
 Which is the difference if the  $| is 0 or 1?


perldoc perlfaq5


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




Re: running tar from a browser

2002-07-18 Thread fliptop

Bob Showalter wrote:

-Original Message-
From: Soheil Shaghaghi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 18, 2002 2:48 PM
To: [EMAIL PROTECTED]
Subject: running tar from a browser


Hello everyone.

Here is my problem, if anyone can please help me:
Running, Linux.
I am trying to write a simple backup program to backup the data from a
directory.
The script works from the command line.
But when I try to run the same script from the browser, it 
doesn't work.
I get this message:
Data could not be backed up.
Exited with the following message: No such file or directory

The error logs say:
tar: backup.tar: Permission denied

^
This is the relevant problem
 
 


[snip]

 The directory you switch to must be writable by the web server in
 order to create backup.tar, or you will have to specify a directory
 that *is* writable.


or sudo the cgi as a user that does have write permissions to the directory.


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




Re: Check disc quota

2002-07-15 Thread fliptop

Mike(mickalo)Blezien wrote:

 I am new to this list, so if this not the proper list to send this too, I would
 appreciate the name of the appropriate list.


it's not the correct list.  this is a beginners-cgi list.  i would 
suggest the beginners mailing list.  point your browser to learn.perl.org.


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




Re: Displaying counter

2002-07-15 Thread fliptop

Jim Lundeen wrote:

 I have the following in my HTML output:
 
 head
   meta http-equiv=refresh content=600;URL=program.cgi
 /head
 
 Question:   Is there a way to display the counter?  I want to have my
 page say You will be transferred to blah in NNN seconds...  I want
 the message to actually show the active counter...   600 changes to 599,
 then 598, and so on...


there's a script available from http://javascript.internet.com that does 
this very thing.  i've used it and it works very well.


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




Re: mysql where statement in select

2002-07-12 Thread fliptop

Maureen E Fischer wrote:

 Hello,
 Is there a way of varying the key fields in a where statement?  I don't


i would suggest posting your questions on a more appropriate mailing list.

http://www.perl.com/pub/a/language/info/mailing-lists.html


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




Re: mail filters

2002-07-11 Thread fliptop

David Gerler wrote:

 Hi,
   I am trying to setup mail filters on my domain that is on a virtual host.
   I have a copy of TPJ #18 (Summer 2000) and have read the article about mail
 filtering. The problem I am having is finding out where to put the .forward
 or .qmail file to direct mail to my script. I have attempted to use find on
 the server without any luck.


put it in your home directory.

for example, my login is fliptop, and my home directory is

/home/fliptop

so i'd create the file

/home/fliptop/.forward


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




Re: mail filters

2002-07-11 Thread fliptop

David Gerler wrote:

 
  Thanks. It seems to find it but it kills all mail delivery. This is
  what I am putting in the text file:
 
  |/home/gerleren/test.pl
 
 
  Where test is a test script copied from TPJ that should kill only
  specific email addresses (not the exact duplicate of TPJ chuckmail
  but based on it). Is that correct? The mail server is exim.

dunno.  i use procmail and sendmail.  here's what i put in my 
..procmailrc file:

:0:
*
| /home/fliptop/bin/filter.pl

this is off topic for a cgi mailing list, perhaps you should try another 
more appropriate list?  maybe [EMAIL PROTECTED]?


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




Re: Ternary Regex Evaluation

2002-07-08 Thread fliptop

John Pitchko wrote:

 Yes that would work, but I was really curious as to why the ternary 

 operation does not work. In fact, none of my other ternary operations 

 seem to work. Is there something wrong with my syntax?


probably.  try putting each true/false statement inside a parenthesis.

ps - this really doesn't have anything to do with cgi, so a question 
like this would be better off asked on a different list.


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




Re: Odd boxes - the solution

2002-07-07 Thread fliptop

Henk van Ess wrote:

 Hi all,
 
 My provider gave me the solution. I had to install:
 
 pkg_add -r unix2dos
 
 where unix2dos *.cgi strips the boxes.. Ty all for the input.


this perl 1-liner should do the trick:

perl -pi -e 's/\s+$/\n/g' filename.html


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




Re: CGI.pm v/s roll-your-own [WAS:] Displaying Problems

2002-06-27 Thread fliptop

On Thu, 27 Jun 2002, [EMAIL PROTECTED] opined:

:With mine, there is nothing beyond what I described.  The hash structure I gave you 
:below, that's
:it.  Form.pm takes the input, makes a hash with it, and if you understand how to use 
:a hash and
:array ref, your set.  Its just a hash, no objects, no functions, just a hash.
:
:So you use:
:
:use Form.pm
:my %input = Form();
:
:and your done.  All the data is sitting in the hash %input.  You can at that point do 
:anything you
:want to with it.
:
:Like I say, simple and efficient.

can you limit upload sizes?
can you disable uploads altogether?
how does it handle errors, especially during file uploads?
can you exclude undefined parameters from the parameter list?
does it have a debug mode?


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




Re: Displaying Problems

2002-06-26 Thread fliptop



On Tue, 25 Jun 2002, [EMAIL PROTECTED] opined:

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

i would guess that, for the purposes of this mailing list, most who
recommend using CGI.pm do so because this list is aimed at beginners, and
they most definitely should be using it to parse query strings.

other available solutions, and the semantics of using them, probably
wouldn't be a good place for a beginner to learn about cgi programming.



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




Re: Chart::Plot-Probs

2002-06-21 Thread fliptop

Konrad Foerstner wrote:

 okay my prob is not really CGI specific, but I just try here.


yikes!  since this list *is* cgi-specific, you should take your question 
elsewhere.

http://learn.perl.org


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




Re: POSIX 'strftime' issue

2002-06-21 Thread fliptop

David Gilden wrote:

 I have small problem here, check out the following:
 
 #!/usr/bin/perl 
 
 use CGI qw/:standard/;
 use CGI::Carp qw(fatalsToBrowser);
 use POSIX 'strftime';
 
 # This works fine on Earthlink's servers using:
 
 print OUT strftime('%A, %B %1d, %Y %I:%M %p',localtime) ,\n;
 
 #returns: Wednesday, June 19, 2002 02:01 PM
 
 #but at CI-Host, I get this string:
 
 print OUT strftime('%A, %B %D, %Y %I:%M %p',localtime) ,\n;
 #returns: Wednesday, June d, 2002 12:53 PM
 
 How can I fix this to work at CI-Host, (I think they are runing Apache)


have you tried reading the documentation for posix?

from the docs:

If you want your code to be portable, your format (fmt) argument should 
use only the conversion specifiers defined by the ANSI C standard. These 
are aAbBcdHIjmMpSUwWxXyYZ%.

i don't see 'D' in that list.  and besides, your earthlink fmt has 
'%1d', while your ci-host fmt has '%D'.


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




Re: POSIX 'strftime' issue

2002-06-21 Thread fliptop

David Gilden wrote:

 
 print OUT strftime('%A, %B %ld, %Y %I:%M %p',localtime) ,\n;
 
 But look here, 
 
 http://www.coraconnection.com/cgi-bin/schedule.pl
 
 what is going wrong? (see the date string)


hrm - dunno.  i use date::calc myself for date manipulation.  maybe 
someone else more familiar with posix and its cross-platform 
inconsistencies can answer this one?


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




Re: SV: number

2002-06-20 Thread fliptop

Bo Mangor wrote:

 
 But how does it work?   if(string =~/^[0-9]/)
 
 The part string =~/^[0-9]/  - does it split the string into single
 numbers and check if each of them is a part of the list [0-9] ?? 
 I want to be scour that I have understood the Principe correct.


i would suggest reading the perl faq on regular expressions:

http://www.perldoc.com/perl5.6/pod/perlfaq6.html

or buying a book on them:

http://www.oreillynet.com/search/index.ncsp?sp-q=mastering+regular+expressionssp-k=all



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




Re: mysql query statement

2002-06-08 Thread fliptop

Hytham Shehab wrote:

 (2) sorting order is passed as a bind parameter:
 $sort = 'asc';
 $sth = $dbh-prepare(select student_name from students order by first_name
 $sort);
 $sth-execute($sort);


you're trying to substitute the value twice.  try something like this 
instead:

$sort = 'first_name asc';
$sth = $dbh-prepare(select foo from bar order by ?)
$sth-execute($sort);


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




Re: mysql query statement

2002-06-08 Thread fliptop

Hytham Shehab wrote:

 i did it already flip, but its not yet valid, also it seems to be mentaly
 valid, its not for mysql.


perhaps you should ask your question on a more appropriate list.  try 
this one:

http://lists.perl.org/showlist.cgi?name=dbi-users


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




Re: What database would your recommend?

2002-06-07 Thread fliptop

Paul Arsenault wrote:

 database.  As for transactions, only very high-end commercial databases 
 (such as your friend's Oracle) support transactions.  They are only 


that's not true - postgresql supports transactions.

and according to this page:

http://www.mysql.com/doc/I/n/InnoDB_transaction_model.html

mysql now supports them also.


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




Re: mysql query statement

2002-06-06 Thread fliptop

Hytham Shehab wrote:

  hi all of u,
  all whatta i want is see the exact executed query b4 its execution, i
  mean not like this select blah from blah when x=? but not ? order by ?, i
  want to see as if u write it in the console of mysql, something like that
  select blah from blah where x=10 order by 'big' group by 'zip'.
  is it possible?


set DBI-trace(2) before the statement, then set DBI-trace(0) after it. 
it should write everything to the error log.


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




Re: HTML in E-mail

2002-06-04 Thread fliptop

Nikola Janceski wrote:

 Poor me stuck with SH1Tty mail programs at work.


kevin - will you do us all a favor and close this thread?  it was never 
on topic, and has now degraded to a soapbox where a few subscribers are 
simply airing their opinions.

all subscribers - please remember to keep your posts on topic (this is a 
beginners-cgi perl list), and if you want to trade opinions on which is 
the best/worst email client, best/worst format for email, best/worst 
whore in cleveland, or whatever, please email each other privately and 
leave the list out of it!


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




Re: HTML in E-mail

2002-06-04 Thread fliptop

Christopher G Tantalo wrote:

 fliptop wrote:
 
best/worst whore in cleveland, or whatever,

 i dont know what kinda perl code you were working on there ;)
 .. but i found some of the conversation somewhat helpful.. like the
 SpamAssassin reference. i never heard of that.. now i can look into it..


it was an example of how off-topic this thread is.  if you don't read 
perl.com regularly, you should start immediately:

http://www.perl.com/pub/a/2002/03/06/spam.html

(posted on march 6, 2002).


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




Re: The Cannons of True Faith

2002-06-04 Thread fliptop

drieux wrote:

 
 one of the problems I keep bumping my head into
 is that fundamentally perl is a Kult - and as such
 tends to not always be a well organized kult - since
 they are never clear as to which are the true cannons of the faith
 and which are the apostate ramblings of the merely deranged.
 
 Is there an official site dedicated to the True Cannons of Perl?


by this, do you mean 'principles of perl'?

for example, as an engineer, i remember one of the things we discussed 
(in class and in a few newsgroups, way back when) was the 'principles of 
engineering'.  one that sticks out in my mind was you can't push a rope.

so is that what you are referring to?  principles (or rules)?

that may be difficult, since (by default) the 1st rule probably would be 
  'tmtowtdi'.


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




Re: calculate dates

2002-05-28 Thread fliptop

Sven Bentlage wrote:

 I'm trying to get all the date values for the week (7days) ahead of a 
 specified date.


try date::calc

http://search.cpan.org/search?dist=Date-Calc


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




Re: Sysread and syswrite

2002-05-22 Thread fliptop

ChaoZ Inferno wrote:

 Well, firstly, it ain't CGI, it's network programming.


if it ain't, why are you posting to a cgi list?

http://learn.perl.org/ - choose another list.


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




Re: regular expression

2002-05-17 Thread fliptop

ChaoZ InferNo wrote:

 @text # contains values of a phone directory
 $text[0] contains john=012345678
 
 $phone1 = ?
 
 let say i wanted to grab just the values'012345678'.


if the format of $text[0] is always name=number you can use split 
instead of a regex.

perldoc -f split


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




Re: pass values to another scipt

2002-05-14 Thread fliptop

David vd Geer Inhuur tbv IPlib wrote:

 #!/user/cadiclab/bin/perl
 
 use CGI qw(:standard);
 
 $first = param('userid');
 $last = param('pw');
 $hide1 = param('hide1');
 $hide2 = param('hide2');
 
 print header,
 start_html(-BGCOLOR=#99),
 start_form;
 
 print Hallo userid: $first with password: $last brbr;
 print Hidden fields are; brbrField1: $hide1 brField2: $hide2 br;


this is dangerous!

you are taking user input and printing it directly to the browser 
without any html escaping!

please read this:

http://www.perl.com/pub/a/2002/02/20/css.html

as for your question - have you tried using .htaccess?


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




Re: Matt Wright's formMail

2002-05-13 Thread fliptop

Camilo Gonzalez wrote:

 I've just been informned by my ISP that Matt Wright's formMail will no
 longer be allowed on any of their servers due to glaring security concerns.
 I know now I shouldn't have used it but back then I was stupid and not a
 subscriber to this fine list. Let this serve as a warning to those still
 using his crap. Does anyone have the URL of that site that offers
 alternatives to Matt's scripts?


http://nms-cgi.sourceforge.net/

they have drop-in replacements for most of matt's old code.


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




Re: Matt Wright's formMail

2002-05-13 Thread fliptop

drieux wrote:

 
 or am I missing something here???


i think what you're missing is there's no point in trying to justify 
running any version of any of matt's code - use the drop in replacements 
at sourceforge or take the (quite unnecessary) risk.  it's as simple as 
that.


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




  1   2   3   >