Config file

2003-12-02 Thread Rod
What is the best way to read a config file for a perl script. I have some very ugly code that can do it, but I would like to find something cleaner. Thanks, Rod. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Match the first 3 characters of 2 words?

2003-12-10 Thread Rod
What is the easiest way to test the first 3 characters of two words for a match. IE: "dasf" test "dasg" to return positive. rod. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: Splitting string using split()

2001-07-17 Thread Crowder, Rod
There is a module Text::CSV_XS that handles (surprise!) CSV files, which understands quoted strings with commas. I can make it work, so it must be easy -Original Message- From: Mike Miller [mailto:[EMAIL PROTECTED]] Sent: 18 July 2001 02:47 To: [EMAIL PROTECTED] Subject: Splitting string

RE: Sending a mail using telnet 25 smtp(OT)

2001-07-24 Thread Crowder, Rod
A simple example of sending mail using telnet. this sends mail to [EMAIL PROTECTED] The bits you send are in braces {}, you do not type these!! Some hosts may be more fussy, they check that the hostname you give and the IP address match, and may only accept mail from a restricted list of hosts. se

RE: Sending a mail using telnet 25 smtp(OT)

2001-07-24 Thread Crowder, Rod
A simple example of sending mail using telnet. this sends mail to [EMAIL PROTECTED] The bits you send are in braces {}, you do not type these!! Some hosts may be more fussy, they check that the hostname you give and the IP address match, and may only accept mail from a restricted list of hosts. se

RE: perl debugger

2001-08-03 Thread Crowder, Rod
-Original Message- From: Ruth Albocher [mailto:[EMAIL PROTECTED]] Sent: 02 August 2001 10:56 To: [EMAIL PROTECTED] Subject: perl debugger hi all. Is there any good stable graphic debugger for perl? thanks Try the one in the ActiveState Perl Dev Kit. You can do

RE: inquiry

2001-08-21 Thread Crowder, Rod
> -Original Message- > From: webmaster [mailto:[EMAIL PROTECTED]] > Sent: 21 August 2001 14:48 > To: perl > Subject: inquiry > > > what does > Global symbol "@ARG" requires explicit package name at > testbio1.pl line 4. > Global symbol "$sbjct_scr" requires explicit package name at >

RE: Strange foreach need..........

2001-08-24 Thread Crowder, Rod
",$first, $second); } Rod the IFFO Mailto:[EMAIL PROTECTED] Tel: +44-1293-584145 Mob: +44-7711-553080 Fax: +44-1293-584994 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: sendmail and newlines

2001-08-24 Thread Crowder, Rod
newlines with newlines for formatting to represent the two backslashes in you input file Hope this makes sense Rod the IFFO Mailto:[EMAIL PROTECTED] Tel: +44-1293-584145 Mob: +44-7711-553080 Fax: +44-1293-584994 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: remote share disk usage for nt/win2k

2001-09-05 Thread Crowder, Rod
Here's something on those lines That I used with IIS The user must be a member of "Domain Admins" group It does a simple check of space left against a limit and highlights disks under the limit HTH Rod > -Original Message- > From: John W. Sims [mailto:[EMAIL P

IDE for perl?

2001-05-09 Thread Rod Suter
I'm using perl through emacs, but I want to bring along some people on NT4.0. They're accustomed to Visual Studio, and want IDE features, such as project directories, global search and replace, debugger linking, source code error hilighting, etc. Can anyone suggest a good group environment for

Re: foo bar? -Reply

2001-05-16 Thread Rod Suter
Actually, the American military acronym 'fubar' goes back at least to World War II. The use of 'foo' and 'bar' as metasyntactic variables probably dates to the the lisp hackers at the MIT AI lab in the 50's or 60's , before unix. Foo and bar function like 'x' or 'n' in the traditional mathe

PPM Errors after update

2001-09-26 Thread Crowder, Rod
GIN failed--compilation aborted at D:\PERL\BIN/ppm line 8. Any suggestions how to proceed, other than delete D:\PERL and start again?? Rod CROWDER Mailto:[EMAIL PROTECTED] Tel: +44-1293-584145 Mob: +44-7711-553080 Fax: +44-1293-584994 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additio

File::Basename Under W98

2001-09-27 Thread Crowder, Rod
uot;XYZData.txt.log" Any Ideas as to what I am doing wrong? Rod CROWDER Mailto:[EMAIL PROTECTED] Tel: +44-1293-584145 Mob: +44-7711-553080 Fax: +44-1293-584994 print ("Enter name of source file :"); $SourceFile = <>; chomp $SourceFile; open( STDIN, "<$SourceFile&q

RE: Windows drive mapping in perl

2001-09-27 Thread Crowder, Rod
Try the Roth Consulting Win32::AdminMisc Module, there's a whole shedload of W32 goodies http://www.roth.net/perl/adminmisc Don't know if this includes a "Map drive" function, but I have used some of these with great success Rod > -Original Message- > Fro

RE: eval problem

2001-10-02 Thread Crowder, Rod
is "hi" > to be stored in > some variable also. > > Please help, > > TIA, > -Mini. Rather than use the eval command, use backticks like this $A = `echo "Hello World"`; print "Command has run, \$A is:"; print $A; $A will contain the output of t

RE: Copy file output to a text file

2001-10-04 Thread Crowder, Rod
output from the ifconfig command. You should now be able to separate the part you need with pattern matching. HTH Rod the IFFO > -Original Message- > From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]] > Sent: 04 October 2001 08:20 > To: [EMAIL PROTECTED] > Subject: Copy file o

Use of XML::Simple and hashrefs

2001-10-05 Thread Crowder, Rod
to get this working b) point me to a "Janet & John" type explanation of references TIA Rod the IFFO ===XML= Transfer from Elsewhere Transfer from Elsewhere Code== use strict; use warnings; use XML::Simple; use Data::Dumper; my $

RE: Use of XML::Simple and hashrefs

2001-10-05 Thread Crowder, Rod
a "Janet & John" type explanation of references > perldoc perlreftut Next time, like the FAQ says I will RTFM first Rod -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Getting a module to work

2001-10-30 Thread Crowder, Rod
> -Original Message- > From: Simon Rowan [mailto:[EMAIL PROTECTED]] > Sent: 29 October 2001 16:43 > To: [EMAIL PROTECTED] > Subject: Getting a module to work > > > Ok, I give up. How do I install a new module? > > I am using Activeperl 5.6 (Build 631) and have downloaded a module > Wi

RE: Off-Topic (200%) - Where are you from?

2001-11-12 Thread Crowder, Rod
Crawley, Sussex, UK (Next to Gatwick airport) > -Original Message- > From: PURMONEN, Joni [mailto:[EMAIL PROTECTED]] > Sent: 12 November 2001 14:10 > To: '[EMAIL PROTECTED]' > Subject: RE: Off-Topic (200%) - Where are you from? > > > hey, Yet Another Finn here as well (although currentl

RE: Redirecting STDERR to 2 locations simultaneously

2001-11-13 Thread Crowder, Rod
Try the Module IO::Tee, I haven't used it, but it's description sounds to be what you need > -Original Message- > From: Peter Scott [mailto:[EMAIL PROTECTED]] > Sent: 13 November 2001 07:01 > To: [EMAIL PROTECTED] > Subject: Re: Redirecting STDERR to 2 locations simultaneously > > >

RE: Off-Topic (200%) - Where are you from?

2001-11-14 Thread Crowder, Rod
> -Original Message- > From: Michael Fowler [mailto:[EMAIL PROTECTED]] > Sent: 13 November 2001 21:15 > To: Elliott, Don (Police) > Cc: '[EMAIL PROTECTED]' > Subject: Re: Off-Topic (200%) - Where are you from? > > > On Tue, Nov 13, 2001 at 02:51:01PM -0600, Elliott, Don (Police) wrote:

RE: witing to %ENV permanently

2001-11-19 Thread Crowder, Rod
The environment var you set is only available to the perl program and any child processes it produces. Try calling the Tecplot macros from within your perl program using system() or the backtick method. HTH Rod C -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

RE: writting in a file

2001-11-21 Thread Crowder, Rod
> -Original Message- > From: Franck Collineau [mailto:[EMAIL PROTECTED]] > Sent: 20 November 2001 13:57 > To: [EMAIL PROTECTED] > Subject: writting in a file > > > Hi! > > I have the follwing code: > > #!/usr/bin/perl -w > open(FIC,"/home/collineau/Perl/Programmes/01_informatique/sau

RE: Outputing data for Excel / PDF

2001-11-26 Thread Crowder, Rod
Goto http://search.cpan.org and search for PDF, gives a number of modules relating to PDF files. I have not used these, so I can't make any recommendations. -Original Message- From: paul beckett (JIC) [mailto:[EMAIL PROTECTED]] Sent: 26 November 2001 15:02 To: [EMAIL PROTECTED] Subject: O

RE: Re[2]: create an NT user with Perl

2001-12-04 Thread Crowder, Rod
Here Is a sample user setup script (A work in progress) which I wrote for setting up new users. Win32::AdminMIsc is available from www.roth.net and is well worth a look for anyone involved in the admin of a M$ notwork. Rod Crowder -Original Message- From: John Edwards [mailto:[EMAIL

RE: Working with Perl Modules

2001-12-07 Thread Crowder, Rod
Do you have Active State's perl? The package is available using PPM from their repository, and shouldn't need any compilation. -Original Message- From: Sharat Hegde [mailto:[EMAIL PROTECTED]] Sent: 07 December 2001 06:45 To: [EMAIL PROTECTED] Subject: Working with Perl Modules Hello, I

RE: chomp

2001-12-19 Thread Crowder, Rod
No, chomp removes any "\n" at the end of a string. see perldoc -f chomp Rod -Original Message- From: Purshottam Chandak [mailto:[EMAIL PROTECTED]] Sent: 19 December 2001 08:05 To: [EMAIL PROTECTED] Subject: chomp If I type, $date = 19990417; chomp $date; - will ever

Parsing binary file.

2004-06-15 Thread Rod Za
Hello all, I am trying to read a binary file (HP-PCL file (windows printer)) to count the number of pages and copies. Can someone help me? I got a C code that works good - but i want to do that in Perl to learn. thank you very much. Rod Za

How to creating a package.

2004-06-16 Thread Rod Za
Hi, i like to create somethings like classes in an OOP language. The code below is correct? _BEGIN_ package PACKAGE_NAME; use strict; use warnings; our $VERSION = '0.1'; sub new{ my $self = {}; $self->{SOME_VAR} = undef; $self->{SOME_VAR2} = undef; bless $self;

regex in perl.

2004-06-17 Thread Rod Za
Hello, Someone know how can i search this in a file using regex? %! or \004%! or \033%-12345X%!PS or LANGUAGE=POSTSCRIPT or LANGUAGE = POSTSCRIPT or LANGUAGE = Postscrip Thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam pro

Class to select/insert/delete/update

2004-06-24 Thread Rod Za
Hello, i'm trying to make a class to do select/insert/delete/update on a MySQL table (via DBI). this is a snip of code: sub query{ my $self = shift; my($sql) = @_; my @result; my $sth = $self->{dbh}->prepare($sql) or return undef; if($sql =~ /delete|insert

ways to change the first char from a filename (with full path)

2004-06-29 Thread Rod Za
/filename.pl /var/spool/cups/d1 will print: Original Filename: /var/spool/cups/d1 - Changed Filename: /var/spool/cups/c1 Thank you. Rod __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions

RE: ways to change the first char from a filename (with full path )

2004-06-29 Thread Rod Za
Bob and Thomas, Thank you, very much. Rod Za --- Bob Showalter <[EMAIL PROTECTED]> wrote: > Rod Za wrote: > > Hi all, > > > > i'm trying to make a code that get a file name (with full path) and > > change the first char of the filename. Someone can say me

how to load the printer jobs number.

2004-06-30 Thread Rod Za
Hi, Anyone got a suggestion on how i can load the jobs in a printer? i use somethings like this: @jobs= `/usr/bin/lpstat -P HP2200V | cut -d"-" -f2 | cut -d" " -f1`; this show me something like this: 3259 3260 that are the number of the job for the HP2200V There are other way to do that? tha

function that returns a HASH.

2004-06-30 Thread Rod Za
Hi all, I'm trying to use the Net::CUPS::Printer::cupsGetJobs() function. In theory this function returns the jobs a cups printer got printed or to be printed. I'm using this like: _BEGIN_ use Net::CUPS::Printer; my %jobs = cupsGetJobs('HP4100V',0,0); foreach $key (keys %jobs){ print $jo

Re: function that returns a HASH.

2004-06-30 Thread Rod Za
Oliver, this is wanderful! :) Thank you very much! --- Oliver Schnarchendorf <[EMAIL PROTECTED]> wrote: > to see what's going on in structured data types I strongly recommend the use > of DATA::DUMPER. > > Just include the module into your source code and when you print the $job

Re: function that returns a HASH.

2004-06-30 Thread Rod Za
t starting with perlreftut; you can skip straight to the section labeled 'Syntax' if the history of references in perl isn't interesting to you. at london.pm.org --- Oliver Schnarchendorf <[EMAIL PROTECTED]> wrote: > On Wed, 30 Jun 2004 11:44:53 -0700 (PDT), Rod Za

Fill a string with zeros.

2004-07-02 Thread Rod Za
Hi all, Someone knows an way to do this more easy? _BEGIN_ #!/usr/bin/perl use warnings; use strict; my $job = 15; my $job_name = 'd0'; print "JOBNAME $job_name LENGTH: ".length($job_name)."\n"; print "JOB...: $job LENGTH: ".length($job)."\n"; print substr($job_name,-length($job_name),-l

Re: Fill a string with zeros.

2004-07-02 Thread Rod Za
Hey Philipp, this is was i need! :) --- Philipp Traeder <[EMAIL PROTECTED]> wrote: > On Friday 02 July 2004 15:55, Rod Za wrote: > Hi Rod, > > take a look at the sprintf function ("perldoc -f sprintf") - something like: > > #!/usr/bin/perl -w > use s

Help with HASH.

2004-07-02 Thread Rod Za
Hello all, I want to make a function to list all jobs name from a printer. The format of the jobs name is like d1-001, d2-001. To list all the jobs and get the correct job name, i use the lpstat command, that returns me lines like this one: _DATA_ HP4100V-4 rodza 2

Re: Help with HASH.

2004-07-02 Thread Rod Za
--- Wiggins d Anconia <[EMAIL PROTECTED]> wrote: [snip] > > _BEGIN_ > > #!/usr/bin/perl > > use warnings; > > use strict; > > Excellent start... :) thank you [snip] > > for(my $i=0; $i < @lpstat; $i++){ > > $lpstat[$i] =~ /\w+\-(\d+)\s+(\w+)\s+/; > > $job

Re: Help with HASH.

2004-07-02 Thread Rod Za
--- Wiggins d Anconia <[EMAIL PROTECTED]> wrote: > > You only have to dereference if you are trying to do something to the > > structure in aggregate, aka you have to supply a hash, such as is the > > case for 'keys', 'values', and 'each'. If you want to access a single > > value from the nested h

Re: Help with HASH.

2004-07-02 Thread Rod Za
Wiggins, just one more thing, how can i get the number of elements from an hash like this one that i'm trying to use? --- Wiggins d Anconia <[EMAIL PROTECTED]> wrote: > > > > foreach my $keys (keys %{ $printers{jobs} }) { __ Do you Yahoo!? New

Re: Help with HASH.

2004-07-05 Thread Rod Za
Hey John, Thank you very much for the hints. --- "John W. Krahn" <[EMAIL PROTECTED]> wrote: [snipped] > sub lst_job { > my $printer = shift; > my $flag; > return name => $printer, jobs => { > map +( $flag = !$flag ) ? sprintf( 'd%05d-001', $_ ) : $_, > map /^\w+-(\d+)

how to date/time transforming

2004-07-05 Thread Rod Za
How to transform a date in format: Thu Jan 18 03:45:50 GMT 1973 or Qui 01 Jul 2004 21:39:21 BRT to format: 1973-01-18 / 2004-06-01 thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.co

Re: how to date/time transforming

2004-07-05 Thread Rod Za
Gunnar, --- Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Rod Za wrote: > > How to transform a date in format: > > Thu Jan 18 03:45:50 GMT 1973 > > or > > Qui 01 Jul 2004 21:39:21 BRT > > > > to format: > > > > 1973-01-18 / 2004-06-01

Help with array reference that has a HASH reference.

2004-07-05 Thread Rod Za
Hi, I'm trying to do a function that load all the jobs from the printers on systems (Unix), and this function returns a hash that has the printer name, the number of jobs and an array that got another hash with the names of job, owner jobs, date of the job. I thinks something like this: my %ha

RE: Help with array reference that has a HASH reference.

2004-07-06 Thread Rod Za
=> $2, > job_date=> $3, > }; > } What the \Q \E /ox in the regex does ? HTH, Rod __ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail -- To unsu

Re: Is "Thank you" okay? [was: where to put modules?]

2004-07-09 Thread Rod Za
--- jason corbett <[EMAIL PROTECTED]> wrote: > One observation I have made is that this list sometimes looks like a > help desk forum: Somebody asks a question, and get one or a few > replies, and that's it. I don't know if that's how it's supposed to > be, but personally I would like to see more o

Re: regex help : find % not within <>

2004-07-09 Thread Rod Za
Try this: _BEGIN_ #!/usr/bin/perl use warnings; use strict; my $html = 'some value%'; $html =~ /(?:\<.+\>)?(.+\%)(?:\<.+\>)?/; print $1; _END_ HTH, Rod --- Wiggins d Anconia <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I need to find all

Is the var recreated in a foreach loop using `my`?

2004-07-16 Thread Rod Za
27;,'b','c','d','e'); #is a new the array reated here? or is the same array? print "$_ = @array2\n"; } _END__ _RESULT_ 1 = 1 a b c d e 2 = 2 a b c d e 3 = 3 a b c d e 4 = 4 a b c d e 5 = 5 a b c d e 6 = 6 a b c d e 7 = 7 a b c d e 8 = 8 a

RE: Is the var recreated in a foreach loop using `my`?

2004-07-16 Thread Rod Za
;ARRAY(0x81034cc) = 4 4 4 4 >ARRAY(0x8103514) = 5 5 5 5 5 how can i access, for example, the array referenced by (0x80f827c)? Thank you very much, Rod --- Bob Showalter <[EMAIL PROTECTED]> wrote: > Rod Za wrote: > > Hi, > > > > I have a doubt. If i creat

"or die" question

2005-01-25 Thread Rod Jenkins
}; This does not work, but what is the "right" way to do this? I know I could write a MyDie sub and pass a string to it. Rod Jenkins Rod Jenkins ISP Systems Engineer Iowa Telecomunications Systems Cell: (641) 521-4423 PGP Key: http://www.iowatelecom.net/~rodj/key.txt -- To unsubsc

Re: "or die" question

2005-01-25 Thread Rod Jenkins
On Jan 25, 2005, at 8:33 AM, Bob Showalter wrote: Rod Jenkins wrote: After a failed open, I want to run two statements for an "or die". Code Quesiton: open (TEST, ">/tmp/test") or { die "Could not open test file\n"; syslog

suidperl.

2005-03-25 Thread Rod Za
Hello all. I'm trying to make changes in a file (smb.conf) that is owner by root (chmod=644). I'm using the Config::IniFiles module to do the work and the script run as 'lp' user. This is a piece of code: if($self->{config}{AUTO_SMB_PRINTER}){ $self->log_it('DEBUG',"(D): Auto SAMBA printer on.

Many-to-many with Class::DBI how-to?

2005-04-09 Thread Rod Za
Hello, Can someone help me with this? I'm trying to make the use of Class::DBI and i need to do a many-to-many relationship. (an user has many groups and a group has many users, and an user with a group has many history.) I think what i make was correct, i can access the group_name value of th

Newbie Perl Question

2006-07-17 Thread Rod Burgess
I am new to the Perl world and am trying to learn it. A coworker tells me that Perl will not work for what I am trying to do however, I think Perl would be a great tool to use and I feel this coworker is wrong. I have a file that contains several lines all as below: DR03555{tab}45600062888{t

Newbie Perl Question

2006-07-17 Thread Rod Burgess
I am new to the Perl world and am trying to learn it. A coworker tells me that Perl will not work for what I am trying to do however, I think Perl would be a great tool to use and I feel this coworker is wrong. I have a file that contains several lines all as below: DR03555{tab}45600062888{t

Thanks for newbie answer

2006-07-17 Thread Rod Burgess
I appreciate all of your assistance with my eariler question. It is amazing how many different variations of Perl scripts that can be used to come up with the same results. The best part was showing my co-worker just what Perl can do. Thanks again. Rod -- To unsubscribe, e-mail: [EMAIL

RE: Help - Trying to use File::Spec module

2003-02-14 Thread Crowder, Rod
> -Original Message- > From: Gazi, Nasser (London) [mailto:[EMAIL PROTECTED]] > Sent: 14 February 2003 15:07 > To: [EMAIL PROTECTED] > Subject: Help - Trying to use File::Spec module > > > I'm trying to use the catfile method in the File::Spec > module. The following > program (called

RE: substitute for NTs "net use"

2003-02-17 Thread Crowder, Rod
The Win32::NetResource Module will let you mount remote share use Win32::NetResource; use strict; use warnings; my$RemoteShare = { 'LocalName' => "Q:", 'RemoteName' => "server\\share", }; my $UserName = "user"; my $Password =

Test message plz delet without wasting time reading it

2003-02-19 Thread Crowder, Rod
The information contained in this e-mail is intended only for the individual or entity to whom it is addressed. Its contents (including any attachments) are confidential and may contain privileged information. If you are not an intended recipient you must not use, disclose, disseminate, copy or

RE: bitwise?

2003-02-24 Thread Crowder, Rod
Hi Your example is AND'ing the results of the two matches, so will return true if both matches occur. An example of comparing characters using the bitwise AND and the result might help, or confuse you more thoroughly :) hth Rod my $a = "a"; my $A = "A"; my $B

Help with learning VB Script (Please don't shout at me)

2003-02-25 Thread Crowder, Rod
As I said, please don't shout at me A situation has arisen at work, where a new application which has been bought requires VB script to do pattern matching and string modification. Yes I know that it is easier in Perl, (and the app supports perl) but the PHB has decreed that the VBscript route

RE: Help with learning VB Script (Please don't shout at me)

2003-02-25 Thread Crowder, Rod
Many thanks, this looks useful. I appreciate the help as this is slightly OT Regards Rod Crowder The information contained in this e-mail is intended only for the individual or entity to whom it is addressed. Its contents (including any attachments) are confidential and may contain privileged