PPM problem.
I am trying to install DBI module for my perl installation on XP machine. Everything was working fine, I installed a lot of modules before using the same PPM, but now it has started giving this error (as shown below). I have searched, but failed to find anything. I installed a fresh version of Perl, but it's still the same. Any ideas? - C:\Perl\binppm PPM - Programmer's Package Manager version 3.1. Copyright (c) 2001 ActiveState SRL. All Rights Reserved. Entering interactive shell. Using Term::ReadLine::Stub as readline library. Type 'help' to get started. ppm search DBI Searching in Active Repositories Error: No valid repositories: Error: 500 Can't connect to ppm.ActiveState.com:80 (Bad protocol 'tcp') Error: 500 Can't connect to ppm-ia.ActiveState.com:80 (Bad protocol 'tcp') ppm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Executing pdflatex via CGI script
Hi, I wrote a script which takes some info from the user and generates a form letter. The script is run locally for five users, so security is not that important (although it is always important, I know). The script manages to write data to my output file if I created it first and chmodded it to 666, but fails otherwise. This is because the script is run by the web user, of course. Is there a more or less secure way to allow the script to a) create / write to a file b) apply pdflatex to that file (i.e. create a pdf file from the .tex source) c) open the resulting pdf file (using the open function in OS X) I read that setiud scripts are considered a security hole, and though my environment is not that critical, I do not want to use hazardous techniques. Any hints? Thank you. - Jan -- There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Executing pdflatex via CGI script
Jan Eden wrote: The script manages to write data to my output file if I created it first and chmodded it to 666, but fails otherwise. This is because the script is run by the web user, of course. Is there a more or less secure way to allow the script to a) create / write to a file b) apply pdflatex to that file (i.e. create a pdf file from the .tex source) You can give the directory in which the file will be located 0777 permissions. Once the file has been created by the script, you can change the directory permissions to e.g. 0755. c) open the resulting pdf file (using the open function in OS X) To allow somebody but the web server to open a script created file for reading, have the script give it 0644 permissions. It sounds as if you need to read up on the Unix/Linux permissions system. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Executing pdflatex via CGI script
--- Jan Eden [EMAIL PROTECTED] wrote: a) create / write to a file b) apply pdflatex to that file (i.e. create a pdf file from the .tex source) c) open the resulting pdf file (using the open function in OS X) Set Group ID Directories? Um, allow the pdflatex to run as the web userid? Maybe just make a CGI writable directory? Put the correct WWW userid in the right pdflatex group? -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting files from the internet
This code gives me a 500 internal server error. On Thu, 14 Oct 2004 10:39:48 -0500, Charles K. Clarkson [EMAIL PROTECTED] wrote: Jeff Herbeck [EMAIL PROTECTED] wrote: : Hello, : : I want to be able to have a user login with apache : authentication (which I have that part working) and then : take a URL from a form and download the file in that url : and put it in a directory for that user. Here is what I : have so far. It runs, but it doesn't do anything but : display aaa : : #!/usr/bin/perl : : $URL = http://www.jeffherbeck.com/arch.doc;; : $remote_user = $ENV{REMOTE_USER}; : use LWP::Simple; : : getstore($URL, /var/www/html/$remote_user/); : : print Content-type: text/html\n\n; : : print aaa; Perhaps better written like this. #!/usr/bin/perl use strict; use warnings; use HTTP::Response; use LWP::Simple 'getstore'; my $url = 'http://www.jeffherbeck.com/arch.doc'; my $remote_user = $ENV{REMOTE_USER} || 'unknown_user'; my $response= HTTP::Response-new( getstore( $url, /var/www/html/$remote_user/arch.doc ) ); print Content-type: text/html\n\n, $response-status_line(); __END__ HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting files from the internet
--- Jeff Herbeck [EMAIL PROTECTED] wrote: This code gives me a 500 internal server error. And the WWW Server Logs say - what? -Sx- = -Sx- seeking employment: http://youve-reached-the.endoftheinternet.org/ ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Why are file handles wierd?
On Sat, 16 Oct 2004, Brian Gunlogson wrote: A filehandle is kinda like a namespace for the file. It shouldn't have a datatype, because it doesn't contain data. Files don't contain data?? I can see the point you're trying to convey, but this probably wasn't the most accurate way to express it... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: IO::Socket - i can't get it to read the data
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jeff 'japhy' Pinyan) writes: The problem is that your data ends in \r\n, and the \r is a carriage return. If you print jeff\rABC, you'd *see* ABCf, because the \r causes the cursor to go to the beginning of the line, thus overwriting previous letters. In your case, apparently the IP address is longer than both the username and the password, so the IP is all you're seeing. And just so the original poster knows *why* they're getting a \r, the reason is that the standard for line-oriented socket protocols is to terminate lines with \r\n. At least, what \r\n is on Unix-type systems (\015\012); Perl changes the value of \n on some other platforms. This is why Socket.pm exports upon request the symbol $CRLF, which is the proper line terminator regardless. -- Peter Scott http://www.perldebugged.com/ *** NEW *** http://www.perlmedic.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: strict getopt()
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Christian Stalp) writes: What can I do to use getopt() and use strict? If I use strict I have to declare all of my variables. And if I do this, perl ignores my getopt(s) single-chars. Is this normal? What can I do to solve this? Learn about references; there is another argument allowed for the getopts() function. Try this: use Getopt::Std; my %opt; getopts('abcde', \%opt); Now run that with some options and inspect the hash %opt after the getopts() call. I want to use perl with -w option and the strict pracma. Is this posible? Not only possible, I consider it mandatory :-) -- Peter Scott http://www.perldebugged.com/ *** NEW *** http://www.perlmedic.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Counting gaps in sequence data revisited.
I just wanted to thank everyone for their help and suggestions. This is the final full working code to count continuos gaps in a every sequence in a multi-sequence FASTA file. It may not be elegant but it is fast and works well. Sorry for the long post but I wanted to share this with those that do any DNA work. :-) I show in order: the format of the input data, the output of the input data, and finally the working script. I have yet to add comments into the code but I am sure many of you veterans will figure it out. -Thanks again all! As always comments, questions or suggestions are welcome! -Mike INPUT dog atcg--acgat---act-ca cat acgt-acgtacgt-gt-agct- mouse ---acgtacg-atcg---actgac- --- OUTPUT - ***Discovered the following DNA sequences:*** dog found! cat found! mouse found! mouse Indel size: 1 Times found:2 Positions: 11 25 Indel size: 3 Times found:2 Positions: 1 16 cat Indel size: 1 Times found:4 Positions: 5 18 21 26 Indel size: 4 Times found:1 Positions: 10 dog Indel size: 1 Times found:1 Positions: 18 Indel size: 2 Times found:1 Positions: 5 Indel size: 3 Times found:1 Positions: 12 Indel size: 4 Times found:1 Positions: 21 --- Script --- #!usr/bin/perl # By Michael S. Robeson II, with the help of friends at lernperl.org and bioperl.org! :-) # 10/16/2004 use warnings; use strict; ### # Open Sequence Data OUTFILE ### print Enter in the name of the DNA sequence file:\n; chomp (my $dna_seq = STDIN); open(DNA_SEQ, $dna_seq) or die Can't open file: $!\n; open(OUTFILE, indel_list_.$dna_seq) or die Can't open outfile: $!\n; # Read sequence data into a hash my %sequences; $/ = ''; print \n***Discovered the following DNA sequences:***\n; while ( DNA_SEQ ) { chomp; next unless s/^\s*(.+)//; my $name = $1; s/\s//g; $sequences{$name} = $_; print $name found!\n; } close DNA_SEQ; ## # iterate over gaps and write to file ## foreach (keys %sequences) { print \t\t\\ $_ \\\n; print OUTFILE \\ $_ \\\n; my $dna = $sequences{$_}; my %gap_data; my %position; while ($dna =~ /(\-+)/g) { my $gap_pos = pos ($dna) - length($) + 1; my $gap_length = length $1; #$1 =~ tr/\-+// $gap_data{$gap_length}++; $position{$gap_length} .= $gap_pos. \n; } my @indels = keys (%gap_data); my @keys = sort { $a = $b} @indels; foreach my $key (@keys) { print Indel size:\t$key\tTimes found:\t$gap_data{$key}\n; print OUTFILE Indel size:\t$key\tTimes found:\t$gap_data{$key}\n; print Positions:\n; print OUTFILE Positions:\n; print $position{$key}; print OUTFILE $position{$key}; print \n; print OUTFILE \n; } # Can replace the last foreach loop above with the while loop # below to do the same thing. Only Gap sizes will not be sorted. # nor is it set up to print to a file # # while (my ($key, $vlaue) = each (%gap_data)) { # print Indel size:\t$key\tTimes found:\t$gap_data{$key}\n; # print Positions:\n; # print $position{$key}; # print \n\n; # } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Reg ex : tabs/spaces
Howdy, I would like to remove all the spaces tabs from a variable. my($word) =Detail Design Activity Included ; $word =~ s/^\s*(\D*)\s*$/$1/; printf word=$word#\n; word=Detail Design Activity Included# the above stuff is the output and i'm stil not able to get the trailing blanks. After i'm done with this,. how can i remove the intermediate blanks which occur?? Is it best to store in a array and then join??? regards -ajey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reg ex : tabs/spaces
Ajey Kulkarni wrote: I would like to remove all the spaces tabs from a variable. No, you wouldn't. You would like to remove possible whitespace from the beginning and end of a string. my($word) =Detail Design Activity Included ; $word =~ s/^\s*(\D*)\s*$/$1/; It's best done using two substitutions: $word =~ s/^\s+//; $word =~ s/\s+$//; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reg ex : tabs/spaces
Thanks a ton Gunnar, How about the intermediate blanks? Is there a way to recursively take all blanks/tabs that occur?? word=Detail Design Activity Included# I would like to remove the blanks here.. TIA -Ajey On Sun, 17 Oct 2004, Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: I would like to remove all the spaces tabs from a variable. No, you wouldn't. You would like to remove possible whitespace from the beginning and end of a string. my($word) =Detail Design Activity Included ; $word =~ s/^\s*(\D*)\s*$/$1/; It's best done using two substitutions: $word =~ s/^\s+//; $word =~ s/\s+$//; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reg ex : tabs/spaces
Ajey Kulkarni wrote: Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: I would like to remove all the spaces tabs from a variable. No, you wouldn't. You would like to remove possible whitespace from the beginning and end of a string. my($word) =Detail Design Activity Included ; $word =~ s/^\s*(\D*)\s*$/$1/; It's best done using two substitutions: $word =~ s/^\s+//; $word =~ s/\s+$//; Thanks a ton Gunnar, How about the intermediate blanks? Is there a way to recursively take all blanks/tabs that occur?? Did you really want that? In that case I misunderstood you; Please disregard my previous suggestion. To actually remove *all* whitespace, you can simply do: $word =~ s/\s+//g; Read about the /g modifier in the description of the s/// operator in perldoc perlop. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reg ex : tabs/spaces
One more extension to this qn. #snippet to replace all the ,, with ,NEW, my($word) =Detail Design Activity Included ,-1,0 ,hello,ajey ; $word =~ s/\s+//g; $word =~ s/,,/,NEW,/gc; printf word=$word#\n; after removing the blanks ,if there are any ,, i would like to insert a NEW word there. So my regex, does this but its doing it partially. word=DetailDesignActivityIncluded,NEW,,NEW,,-1,0,hello,ajey# ^^^ ^^^ These two are again not matched. I checked the options for c Do not reset search position on a failed match when /g is in effect. g Match globally, i.e., find all occurrences. i Do case-insensitive pattern matching. m Treat string as multiple lines. o Compile pattern only once. s Treat string as single line. x Use extended regular expressions. But, this is little confusing to me. I know its greedy approach while matching patterns,but here its missing something. Where am i wrong?? My aim to have a NEW inserted btwn every ,, Regards -Ajey On Sun, 17 Oct 2004, Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: I would like to remove all the spaces tabs from a variable. No, you wouldn't. You would like to remove possible whitespace from the beginning and end of a string. my($word) =Detail Design Activity Included ; $word =~ s/^\s*(\D*)\s*$/$1/; It's best done using two substitutions: $word =~ s/^\s+//; $word =~ s/\s+$//; Thanks a ton Gunnar, How about the intermediate blanks? Is there a way to recursively take all blanks/tabs that occur?? Did you really want that? In that case I misunderstood you; Please disregard my previous suggestion. To actually remove *all* whitespace, you can simply do: $word =~ s/\s+//g; Read about the /g modifier in the description of the s/// operator in perldoc perlop. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reg ex : tabs/spaces
Ajey Kulkarni wrote: #snippet to replace all the ,, with ,NEW, my($word) =Detail Design Activity Included ,-1,0 ,hello,ajey ; $word =~ s/\s+//g; $word =~ s/,,/,NEW,/gc; The /c modifier is redundant, which Perl would have told you if warnings had been enabled. :( Please enable strictures and warnings, and have Perl help you prevent the basic mistakes! printf word=$word#\n; Don't use printf() when it's not necessary. print() is sufficient. after removing the blanks ,if there are any ,, i would like to insert a NEW word there. So my regex, does this but its doing it partially. It's doing it exactly as you tell it to do it. word=DetailDesignActivityIncluded,NEW,,NEW,,-1,0,hello,ajey# ^^^ ^^^ These two are again not matched. Do you want to insert NEW whereever there are two consecutive commas? In that case, a zero-width assertion might be what you want: $word =~ s/,(?=,)/,NEW/g; Read about extended patterns in perldoc perlre. I know its greedy approach while matching patterns,but here its missing something. Greediness has nothing to do with it. (Greediness is explained in perldoc perlre.) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Counting gaps in sequence data revisited.
I cleaned up the code a little. So, here it is for anyone interested: #!usr/bin/perl # By Michael S. Robeson II with the help from the folks at lernperl.org and bioperl.org # 10/16/2004 # Last updated: 10/17/2004 # This script was made for the purpose of searching for indels (gaps) in aligned # DNA or protein sequences that are in FASTA format. It tallys up all of the different # size gaps within each sequence string. While it does this it counts the number of # times each gap of a given size is represented in each sequence and at the same time # reports all of the positions that that particular gap-size or indel appears. # contact: [EMAIL PROTECTED] if you have questions or comments use warnings; use strict; # # Introduction # print \n\t**Welcome to Mike Robeson's Gap-Counting Script!**\n A - Just be sure that your sequence alignment file is in FASTA format! B - Make sure there are no duplicate names within an individual file! C - Output file will be based on the name of the input file. It is named by appending \'indel_list_\' to the name of your input file.\n\n; ### # Open Sequence Data OUTFILE ### print Enter in the name of the DNA sequence file:\n; chomp (my $dna_seq = STDIN); open(DNA_SEQ, $dna_seq) or die Can't open file: $!\n; open(OUTFILE, indel_list_.$dna_seq) or die Can't open outfile: $!\n; # # Read sequence data into a hash # my %sequences; $/ = ''; print \n***Discovered the following DNA sequences:***\n; while ( DNA_SEQ ) { chomp; next unless s/^\s*(.+)//; my $name = $1; s/\s//g; $sequences{$name} = $_; print $name found!\n; print\n; } close DNA_SEQ; ## # Iterate over gaps and write to file ## foreach (keys %sequences) { print \t\t\\ $_ \\\n; print OUTFILE \\ $_ \\\n; my $dna = $sequences{$_}; my %gap_data; my %position; while ($dna =~ /(\-+)/g) { my $gap_length = length $1; my $gap_pos = pos ($dna) - $gap_length + 1; $gap_data{$gap_length}++; $position{$gap_length} .= $gap_pos. \n; } my @indels = keys (%gap_data); my @keys = sort { $a = $b} @indels; foreach my $key (@keys) { print Indel size:\t$key\tTimes found:\t$gap_data{$key}\n; print OUTFILE Indel size:\t$key\tTimes found:\t$gap_data{$key}\n; print Positions:\n; print OUTFILE Positions:\n; print $position{$key}; print OUTFILE $position{$key}; print \n; print OUTFILE \n; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
HTML::TableExtract
I'm using HTML::TableExtract to pull data from a web page. the Table depth is always 6,1. It just sometimes is not there when the page is brought up. How can I tell that the table is missing using this procedure. I'm trying to error trap this situation. It causes my code to hang during the extraction of the data and writing it to file. $gExtractedTable = HTML::TableExtract-new(depth = 6, count = 1); $gExtractedTable-parse($gHTMLPage-content); print $pid, FIELD_DELIM; print outfile $pid, FIELD_DELIM; foreach $ts ($gExtractedTable-table_states) { foreach $row ($ts-rows) { print $$row[1], FIELD_DELIM; print outfile $$row[1], FIELD_DELIM; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
help with perl/cgi creating a html code with pull down menu
Hi: I have created a perl cgi script to grab two string inputs from users. The script shown below expects the user to type in the value. I would like to change this and give the user a pulldown menu to pick from a list of items. Could somebody provide help with what I need to change. = my $alertkey = param( '$selected_rows.AlertKey' ) || 0; print form action=\\/cgi-bin\/create_ticket.cgi\ method=\get\\n; print table\n; print tr\n; print tdAlertKey:/td\n; print tdinput type=text name=f_alertkey value=\$alertkey\/td\n; print /tr\n; === The above script creates a html page with the following html code = !DOCTYPE HTML PUBLIC -//IETF//DTD HTML//EN HTMLBODYbody aLink=#ff bgColor=#33 link=#ff text=#ff vLink=#cc tdAlertKey:/td tdinput type=text name=f_alertkey value=/td /tr /table p input type=submit value=Submit /form /BODY/HTML = Thanks Ravi __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: time manipulation
I performed a similar process using 2 modules: Date::Parse (to convert date strings to unix seconds) POSIX (strftime function) and Perls standard localtime function to convert back from unix seconds to a formatted date string POSIX is a standard module so your system probably already has it. John -Original Message- From: Patricio Bruna V. [mailto:[EMAIL PROTECTED] Sent: 15 October 2004 03:34 To: [EMAIL PROTECTED] Subject: time manipulation i need to do some calc with dates, time betwen one date and other, are any modules that you recommend? thx -- Patricio Bruna V. Red Hat Certified Engineer Ingeniero Soporte Linux Center S.A. Fono: 2745000 Canada 239, Providencia Santiago -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response