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

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.

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

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

2004-07-16 Thread Rod Za
Hi, I have a doubt. If i create an array inside a foreach loop using `my`, is this array recreated every time or every time the loop pass by i got a new array? e.g.: _BEGIN_ #!/usr/bin/perl use warnings; use strict; my @array1 =(1,2,3,4,5,6,7,8,9); foreach(@array1){ my @array2 = ($_,'a','b','c'

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 % characters in a string that are not element > attribu

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: Help with array reference that has a HASH reference.

2004-07-06 Thread Rod Za
Hi Charles, thank you very much for the help and the hint: --- "Charles K. Clarkson" <[EMAIL PROTECTED]> wrote: [snip] > We really don't need %job at all: > my @jobs; > foreach ( @lpstat ) { > next unless > /^ > \Q$printer\E- > (\d+)

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

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: 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+)

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

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

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

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

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

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

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

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

2004-06-29 Thread Rod Za
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 if there's a better way to do this?: _BEGIN_ #!/usr/bin/perl -w my($file) = $ARGV[0]; #receives the filename my @tmp = split(/\//,$file);

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

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

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;

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