From cgronline at jaxcan.org Fri Dec 1 16:37:05 2000 From: cgronline at jaxcan.org (CGR Online) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] RE: Code Message-ID: On the jacksonville-pm-list; Jax.PM'er CGR Online wrote - Okay I'm lost. I can't seem to figure what's wrong. I'm getting the all too popular script headers but can pin point it to exactly where. Any ideas? #!/usr/bin/perl -w use CGI; use FileHandle; $cgiobject = new CGI; $from = $cgiobject -> param ("from"); $email = $cgiobject -> param ("email"); $subject = $cgiobject -> param ("subject"); $body = $cgiobject -> param ("body"); $htmlprint = "Content-type: Text/html\n\n"; # first let me see if this user exists unless (-e "/path/$from") { mkdir ("/path/$from", 0777) || die ("$!\n"); chdir ("/path/$from"); $fh = new FileHandle "> datafile"; $mode = 0777; chmod $mode, 'datafile'; } print "$htmlprint"; print ""; print "The following message has been sent:
"; print "To: $email
"; print "Subject: $subject
"; print "$body"; print ""; open (MAIL, "|/usr/lib/sendmail -oi $email"); print MAIL "Reply-to: $from\n\n"; print MAIL "Subject : $subject\n\n"; print MAIL "$body\n"; close (MAIL); open (DATA, ">>/path/$from/datafile") || die ("Can not open file because ... $!"); print DATA "To - $email\n"; print DATA "Subject - $subject\n"; print DATA "\t\t$body\n\n"; close (MAIL); I know it's a simple script but i'm just learning PS(Thanx bill for the heads up) --- Sir Anvil www.christiangamers.org Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From jproctor at oit.umass.edu Sun Dec 3 11:20:14 2000 From: jproctor at oit.umass.edu (j proctor) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] RE: Code In-Reply-To: Message-ID: On the jacksonville-pm-list; Jax.PM'er j proctor wrote - > Okay I'm lost. I can't seem to figure what's wrong. I'm getting the all > too popular script headers but can pin point it to exactly where. Any > ideas? 1. If you haven't already, try running it from the command line. You can pick out all sorts of interesting things that way. The CGI module detects this, too, and you can enter name=value pairs, one per line, as if the form submission were coming from STDIN. Press ^D (on most systems) to end input. > #!/usr/bin/perl -w > use CGI; > use FileHandle; > > $cgiobject = new CGI; > $from = $cgiobject -> param ("from"); > $email = $cgiobject -> param ("email"); > $subject = $cgiobject -> param ("subject"); > $body = $cgiobject -> param ("body"); > $htmlprint = "Content-type: Text/html\n\n"; "text/html" may need to be all lower case. I don't know if the server or the browser is case-sensitive, but it's how I've always seen MIME types. > # first let me see if this user exists > unless (-e "/path/$from") > { > mkdir ("/path/$from", 0777) || die ("$!\n"); > chdir ("/path/$from"); > $fh = new FileHandle "> datafile"; > $mode = 0777; chmod $mode, 'datafile'; > } > > > print "$htmlprint"; > print ""; Stylistic note: Since the contents of this line don't change, you could have used single quotes and avoided having to \ the internal ones. It took me a long time to warm up to it, but a better practice, used by many who have significantly more experience than both of us put together, is to use qq(). You can use it on every line, since it does variable interpolation, and you can use beginning and end markers other than () if you're going to have those embedded in the string. > open (MAIL, "|/usr/lib/sendmail -oi $email"); Sometimes, sendmail is configured to be kinda fussy about who it lets send messages to whom. I don't think this is your problem, but running it by hand will show you if it is. I've started using Net::SMTP instead, because it doesn't rely on a particular daemon to be in place. j Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From cgronline at jaxcan.org Tue Dec 5 20:53:55 2000 From: cgronline at jaxcan.org (CGR Online) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] Struggling Message-ID: On the jacksonville-pm-list; Jax.PM'er CGR Online wrote - Here is what I'm mainly struggling w/ right now. I'm trying to use perl to creat a directory with 777 permissions (read/write/execute for all) and within that directory an empty file with the same permissions. I've managed to get a direcory with 776 permission but the file has almost no permissions what so ever. Here is my sniplet code use FileHandle; $fh = new FileHandle "> datafile"; $mode = 0777; chmod $mode, 'datafile'; --- Sir Anvil www.christiangamers.org Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From wcjones at exchange.fccj.org Wed Dec 6 06:53:07 2000 From: wcjones at exchange.fccj.org (JONES, WILLIAM C) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] Struggling Message-ID: <3037C11AF59BD411B47600D0B72CE748303AFC@exchmail.fccj.cc.fl.us> On the jacksonville-pm-list; Jax.PM'er "JONES, WILLIAM C" wrote - try this on for size (you may need to fix email formatting errors): #!/usr/bin/perl -w # 'security.pl' - Perl script example showing how File Permissions work... # written by Sneex, -IUDICIUM- on 15/Oct/98 @ 22:00... # Use some specialized Perl Modules... use strict; use diagnostics; use POSIX; use IO; # Get the date in the format of 'Sun Sep 6 18:04:46 1998' my $ltDate = localtime; # Now get the Serialized Date, and string'em back together... my ($seconds, $minutes, $hour, $monthDate, $month, $year, $weekDay, $yearDate, $daylightSavings) = localtime; my $ltSerial = "$seconds$minutes$hour$monthDate$month$year$weekDay$yearDate$daylightSavings" ; # Name the output test file... my $file = "test.File"; # Open it Write Only (O_WRONLY), in Append Mode (O_APPEND), # if it already exists; otherwise Create the file (O_CREAT) # Set the file permission bits to 0777 ( -rwxrwxrwx ) my $fh = new IO::File $file, O_WRONLY|O_APPEND|O_CREAT, 0777; # Create specialized security marker. # (This is just output as test data...) if (defined $fh) { print $fh "$ltSerial|$ltSerial|$ltDate\n"; undef $fh; } else { print "Oops! Betcha that hurt: $!"; } # Flush all I/O buffers... autoflush STDOUT 1; # Quit... exit; # The above quit is redundant as all perl scripts # will automatically 'exit' (cleaning up behind # themselves) when there is no more code to evaluate... # NOTES: # # When the above is executed, it will create a # file called 'test.File' in the current directory. # Inside that file it will write some data which # looks like this - # # 211221599842871|211221599842871|Thu Oct 15 22:01:21 1998 > ---------- > From: CGR Online > Reply To: CGR Online > Sent: Tuesday, December 5, 2000 9:53 PM > To: jacksonville-pm-list@happyfunball.pm.org > Subject: [JaxPM] Struggling > > On the jacksonville-pm-list; Jax.PM'er CGR Online > wrote - > > use FileHandle; > > $fh = new FileHandle "> datafile"; > $mode = 0777; chmod $mode, 'datafile'; > Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From wcjones at exchange.fccj.org Fri Dec 8 08:06:44 2000 From: wcjones at exchange.fccj.org (JONES, WILLIAM C) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] [Non-Perl] FW: O'Reilly Peer-to-Peer Conference Information Message-ID: <3037C11AF59BD411B47600D0B72CE748303B03@exchmail.fccj.cc.fl.us> On the jacksonville-pm-list; Jax.PM'er "JONES, WILLIAM C" wrote - [Non-Perl Related posting by Jax.PM Group Leader: -Sneex- :] -----Original Message----- From: Denise Olliffe To: bill@fccj.org Sent: 12/7/00 6:20 PM Subject: O'Reilly Peer-to-Peer Conference Information A while ago, I sent an email alerting you that O'Reilly would be hosting a conference on Peer-to-Peer technologies. Here is information I'm sure you've been waiting for... Announcing the O'Reilly Peer-to-Peer Conference February 14-16, 2001 Westin St. Francis Hotel, San Francisco, California The cluster of technologies we're now calling peer-to-peer is a melting pot of ideas that's about to boil over. The O'Reilly P2P Conference, the first and most important conference on P2P, will provide a unique opportunity for developers, entrepreneurs, investors, and those making technology-buying decisions to find out what's really going on. This conference explores the business and technical questions raised by the most revolutionary new Internet applications since the Web. Napster,Gnutella, Freenet, Infrasearch, SETI@Home, Popular Power, Groove, Jabber,UDDI, you name it, they'll all be there under one roof, providing a unique opportunity to meet and learn from the technology and business innovators who are shaping the next generation of pervasive technologies. Speakers include: Gene Kan, Ian Clarke, Ray Ozzie, Dave Anderson, and others who are shaping the P2P revolution "This is the next great thing for the Internet. We haven't even begun to understand or imagine the possibilities." --Lawrence Lessig, P2P Conference Keynote Speaker For conference and registration info go to: http://conferences.oreilly.com/p2p/ Check out Tim O'Reilly's latest article "Remaking the Peer-to-Peer Meme." http://www.oreillynet.com/pub/a/p2p/2000/12/05/book_ch01_meme.html For directory information on P2P companies, projects and initiatives, take a look at: http://www.oreillynet.com/pub/q/p2p_category ********************************************************************** O'Reilly User Group Program members receive 20% discount on conference prices. Register early--limited space is available. Please use the discount code *DSUG* when registering. This discount is meant for use by your current UG members only. If posting information about this conference on your website, please do not include discount information. For more details or brochures, please contact Denise Olliffe, deniseo@oreilly.com or 707-829-0515 ext 339. ********************************************************************** Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From wcjones at exchange.fccj.org Fri Dec 8 09:22:31 2000 From: wcjones at exchange.fccj.org (JONES, WILLIAM C) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] Perl Code - RFC Message-ID: <3037C11AF59BD411B47600D0B72CE748303B08@exchmail.fccj.cc.fl.us> On the jacksonville-pm-list; Jax.PM'er "JONES, WILLIAM C" wrote - Re below code - Current Jax.PM member thoughts would be most appreciated :) Thx! -Sneex- PS - May need to fix e-mail formatting errors - sorry about that in advance (Outlook via web sux.) #!/usr/local/bin/perl -w use strict; use diagnostics; $|++; my $ctr; my $erc; my $partA; my $partB; my $dir; my $filename; my $letter; my $rawname; my $lineOne; my $lineTwo; ######### Phase I Processing... ######### ########## Process Cooked file data now... open (RFILE, "CD.Cooked") or die "\n\nCan't open CD.Cooked for writing: $!\n\n"; while () { $ctr++; # Count lines read... s/\n/ /; # newline to space... s/^\s+//; # compress leading whitespace... s/\s+$//; # compress trailing whitespace... next unless length; # anything to process? # Groups if (/^\D{3,4}\s{1}\-/) { print NFILE "\n\n$_ "; next; } # Course Numbers if (/^\D{3,4} (\d{4}(\D)?|XXXX)/) { print NFILE "\n\n$_ "; next; } # Credit Hours if (/^\d{1} Credit/) { print NFILE " $_\n "; next; } # Everything else... print NFILE " $_ "; } # end while loop close (RFILE) or die "\n\nCan't close CD.raw: $!\n\n"; close (NFILE) or die "\n\nCan't close CD.Cooked: $!\n\n"; print "\nProcessed $ctr lines...\n\n"; ######### Phase II Processing... ######## ########## Process Cooked file data now... $ctr = 0; open (NFILE, ") { $ctr++; # Count lines read... chomp; s/^\s+//; # compress leading whitespace... s/\s+$//; # compress trailing whitespace... next unless length; # anything to process? # Groups if (/^\D{3,4}\s{1}\-/) { /^[A-Z]{3,4}/; $dir = $&; next if (-d $dir); $erc = system("mkdir $dir") / 256 unless (-d $dir); die "$! : $erc during create on $dir..." if ($erc); $letter = substr($dir,0,1); $erc = system("mkdir $letter") / 256 unless (-d $letter); die "$! : $erc during create on $letter..." if ($erc); next; } # Course Numbers if (/^\D{3,4} (\d{4}(\D)?|XXXX)/) { $lineOne = $_; /^[A-Z]{3,4}/; $partA = $&; /(\d{4}(\D)?|XXXX)/; $partB = $&; $filename = $partA . $partB . ".html"; $rawname = $partA . $partB; $filename =~ s/\s//; $rawname =~ s/\s//; print "Working on both $rawname \& $filename\n"; if (-e "$dir/$filename") { print "WARNING: $dir/$filename duplicate; renaming to $dir/X$filename ... \n"; $filename = 'X' . $filename; } if (-e "$dir/$rawname") { print "WARNING: $dir/$rawname duplicate; renaming to $dir/X$rawname ... \n"; $rawname = 'X' . $rawname; } open (OFILE, ">$dir/$filename") or die "$! while trying $dir/$filename"; open (IFILE, ">$dir/$rawname") or die "$! while trying $dir/$rawname"; $erc = system("cd $letter && ln -s ../$dir/$filename .") / 256 unless (-e "$letter/$filename"); die "FATAL: $! : $erc during link on $letter/$filename..." if ($erc); $erc = system("cd $letter && ln -s ../$dir/$rawname .") / 256 unless (-e "$letter/$rawname"); die "FATAL: $! : $erc during link on $letter/$rawname..." if ($erc); print OFILE "FCCJ Course Description: $rawname College Credit Course Description: $rawname

 

    $lineOne"; print IFILE "$lineOne\n"; next; } else { $lineTwo = $_; print OFILE "
  • $lineTwo
\n"; print IFILE "$lineTwo\n"; next; } } # end while loop close (NFILE) or die "\n\nFATAL: Can't close source file: $!\n\n"; close (IFILE) or die "\n\nFATAL: Can't close html file: $!\n\n"; close (OFILE) or die "\n\nFATAL: Can't close text file: $!\n\n"; print "\nProcessed $ctr lines...\n\nCreating symbolic file and directory links, please wait...\n\n"; ######### Phase III Processing... ####### ########## Process Cooked file data now... ########################################################### # Make ln -s Directory links from Uppercase to Lowercase... # -Sneex- :] $ctr = 0; my $pwd = `pwd`; opendir TARGETDIR, "." or die "FATAL: Can't open $pwd : $! "; my @dir = grep !/^\./, readdir TARGETDIR; closedir TARGETDIR; foreach (@dir) { s/\s//; # Should not be any spaces in these dir names... next if (/\.(\.)?/); # Is it a file with dots in it? # next if (-f $_); # or is it a plain old file? print "Working on $_ \n" unless (-f $_); my $lc = lc($_); $ctr++; $erc = system("ln -s $_ $lc") / 256; die "FATAL: $erc $! $? error occurred...\n" if $erc; } print "\nProcessed $ctr directory links...\n\nDone!\n\n"; __END__ Any project notes go here... Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From wcjones at exchange.fccj.org Fri Dec 8 09:59:17 2000 From: wcjones at exchange.fccj.org (JONES, WILLIAM C) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] Perl Code - RFC Message-ID: <3037C11AF59BD411B47600D0B72CE748303B09@exchmail.fccj.cc.fl.us> On the jacksonville-pm-list; Jax.PM'er "JONES, WILLIAM C" wrote - Oops! Seems I forgot the test data. Mea Culpa! Since the raw file is 10MB+ - I'll send snippets :) (Thx for reminding me Steve :) For the 'test' file, see: http://web.fccj.org/~dcyphers/Sneex/CD/CD.raw A snippet - ACG - Accounting: General ACG 2021 Financial Accounting (Y) 4 Credit Hours This course is the study of the area of accounting that specializes in the processes and principles used to prepare financial statements. Four contact hours. ACG 2071 Managerial Accounting (Y) 3 Credit Hours Prerequisite: ACG 2021. This course interprets and analyzes three major areas: planning and controlling routine operations (break-even analysis, job order and process cost systems); inventory valuation and income determination (budgeting and standard costing); and policy making and long-range planning (capital budgeting). Three contact hours. ACG 2100 intermediate Accounting I (Y) 3 Credit Hours Prerequisite: ACG 2021. This course is a continuation of accounting principles including a review of the accounting cycle with special attention given to working capital, an in-depth study of financial statements, cash, receivables, current liabilities, inventories, plant and equipment assets and intangible assets. Three contact hours. ACG 2110 intermediate Accounting II (Y) 3 Credit Hours Prerequisite: ACG 2100. This course is a continuation of intermediate Accounting I with coverage of the following topics: a study of corporate contributed capital, retained earnings and dividends, earnings per share, long-term debt and investments, pension plans and leases, accounting for income taxes, the statement of changes in financial position, accounting for price level changes and further statement analysis. Three contact hours. ACG 2500 Fund Accounting (Y) 3 Credit Hours Prerequisite: ACG 2071. This course, recommended for associate in science in accounting students, is a study of the accounting methods and procedures used by not-for-profit organizations such as governmental agencies, hospitals and charitable organizations. Three contact hours. ADV - Advertising ADV 2000 Advertising (Y) 3 Credit Hours This basic course, designed to familiarize students with the function of the advertising profession, covers consumer behavior, research and market segmentation. The course examines various kinds of advertising departments as well as the functions of the advertising agency itself - copy, art, media selection, TV/radio production, print production and account management. Students will pre pare print advertisements and produce TV and radio commercials. Three contact hours. Thx! -Sneex- :] Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From jproctor at oit.umass.edu Fri Dec 8 10:36:22 2000 From: jproctor at oit.umass.edu (j proctor) Date: Thu Aug 5 00:02:40 2004 Subject: [JaxPM] Perl Code - RFC In-Reply-To: <3037C11AF59BD411B47600D0B72CE748303B08@exchmail.fccj.cc.fl.us> Message-ID: On the jacksonville-pm-list; Jax.PM'er j proctor wrote - > Re below code - Current Jax.PM member thoughts would be most appreciated :) What kind of comments? Style? It's misbehaving and you don't see it? Looking for logical traps? I can't possibly look through it in detail until next week. If that's soon enough, I don't mind doing it. One quick thing as I skimmed it... somewhere near line 39: > # Course Numbers > if (/^\D{3,4} (\d{4}(\D)?|XXXX)/) { > print NFILE "\n\n$_ "; > next; > } I'm nearly certain the first CS class I took at UNF was COP3002CS (say hi to Bob Rinker for me if you ever see him). I don't see it in their current course listing, but there are a couple others with more than one letter after the number. Without knowing what you've got for input, I'd probably go with something more like /^\D{3,4}\s?(?:\d{4}(?:\s?\D*)|XXXX)/ The ?: only work in Perl 5, of course, and the regex will work just fine without them. Anyone ever benchmark to see if not setting the backref variables if you're not going to use them gives enough of a speed boost to overcome (presumably) the overhead of the (?: ... ) construct? I'd use \s? in the one above it, too, unless you really do mean exactly one space (and even then, isn't {1} extraneous?), and \s+ (etc.) in the one below it. If you have to "cook" the file to begin with, how certain is the spacing of trivial things like course numbers? Also, can you rule out descriptions like "This 2000 level course ..."? Briefly, I'm also going to question the wisdom of writing the cooked data to a separate file, because I didn't actually read far enough to see if you did anything with it other than reopen it to snarf everything back in (and sort out what kind of data it is again). Damn. Now you've got me thinking about state machines. j Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments... From cgronline at jaxcan.org Sat Dec 23 19:41:37 2000 From: cgronline at jaxcan.org (CGR Online) Date: Thu Aug 5 00:02:40 2004 Subject: No subject Message-ID: On the jacksonville-pm-list; Jax.PM'er CGR Online wrote - Hey guys. Welp, I did it. Created my first perl program. naturally the first program is a guestbook, as I've noticed that's the first one many people use. feel free to check it out at my website. --- Sir Anvil www.christiangamers.org Jax.PM Moderator's Note: This message was posted to the Jacksonville Perl Monger's Group listserv. The group manager can be reached at -- owner-jacksonville-pm-list@pm.org to whom send all praises, complaints, or comments...