473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error: Global symbol "" requires explicit package name at

2
there is a lot of errors in this perl. what causes and how can i fix them

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use File::Path qw(make_path);
  5. use LWP::UserAgent;
  6. use File::Temp qw(tempfile tempdir);
  7. use Compress::Zlib qw(uncompress);
  8.  
  9. sub readtime
  10. {
  11.    my ($handle, $hashref) = @_;
  12.  
  13.    read $handle, my $rawtime, 8;
  14.  
  15.    ( $hashref->{'lsb32'},
  16.      $hashref->{'nsec'} ) = unpack "NN", $rawtime;
  17.  
  18.    return $hashref;
  19. }
  20.  
  21. sub readindex
  22. {
  23.    my ($infile) = @_;
  24.    my $packindex;
  25.  
  26.    # read the header
  27.    read $infile, my $rawheader, 12;
  28.    my $header = {};
  29.    ($header->{'ident'}, $header->{'version'}, $header->{'entries'})
  30.       = unpack("a4NN", $rawheader);
  31.  
  32.    die "Not a git index file" if ($header->{'ident'} ne "DIRC");
  33.    die "Unsupported version of git index" if ($header->{'version'} != 2);
  34.  
  35.    my @index_entries = ();
  36.  
  37.    for (my $i=0; $i{'entries'}; $i++)
  38.    {
  39.       my $statinfo = {};
  40.       my $entry = {};
  41.       my $rawdata;
  42.       my %ctime = ();
  43.       my %mtime = ();
  44.  
  45.       $statinfo->{'ctime'}=readtime($infile, \%ctime);
  46.       $statinfo->{'mtime'}=readtime($infile, \%ctime);
  47.  
  48.       # read the non-time fields
  49.       read $infile, $rawdata, 24; 
  50.       ( $statinfo->{'dev'}.
  51.         $statinfo->{'inode'}.
  52.         $statinfo->{'mode'}.
  53.         $statinfo->{'uid'}.
  54.         $statinfo->{'gid'}.
  55.         $statinfo->{'size'} ) = unpack "NNNNNN", $rawdata;
  56.  
  57.       $entry->{'statinfo'}=$statinfo;
  58.       read $infile, $rawdata, 20; 
  59.       ( $entry->{'id'} ) = unpack "H*", $rawdata;
  60.       $packindex.=$rawdata;
  61.       read $infile, $rawdata, 2; 
  62.       ( $entry->{'flags'} ) = unpack "n", $rawdata;
  63.  
  64.       # Finally read name - it's length is the lower 11 bits of flags
  65.       my $namelength=($entry->{'flags'} & 0x7ff)+1;
  66.  
  67.       # Pad it up to a multiple of 4
  68.       read $infile, $rawdata, $namelength + (8 - (($namelength + 62) % 8)) %8; 
  69.       ($entry->{'name'}) = unpack "a" . ($namelength-1), $rawdata;
  70.  
  71.       push(@index_entries, $entry);
  72.    }
  73.    return @index_entries;
  74. }
  75.  
  76. # First grab the database file
  77. my $target=$ARGV[0];
  78. my $giturl="http://$ARGV[0]/.git/index";
  79. my $ua=LWP::UserAgent->new;
  80. print "Target is: $giturl\n";
  81. $ua->agent("All Your Files Are Belong To Us/1.0");
  82. my $request=HTTP::Request->new(GET => $giturl);
  83. my $result=$ua->request($request);
  84.  
  85. if ($result->status_line !~ /^200/)
  86. {
  87.    die "Could not find Git index file";
  88. }
  89.  
  90. my ($dbfileh, $dbfilen) = tempfile();
  91. print $dbfileh $result->content;
  92. close $dbfileh;
  93.  
  94. open(my $infile, "{'id'},0,2);
  95.    my $resthash=substr($entry->{'id'},2);
  96.  
  97.    my $file=".git/objects/" . $firsttwo . "/" . $resthash;
  98.    my $rawdata;
  99.    my $decompressed;
  100.    my $oh;
  101.  
  102.    print "Extracting " . $entry->{'name'} . "\n";
  103.  
  104.    my $giturl="http://$server/$file";
  105.    my $frequest=HTTP::Request->new(GET => $giturl);
  106.    my $fresult=$ua->request($frequest);
  107.    $rawdata=$fresult->content;
  108.  
  109.    # Make sure the path is there for the output
  110.    my $outputpath="output/" . $entry->{'name'};
  111.    $outputpath =~ s#/[^/]*$##g;
  112.  
  113.    make_path($outputpath);
  114.    open $oh, ">", "output/$entry->{'name'}";
  115.  
  116.    # Now decompress the data
  117.    $decompressed=uncompress($rawdata);
  118.    my $gitfile={};
  119.  
  120.    ($gitfile->{'type'}) = substr($decompressed,0,5);
  121.    if ($gitfile->{'type'} ne "blob ")
  122.    {
  123.       print "Unknown git file type: $gitfile->{'type'}. Skipping\n";
  124.       next;
  125.    }
  126.    ($gitfile->{'size'}) = unpack "Z*", substr($decompressed,5);
  127.    ($gitfile->{'data'}) = substr($decompressed,length($gitfile->{'size'})+6);
  128.  
  129.    # And write it
  130.    print $oh $gitfile->{'data'};
  131.    close($oh);
  132. }
Oct 20 '14 #1
1 2955
gbox26
2
i rewrote this code with my preferred language
Oct 22 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: xxx | last post by:
Hello, I get an error message: Global symbol "%Config" requires explicit package name at /usr/lib/perl5/5.8.3/i386-linux-thread-multi/Errno.pm line 11. What does this mean?
3
by: Petterson Mikael | last post by:
Hi, I have the following package names ( in an xml) that I will transform to html. I need to sort them. <package name="se.company.product.subproduct.boam.fpx.testsignals"> <package...
4
by: r.nikhilk | last post by:
Hi, We are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the...
2
by: ygao | last post by:
when a function or method is called,how can get the module global symbol table from which it is called,not the module where it is defined(this is easy). thanks!
1
by: seberino | last post by:
PyList_Append requires explicit Py_INCREF after? (I didn't see in docs where it said if appends a new reference or a borrowed reference like other APIs.) thanks! Chris
3
by: sdeathstar | last post by:
I am working on IBM AIX machine and using XLC C++ complier version 8.0. 1) Able to compile the objects on AIX from C and C++ source code. 2) Able to create the libraries (combination of C & C++,...
1
by: rockdc1981 | last post by:
I dont get it lately the code is working andnow i get the error message...the code below is on a list where i can select the reports from a table source and enables user to preview and export it..any...
2
by: Bennett Haselton | last post by:
How do I find the mapping between a PHP package name like HTTP_Request, and the "yum" command to install it on CentOS 4.4? For example when I needed to use LWP::UserAgent to use in Perl, the...
12
by: Abhishek Mishra | last post by:
Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an...
1
by: KBSethna | last post by:
Linker Error:Undefined Symbol ATM_c::run() in module Project.cpp Linker Error:Undefined Symbol ATM_c::ATM_c() in module Project.cpp ATM_c is a class having a function run() and a constructor....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.